Exemplo n.º 1
0
func TestDefaultIPAddress(t *testing.T) {
	v2testing.Current(t)

	socksConfig, err := config.CreateInboundConnectionConfig("socks", []byte(`{}`))
	assert.Error(err).IsNil()
	assert.String(socksConfig.(*SocksConfig).IP()).Equals("127.0.0.1")
}
Exemplo n.º 2
0
func CreateInboundConnectionHandler(name string, space app.Space, rawConfig []byte) (proxy.InboundConnectionHandler, error) {
	creator, found := inboundFactories[name]
	if !found {
		return nil, ErrorProxyNotFound
	}
	if len(rawConfig) > 0 {
		proxyConfig, err := config.CreateInboundConnectionConfig(name, rawConfig)
		if err != nil {
			return nil, err
		}
		return creator(space, proxyConfig)
	}
	return creator(space, nil)
}