1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-11-04 17:27:23 -05:00
v2fly/app/proxyman/proxyman.go

36 lines
1003 B
Go
Raw Normal View History

2017-01-03 08:21:59 -05:00
// Package proxyman defines applications for manageing inbound and outbound proxies.
2016-01-31 11:01:28 -05:00
package proxyman
import (
2016-08-20 14:55:45 -04:00
"v2ray.com/core/app"
2017-01-06 09:32:36 -05:00
"v2ray.com/core/common/serial"
2016-08-20 14:55:45 -04:00
"v2ray.com/core/proxy"
2016-01-31 11:01:28 -05:00
)
type InboundHandlerManager interface {
GetHandler(tag string) (proxy.InboundHandler, int)
}
2016-05-18 02:05:52 -04:00
type OutboundHandlerManager interface {
GetHandler(tag string) proxy.OutboundHandler
GetDefaultHandler() proxy.OutboundHandler
2016-12-16 17:02:11 -05:00
SetDefaultHandler(handler proxy.OutboundHandler) error
SetHandler(tag string, handler proxy.OutboundHandler) error
2016-01-31 11:01:28 -05:00
}
2017-01-06 09:32:36 -05:00
func InboundHandlerManagerFromSpace(space app.Space) InboundHandlerManager {
app := space.(app.AppGetter).GetApp(serial.GetMessageType((*InboundConfig)(nil)))
if app == nil {
return nil
}
return app.(InboundHandlerManager)
}
func OutboundHandlerManagerFromSpace(space app.Space) OutboundHandlerManager {
app := space.(app.AppGetter).GetApp(serial.GetMessageType((*OutboundConfig)(nil)))
if app == nil {
return nil
}
return app.(OutboundHandlerManager)
}