From 2327420f75d7ced05bfb270d30b2121b6139effd Mon Sep 17 00:00:00 2001 From: Andy Wang Date: Sat, 4 Apr 2020 00:43:06 +0100 Subject: [PATCH] Allow remote host to be set in the client config file --- cmd/ck-client/ck-client.go | 5 ++++- internal/client/state.go | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/cmd/ck-client/ck-client.go b/cmd/ck-client/ck-client.go index 8c67db4..7283303 100644 --- a/cmd/ck-client/ck-client.go +++ b/cmd/ck-client/ck-client.go @@ -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" } diff --git a/internal/client/state.go b/internal/client/state.go index e663a49..14711d5 100644 --- a/internal/client/state.go +++ b/internal/client/state.go @@ -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