mirror of
https://github.com/v2fly/v2ray-core
synced 2024-02-27 03:18:06 +00:00
Move connection handler interfaces to proxy/common/connhandler
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package connhandler
|
||||
|
||||
var (
|
||||
inboundFactories = make(map[string]InboundConnectionHandlerFactory)
|
||||
outboundFactories = make(map[string]OutboundConnectionHandlerFactory)
|
||||
)
|
||||
|
||||
func RegisterInboundConnectionHandlerFactory(name string, factory InboundConnectionHandlerFactory) error {
|
||||
// TODO check name
|
||||
inboundFactories[name] = factory
|
||||
return nil
|
||||
}
|
||||
|
||||
func RegisterOutboundConnectionHandlerFactory(name string, factory OutboundConnectionHandlerFactory) error {
|
||||
// TODO check name
|
||||
outboundFactories[name] = factory
|
||||
return nil
|
||||
}
|
||||
|
||||
func GetInboundConnectionHandlerFactory(name string) InboundConnectionHandlerFactory {
|
||||
factory, found := inboundFactories[name]
|
||||
if !found {
|
||||
return nil
|
||||
}
|
||||
return factory
|
||||
}
|
||||
|
||||
func GetOutboundConnectionHandlerFactory(name string) OutboundConnectionHandlerFactory {
|
||||
factory, found := outboundFactories[name]
|
||||
if !found {
|
||||
return nil
|
||||
}
|
||||
return factory
|
||||
}
|
||||
Reference in New Issue
Block a user