Skip to content

Commit

Permalink
remove timeout when not given
Browse files Browse the repository at this point in the history
  • Loading branch information
xvzc committed Aug 3, 2024
1 parent 6e7319e commit 2069f3b
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 27 deletions.
2 changes: 1 addition & 1 deletion make-releases.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

VERSION="v0.10.2"
VERSION="v0.10.3"

for osarch in 'darwin/amd64' 'linux/amd64' 'linux/arm' 'linux/arm64' 'linux/mips' 'linux/mipsle'; do
GOOS=${osarch%/*} GOARCH=${osarch#*/} go build -ldflags="-w -s -X main.VERSION=${VERSION}" github.com/xvzc/SpoofDPI/cmd/spoof-dpi &&
Expand Down
8 changes: 5 additions & 3 deletions proxy/io.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,11 @@ func Serve(from *net.TCPConn, to *net.TCPConn, proto string, fd string, td strin
proto += " "

for {
from.SetReadDeadline(
time.Now().Add(time.Millisecond * time.Duration(timeout)),
)
if timeout > 0 {
from.SetReadDeadline(
time.Now().Add(time.Millisecond * time.Duration(timeout)),
)
}

buf, err := ReadBytes(from)
if err != nil {
Expand Down
4 changes: 3 additions & 1 deletion proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ func (pxy *Proxy) Start() {
os.Exit(1)
}

log.Println(fmt.Sprintf("[PROXY] Connection timeout is set to %dms", pxy.timeout))
if pxy.timeout > 0 {
log.Println(fmt.Sprintf("[PROXY] Connection timeout is set to %dms", pxy.timeout))
}

log.Println("[PROXY] Created a listener on port", pxy.port)

Expand Down
3 changes: 1 addition & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Usage: spoof-dpi [options...]
-port int
port (default 8080)
-timeout int
timeout in milliseconds (default 2000)
timeout in milliseconds. no timeout when not given
-url value
Bypass DPI only on this url, can be passed multiple times
-v print spoof-dpi's version. this may contain some other relevant information
Expand All @@ -77,7 +77,6 @@ Usage: spoof-dpi [options...]
try lower values if the default value doesn't bypass the DPI;
set to 0 to use old (pre v0.10.0) client hello splitting method:
fragmentation for the first data packet and the rest (default 50)
```
> If you are using any vpn extensions such as Hotspot Shield in Chrome browser,
go to Settings > Extensions, and disable them.
Expand Down
2 changes: 1 addition & 1 deletion readme_ko.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Usage: spoof-dpi [options...]
-port int
port (default 8080)
-timeout int
timeout in milliseconds (default 2000)
timeout in milliseconds. no timeout when not given
-url value
Bypass DPI only on this url, can be passed multiple times
-v print spoof-dpi's version. this may contain some other relevant information
Expand Down
31 changes: 15 additions & 16 deletions readme_ru.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,32 +52,31 @@ curl -fsSL https://raw.githubusercontent.com/xvzc/SpoofDPI/main/install.sh | bas
```
Использование: spoof-dpi [опции...]
-addr string
адрес (по умолчанию "127.0.0.1")
listen address (default "127.0.0.1")
-debug
включает режим отладки
enable debug output
-dns-addr string
адрес DNS (по умолчанию "8.8.8.8")
dns address (default "8.8.8.8")
-dns-port int
порт DNS сервера (по умолчанию 53)
port number for dns (default 53)
-enable-doh
включает 'dns over https'
enable 'dns over https'
-no-banner
выключает баннер
disable banner
-pattern string
обходить DPI только на пакетах с указанным regex
bypass DPI only on packets matching this regex pattern
-port int
порт (по умолчанию 8080)
port (default 8080)
-timeout int
таймаут в миллисекундах (по умолчанию 2000)
timeout in milliseconds. no timeout when not given
-url value
обходить DPI только на указанном URL, опцию можно указывать несколько раз
-v выводит версию spoof-dpi. может содержать другую полезную информацию
Bypass DPI only on this url, can be passed multiple times
-v print spoof-dpi's version. this may contain some other relevant information
-window-size int
размер чанка в байтах для фрагментации client hello,
если не работает по умолчанию, можно попробовать значения меньше;
при 0 используется старый (до v0.10.0) метод разделения client hello:
фрагментация для первого дата пакета и остальных (по умолчанию 50)
chunk size, in number of bytes, for fragmented client hello,
try lower values if the default value doesn't bypass the DPI;
set to 0 to use old (pre v0.10.0) client hello splitting method:
fragmentation for the first data packet and the rest (default 50)
```
> Если Вы используете любые VPN-расширения по типу Hotspot Shield в браузере
Chrome, зайдите в Настройки > Расширения и отключите их.
Expand Down
2 changes: 1 addition & 1 deletion readme_zh-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Usage: spoof-dpi [options...]
-port int
port (default 8080)
-timeout int
timeout in milliseconds (default 2000)
timeout in milliseconds. no timeout when not given
-url value
Bypass DPI only on this url, can be passed multiple times
-v print spoof-dpi's version. this may contain some other relevant information
Expand Down
3 changes: 1 addition & 2 deletions util/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func ParseArgs() {
config.EnableDoh = flag.Bool("enable-doh", false, "enable 'dns over https'")
config.Debug = flag.Bool("debug", false, "enable debug output")
config.NoBanner = flag.Bool("no-banner", false, "disable banner")
config.Timeout = flag.Int("timeout", 2000, "timeout in milliseconds")
config.Timeout = flag.Int("timeout", 0, "timeout in milliseconds. no timeout when not given")
config.WindowSize = flag.Int("window-size", 50, `chunk size, in number of bytes, for fragmented client hello,
try lower values if the default value doesn't bypass the DPI;
set to 0 to use old (pre v0.10.0) client hello splitting method:
Expand All @@ -67,7 +67,6 @@ fragmentation for the first data packet and the rest`)
)
config.Version = flag.Bool("v", false, "print spoof-dpi's version. this may contain some other relevant information")


flag.Parse()

if len(allowedHosts) > 0 {
Expand Down

0 comments on commit 2069f3b

Please sign in to comment.