Skip to content

Commit

Permalink
Set UDP timeout to seconds
Browse files Browse the repository at this point in the history
Signed-off-by: Syrone Wong <[email protected]>
  • Loading branch information
wongsyrone committed Mar 2, 2020
1 parent 9419a65 commit f881841
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tun2socks/tun2socks.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"net"
"os"
"strings"
"time"

"github.com/eycorsican/go-tun2socks/common/dns/cache"
"github.com/eycorsican/go-tun2socks/common/dns/fakedns"
Expand Down Expand Up @@ -114,10 +115,10 @@ func Start(tunFd int, socks5Server string, fakeIPStart string, fakeIPStop string
if fakeIPStart != "" && fakeIPStop != "" {
fakeDNS := fakedns.NewSimpleFakeDns(fakeIPStart, fakeIPStop)
core.RegisterTCPConnHandler(socks.NewTCPHandler(proxyHost, proxyPort, fakeDNS, nil))
core.RegisterUDPConnHandler(socks.NewUDPHandler(proxyHost, proxyPort, 30, cacheDNS, fakeDNS, nil))
core.RegisterUDPConnHandler(socks.NewUDPHandler(proxyHost, proxyPort, 30*time.Second, cacheDNS, fakeDNS, nil))
} else {
core.RegisterTCPConnHandler(socks.NewTCPHandler(proxyHost, proxyPort, nil, nil))
core.RegisterUDPConnHandler(socks.NewUDPHandler(proxyHost, proxyPort, 30, cacheDNS, nil, nil))
core.RegisterUDPConnHandler(socks.NewUDPHandler(proxyHost, proxyPort, 30*time.Second, cacheDNS, nil, nil))
}

// Register an output callback to write packets output from lwip stack to tun
Expand Down

0 comments on commit f881841

Please sign in to comment.