Skip to content

Commit

Permalink
Allow remote host to be set in the client config file
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeuw committed Apr 3, 2020
1 parent d482661 commit 2327420
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cmd/ck-client/ck-client.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,6 @@ func main() {
sta := &client.State{
LocalHost: localHost,
LocalPort: localPort,
RemoteHost: remoteHost,
RemotePort: remotePort,
Now: time.Now,
}
Expand All @@ -291,6 +290,10 @@ func main() {
sta.ProxyMethod = proxyMethod
}

if remoteHost != "" {
sta.RemoteHost = remoteHost
}

if os.Getenv("SS_LOCAL_HOST") != "" {
sta.ProxyMethod = "shadowsocks"
}
Expand Down
2 changes: 2 additions & 0 deletions internal/client/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ type rawConfig struct {
Transport string
NumConn int
StreamTimeout int
RemoteHost string
RemotePort int
}

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 2327420

Please sign in to comment.