add local proxy addr configuration
This commit is contained in:
1 parent
5b98351e58
commit
3d7e96acad
28 files changed
+76
-26
No files matched your search
@@ -144,7 +144,7 @@ func StopJoiner() {
|
||||
logMsg("dc-joiner: stopped")
|
||||
}
|
||||
|
||||
func StartJoiner(wsPort, socksPort int, socksUser, socksPass string, cb LogCallback) error {
|
||||
func StartJoiner(wsPort, socksPort int, socksHost, socksUser, socksPass string, cb LogCallback) error {
|
||||
StopJoiner()
|
||||
logCb = cb
|
||||
j := &joinerRelay{
|
||||
@@ -169,7 +169,10 @@ func StartJoiner(wsPort, socksPort int, socksUser, socksPass string, cb LogCallb
|
||||
}
|
||||
}()
|
||||
|
||||
socksAddr := fmt.Sprintf("127.0.0.1:%d", socksPort)
|
||||
if socksHost == "" {
|
||||
socksHost = common.SocksLocalhostIP
|
||||
}
|
||||
socksAddr := fmt.Sprintf("%s:%d", socksHost, socksPort)
|
||||
socksLn, err := net.Listen("tcp", socksAddr)
|
||||
if err != nil {
|
||||
wsSrv.Close()
|
||||
|
||||
@@ -9,6 +9,8 @@ import (
|
||||
"syscall"
|
||||
|
||||
"github.com/xjasonlyu/tun2socks/v2/engine"
|
||||
|
||||
"whitelist-bypass/relay/common"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -28,9 +30,9 @@ func StartTun2Socks(fd, mtu, socksPort int, socksUser, socksPass string) error {
|
||||
|
||||
var proxy string
|
||||
if socksUser != "" {
|
||||
proxy = fmt.Sprintf("socks5://%s:%s@127.0.0.1:%d", socksUser, socksPass, socksPort)
|
||||
proxy = fmt.Sprintf("socks5://%s:%s@%s:%d", socksUser, socksPass, common.SocksLocalhostIP, socksPort)
|
||||
} else {
|
||||
proxy = fmt.Sprintf("socks5://127.0.0.1:%d", socksPort)
|
||||
proxy = fmt.Sprintf("socks5://%s:%d", common.SocksLocalhostIP, socksPort)
|
||||
}
|
||||
logMsg("tun2socks: starting fd=%d (dup=%d) mtu=%d proxy=%s", fd, dupFd, mtu, proxy)
|
||||
os.Setenv("TUN2SOCKS_LOG_LEVEL", "info")
|
||||
|
||||
Reference in new issue
Block a user