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

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