mirror of https://github.com/v2ray/v2ray-core
rename InboundConfig methods
parent
d325400f2e
commit
d4dcee5fa3
|
@ -28,7 +28,7 @@ func RegisterOutboundConfig(protocol string, creator ConfigObjectCreator) error
|
|||
return registerConfigType(protocol, "outbound", creator)
|
||||
}
|
||||
|
||||
func CreateInboundConnectionConfig(protocol string, data []byte) (interface{}, error) {
|
||||
func CreateInboundConfig(protocol string, data []byte) (interface{}, error) {
|
||||
creator, found := configCache[getConfigKey(protocol, "inbound")]
|
||||
if !found {
|
||||
return nil, errors.New(protocol + " not found.")
|
||||
|
@ -36,7 +36,7 @@ func CreateInboundConnectionConfig(protocol string, data []byte) (interface{}, e
|
|||
return creator(data)
|
||||
}
|
||||
|
||||
func CreateOutboundConnectionConfig(protocol string, data []byte) (interface{}, error) {
|
||||
func CreateOutboundConfig(protocol string, data []byte) (interface{}, error) {
|
||||
creator, found := configCache[getConfigKey(protocol, "outbound")]
|
||||
if !found {
|
||||
return nil, errors.New(protocol + " not found.")
|
||||
|
|
|
@ -19,11 +19,11 @@ func TestRegisterInboundConfig(t *testing.T) {
|
|||
err := RegisterInboundConfig(protocol, creator)
|
||||
assert.Error(err).IsNil()
|
||||
|
||||
configObj, err := CreateInboundConnectionConfig(protocol, nil)
|
||||
configObj, err := CreateInboundConfig(protocol, nil)
|
||||
assert.Bool(configObj.(bool)).IsTrue()
|
||||
assert.Error(err).IsNil()
|
||||
|
||||
configObj, err = CreateOutboundConnectionConfig(protocol, nil)
|
||||
configObj, err = CreateOutboundConfig(protocol, nil)
|
||||
assert.Pointer(configObj).IsNil()
|
||||
}
|
||||
|
||||
|
@ -39,10 +39,10 @@ func TestRegisterOutboundConfig(t *testing.T) {
|
|||
err := RegisterOutboundConfig(protocol, creator)
|
||||
assert.Error(err).IsNil()
|
||||
|
||||
configObj, err := CreateOutboundConnectionConfig(protocol, nil)
|
||||
configObj, err := CreateOutboundConfig(protocol, nil)
|
||||
assert.Bool(configObj.(bool)).IsTrue()
|
||||
assert.Error(err).IsNil()
|
||||
|
||||
configObj, err = CreateInboundConnectionConfig(protocol, nil)
|
||||
configObj, err = CreateInboundConfig(protocol, nil)
|
||||
assert.Pointer(configObj).IsNil()
|
||||
}
|
||||
|
|
|
@ -45,13 +45,13 @@ func MustRegisterOutboundConnectionHandlerCreator(name string, creator OutboundC
|
|||
}
|
||||
}
|
||||
|
||||
func CreateInboundConnectionHandler(name string, space app.Space, rawConfig []byte) (proxy.InboundHandler, error) {
|
||||
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.CreateInboundConnectionConfig(name, rawConfig)
|
||||
proxyConfig, err := config.CreateInboundConfig(name, rawConfig)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -60,14 +60,14 @@ func CreateInboundConnectionHandler(name string, space app.Space, rawConfig []by
|
|||
return creator(space, nil)
|
||||
}
|
||||
|
||||
func CreateOutboundConnectionHandler(name string, space app.Space, rawConfig []byte) (proxy.OutboundHandler, error) {
|
||||
func CreateOutboundHandler(name string, space app.Space, rawConfig []byte) (proxy.OutboundHandler, error) {
|
||||
creator, found := outboundFactories[name]
|
||||
if !found {
|
||||
return nil, ErrorNameExists
|
||||
}
|
||||
|
||||
if len(rawConfig) > 0 {
|
||||
proxyConfig, err := config.CreateOutboundConnectionConfig(name, rawConfig)
|
||||
proxyConfig, err := config.CreateOutboundConfig(name, rawConfig)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -6,10 +6,10 @@ import (
|
|||
"github.com/v2ray/v2ray-core/proxy/internal"
|
||||
)
|
||||
|
||||
func CreateInboundConnectionHandler(name string, space app.Space, rawConfig []byte) (proxy.InboundHandler, error) {
|
||||
return internal.CreateInboundConnectionHandler(name, space, rawConfig)
|
||||
func CreateInboundHandler(name string, space app.Space, rawConfig []byte) (proxy.InboundHandler, error) {
|
||||
return internal.CreateInboundHandler(name, space, rawConfig)
|
||||
}
|
||||
|
||||
func CreateOutboundConnectionHandler(name string, space app.Space, rawConfig []byte) (proxy.OutboundHandler, error) {
|
||||
return internal.CreateOutboundConnectionHandler(name, space, rawConfig)
|
||||
func CreateOutboundHandler(name string, space app.Space, rawConfig []byte) (proxy.OutboundHandler, error) {
|
||||
return internal.CreateOutboundHandler(name, space, rawConfig)
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
func TestDefaultIPAddress(t *testing.T) {
|
||||
v2testing.Current(t)
|
||||
|
||||
socksConfig, err := config.CreateInboundConnectionConfig("socks", []byte(`{
|
||||
socksConfig, err := config.CreateInboundConfig("socks", []byte(`{
|
||||
"auth": "noauth"
|
||||
}`))
|
||||
assert.Error(err).IsNil()
|
||||
|
|
|
@ -31,7 +31,7 @@ func NewInboundDetourHandlerAlways(space app.Space, config *InboundDetourConfig)
|
|||
handler.ich = make([]*InboundConnectionHandlerWithPort, 0, ports.To-ports.From+1)
|
||||
for i := ports.From; i <= ports.To; i++ {
|
||||
ichConfig := config.Settings
|
||||
ich, err := proxyrepo.CreateInboundConnectionHandler(config.Protocol, space, ichConfig)
|
||||
ich, err := proxyrepo.CreateInboundHandler(config.Protocol, space, ichConfig)
|
||||
if err != nil {
|
||||
log.Error("Failed to create inbound connection handler: ", err)
|
||||
return nil, err
|
||||
|
|
|
@ -33,7 +33,7 @@ func NewInboundDetourHandlerDynamic(space app.Space, config *InboundDetourConfig
|
|||
ichArray := make([]*InboundConnectionHandlerWithPort, ichCount*2)
|
||||
for idx, _ := range ichArray {
|
||||
//port := handler.pickUnusedPort()
|
||||
ich, err := proxyrepo.CreateInboundConnectionHandler(config.Protocol, space, config.Settings)
|
||||
ich, err := proxyrepo.CreateInboundHandler(config.Protocol, space, config.Settings)
|
||||
if err != nil {
|
||||
log.Error("Point: Failed to create inbound connection handler: ", err)
|
||||
return nil, err
|
||||
|
|
|
@ -57,7 +57,7 @@ func NewPoint(pConfig *Config) (*Point, error) {
|
|||
vpoint.space.Bind(vpoint)
|
||||
|
||||
ichConfig := pConfig.InboundConfig.Settings
|
||||
ich, err := proxyrepo.CreateInboundConnectionHandler(pConfig.InboundConfig.Protocol, vpoint.space.ForContext("vpoint-default-inbound"), ichConfig)
|
||||
ich, err := proxyrepo.CreateInboundHandler(pConfig.InboundConfig.Protocol, vpoint.space.ForContext("vpoint-default-inbound"), ichConfig)
|
||||
if err != nil {
|
||||
log.Error("Failed to create inbound connection handler: ", err)
|
||||
return nil, err
|
||||
|
@ -65,7 +65,7 @@ func NewPoint(pConfig *Config) (*Point, error) {
|
|||
vpoint.ich = ich
|
||||
|
||||
ochConfig := pConfig.OutboundConfig.Settings
|
||||
och, err := proxyrepo.CreateOutboundConnectionHandler(pConfig.OutboundConfig.Protocol, vpoint.space.ForContext("vpoint-default-outbound"), ochConfig)
|
||||
och, err := proxyrepo.CreateOutboundHandler(pConfig.OutboundConfig.Protocol, vpoint.space.ForContext("vpoint-default-outbound"), ochConfig)
|
||||
if err != nil {
|
||||
log.Error("Failed to create outbound connection handler: ", err)
|
||||
return nil, err
|
||||
|
|
Loading…
Reference in New Issue