Exemple #1
0
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
}
Exemple #2
0
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")
}