Allow remote host to be set in the client config file

This commit is contained in:
Andy Wang 2020-04-04 00:43:06 +01:00
parent d482661494
commit 2327420f75
2 changed files with 6 additions and 1 deletions

View File

@ -277,7 +277,6 @@ func main() {
sta := &client.State{
LocalHost: localHost,
LocalPort: localPort,
RemoteHost: remoteHost,
RemotePort: remotePort,
Now: time.Now,
}
@ -291,6 +290,10 @@ func main() {
sta.ProxyMethod = proxyMethod
}
if remoteHost != "" {
sta.RemoteHost = remoteHost
}
if os.Getenv("SS_LOCAL_HOST") != "" {
sta.ProxyMethod = "shadowsocks"
}

View File

@ -24,6 +24,7 @@ type rawConfig struct {
Transport string
NumConn int
StreamTimeout int
RemoteHost string
RemotePort int
}
@ -128,6 +129,7 @@ func (sta *State) ParseConfig(conf string) (err error) {
sta.Transport = DirectTLS{}
}
sta.RemoteHost = preParse.RemoteHost
sta.ProxyMethod = preParse.ProxyMethod
sta.ServerName = preParse.ServerName
sta.NumConn = preParse.NumConn