diff --git a/cmd/ck-client/ck-client.go b/cmd/ck-client/ck-client.go index bedb4eb..f5e9bff 100644 --- a/cmd/ck-client/ck-client.go +++ b/cmd/ck-client/ck-client.go @@ -131,7 +131,7 @@ func main() { } } - localConfig, remoteConfig, authInfo, err := rawConfig.SplitConfigs(common.RealWorldState) + localConfig, remoteConfig, authInfo, err := rawConfig.ProcessRawConfig(common.RealWorldState) if err != nil { log.Fatal(err) } diff --git a/internal/client/state.go b/internal/client/state.go index a741fd4..2d6af8f 100644 --- a/internal/client/state.go +++ b/internal/client/state.go @@ -16,9 +16,9 @@ import ( ) // RawConfig represents the fields in the config json file -// nullable means if it's empty, a default value will be chosen in SplitConfigs +// nullable means if it's empty, a default value will be chosen in ProcessRawConfig // jsonOptional means if the json's empty, its value will be set from environment variables or commandline args -// but it mustn't be empty when SplitConfigs is called +// but it mustn't be empty when ProcessRawConfig is called type RawConfig struct { ServerName string ProxyMethod string @@ -31,7 +31,7 @@ type RawConfig struct { RemoteHost string // jsonOptional RemotePort string // jsonOptional - // defaults set in SplitConfigs + // defaults set in ProcessRawConfig UDP bool // nullable BrowserSig string // nullable Transport string // nullable @@ -126,7 +126,7 @@ func ParseConfig(conf string) (raw *RawConfig, err error) { return } -func (raw *RawConfig) SplitConfigs(worldState common.WorldState) (local LocalConnConfig, remote RemoteConnConfig, auth AuthInfo, err error) { +func (raw *RawConfig) ProcessRawConfig(worldState common.WorldState) (local LocalConnConfig, remote RemoteConnConfig, auth AuthInfo, err error) { nullErr := func(field string) (local LocalConnConfig, remote RemoteConnConfig, auth AuthInfo, err error) { err = fmt.Errorf("%v cannot be empty", field) return diff --git a/internal/test/integration_test.go b/internal/test/integration_test.go index dc58802..ad301e7 100644 --- a/internal/test/integration_test.go +++ b/internal/test/integration_test.go @@ -127,7 +127,7 @@ var tcpClientConfigs = map[string]client.RawConfig{ } func generateClientConfigs(rawConfig client.RawConfig, state common.WorldState) (client.LocalConnConfig, client.RemoteConnConfig, client.AuthInfo) { - lcl, rmt, auth, err := rawConfig.SplitConfigs(state) + lcl, rmt, auth, err := rawConfig.ProcessRawConfig(state) if err != nil { log.Fatal(err) }