mirror of https://github.com/cbeuw/Cloak
Rename SplitConfigs to ProcessRawConfig to better reflect its behaviour
This commit is contained in:
parent
3e133090f0
commit
f96925982f
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue