bug fixes & cleanup

This commit is contained in:
Jason
2019-08-12 19:06:59 +08:00
parent 97a49725ad
commit a187c2878c
2 changed files with 5 additions and 5 deletions

View File

@@ -77,7 +77,7 @@ func main() {
args.TunGw = flag.String("tunGw", "240.0.0.1", "TUN interface gateway")
args.TunMask = flag.String("tunMask", "255.255.255.0", "TUN interface netmask, it should be a prefixlen (a number) for IPv6 address")
args.TunDns = flag.String("tunDns", "1.1.1.1", "DNS resolvers for TUN interface (Windows Only)")
args.ProxyType = flag.String("proxyType", "socks", "Proxy handler type")
args.ProxyType = flag.String("proxyType", "socks, exception", "Proxy handler type")
args.DelayICMP = flag.Int("delayICMP", 1, "Delay ICMP packets for a short period of time, in milliseconds")
args.LogLevel = flag.String("loglevel", "info", "Logging level. (info, warning, error, debug, silent)")

View File

@@ -9,7 +9,7 @@ import (
"github.com/xjasonlyu/tun2socks/common/log"
"github.com/xjasonlyu/tun2socks/core"
"github.com/xjasonlyu/tun2socks/proxy/d"
"github.com/xjasonlyu/tun2socks/proxy/exception"
"github.com/xjasonlyu/tun2socks/proxy/socks"
)
@@ -17,7 +17,7 @@ func init() {
args.ExceptionApps = flag.String("exceptionApps", "", "A list of exception apps separated by commas")
args.ExceptionSendThrough = flag.String("exceptionSendThrough", "192.168.1.101:0", "Exception send through address")
registerHandlerCreator("d", func() {
registerHandlerCreator("exception", func() {
// Verify proxy server address.
proxyAddr, err := net.ResolveTCPAddr("tcp", *args.ProxyServer)
if err != nil {
@@ -34,8 +34,8 @@ func init() {
log.Fatalf("invalid exception send through address: %v", err)
}
apps := strings.Split(*args.ExceptionApps, ",")
tcpHandler := d.NewTCPHandler(proxyTCPHandler, apps, sendThrough)
udpHandler := d.NewUDPHandler(proxyUDPHandler, apps, sendThrough, *args.UdpTimeout)
tcpHandler := exception.NewTCPHandler(proxyTCPHandler, apps, sendThrough)
udpHandler := exception.NewUDPHandler(proxyUDPHandler, apps, sendThrough, *args.UdpTimeout)
core.RegisterTCPConnHandler(tcpHandler)
core.RegisterUDPConnHandler(udpHandler)