Forráskód Böngészése

rename InboundConnectionHandlerCreator

v2ray 9 éve
szülő
commit
5e16fa2dcd
3 módosított fájl, 10 hozzáadás és 10 törlés
  1. 2 2
      proxy/internal/creator.go
  2. 6 6
      proxy/internal/handler_cache.go
  3. 2 2
      proxy/testing/proxy.go

+ 2 - 2
proxy/internal/creator.go

@@ -5,5 +5,5 @@ import (
 	"github.com/v2ray/v2ray-core/proxy"
 )
 
-type InboundConnectionHandlerCreator func(space app.Space, config interface{}) (proxy.InboundHandler, error)
-type OutboundConnectionHandlerCreator func(space app.Space, config interface{}) (proxy.OutboundHandler, error)
+type InboundHandlerCreator func(space app.Space, config interface{}) (proxy.InboundHandler, error)
+type OutboundHandlerCreator func(space app.Space, config interface{}) (proxy.OutboundHandler, error)

+ 6 - 6
proxy/internal/handler_cache.go

@@ -9,15 +9,15 @@ import (
 )
 
 var (
-	inboundFactories  = make(map[string]InboundConnectionHandlerCreator)
-	outboundFactories = make(map[string]OutboundConnectionHandlerCreator)
+	inboundFactories  = make(map[string]InboundHandlerCreator)
+	outboundFactories = make(map[string]OutboundHandlerCreator)
 
 	ErrorProxyNotFound    = errors.New("Proxy not found.")
 	ErrorNameExists       = errors.New("Proxy with the same name already exists.")
 	ErrorBadConfiguration = errors.New("Bad proxy configuration.")
 )
 
-func RegisterInboundHandlerCreator(name string, creator InboundConnectionHandlerCreator) error {
+func RegisterInboundHandlerCreator(name string, creator InboundHandlerCreator) error {
 	if _, found := inboundFactories[name]; found {
 		return ErrorNameExists
 	}
@@ -25,13 +25,13 @@ func RegisterInboundHandlerCreator(name string, creator InboundConnectionHandler
 	return nil
 }
 
-func MustRegisterInboundConnectionHandlerCreator(name string, creator InboundConnectionHandlerCreator) {
+func MustRegisterInboundConnectionHandlerCreator(name string, creator InboundHandlerCreator) {
 	if err := RegisterInboundHandlerCreator(name, creator); err != nil {
 		panic(err)
 	}
 }
 
-func RegisterOutboundHandlerCreator(name string, creator OutboundConnectionHandlerCreator) error {
+func RegisterOutboundHandlerCreator(name string, creator OutboundHandlerCreator) error {
 	if _, found := outboundFactories[name]; found {
 		return ErrorNameExists
 	}
@@ -39,7 +39,7 @@ func RegisterOutboundHandlerCreator(name string, creator OutboundConnectionHandl
 	return nil
 }
 
-func MustRegisterOutboundConnectionHandlerCreator(name string, creator OutboundConnectionHandlerCreator) {
+func MustRegisterOutboundConnectionHandlerCreator(name string, creator OutboundHandlerCreator) {
 	if err := RegisterOutboundHandlerCreator(name, creator); err != nil {
 		panic(err)
 	}

+ 2 - 2
proxy/testing/proxy.go

@@ -13,7 +13,7 @@ func randomString() string {
 	return fmt.Sprintf("-%d", count)
 }
 
-func RegisterInboundConnectionHandlerCreator(prefix string, creator internal.InboundConnectionHandlerCreator) (string, error) {
+func RegisterInboundConnectionHandlerCreator(prefix string, creator internal.InboundHandlerCreator) (string, error) {
 	for {
 		name := prefix + randomString()
 		err := internal.RegisterInboundHandlerCreator(name, creator)
@@ -23,7 +23,7 @@ func RegisterInboundConnectionHandlerCreator(prefix string, creator internal.Inb
 	}
 }
 
-func RegisterOutboundConnectionHandlerCreator(prefix string, creator internal.OutboundConnectionHandlerCreator) (string, error) {
+func RegisterOutboundConnectionHandlerCreator(prefix string, creator internal.OutboundHandlerCreator) (string, error) {
 	for {
 		name := prefix + randomString()
 		err := internal.RegisterOutboundHandlerCreator(name, creator)