func loadConnectionConfig(message json.RawMessage, protocol string, cType proxyconfig.Type) interface{} { configObj := proxyjson.CreateConfig(protocol, cType) if configObj == nil { panic("Unknown protocol " + protocol) } err := json.Unmarshal(message, configObj) if err != nil { log.Error("Unable to parse connection config: %v", err) panic("Failed to parse connection config.") } return configObj }
func TestDefaultIPAddress(t *testing.T) { assert := unit.Assert(t) socksConfig := jsonconfig.CreateConfig("socks", config.TypeInbound).(*SocksConfig) assert.String(socksConfig.IP().String()).Equals("127.0.0.1") }