Exemplo n.º 1
0
func init() {
	if err := internal.RegisterOutboundConnectionHandlerFactory("freedom", func(space app.Space, config interface{}) (proxy.OutboundConnectionHandler, error) {
		return &FreedomConnection{space: space}, nil
	}); err != nil {
		panic(err)
	}
}
Exemplo n.º 2
0
func init() {
	if err := internal.RegisterOutboundConnectionHandlerFactory("blackhole", func(space app.Space, config interface{}) (proxy.OutboundConnectionHandler, error) {
		return NewBlackHole(), nil
	}); err != nil {
		panic(err)
	}
}
Exemplo n.º 3
0
func RegisterOutboundConnectionHandlerCreator(prefix string, creator internal.OutboundConnectionHandlerCreator) (string, error) {
	for {
		name := prefix + randomString()
		err := internal.RegisterOutboundConnectionHandlerFactory(name, creator)
		if err != internal.ErrorNameExists {
			return name, err
		}
	}
}
Exemplo n.º 4
0
func init() {
	if err := internal.RegisterOutboundConnectionHandlerFactory("vmess", func(space app.Space, rawConfig interface{}) (proxy.OutboundConnectionHandler, error) {
		vOutConfig := rawConfig.(Config)
		return &VMessOutboundHandler{
			space:           space,
			receiverManager: NewReceiverManager(vOutConfig.Receivers()),
		}, nil
	}); err != nil {
		panic(err)
	}
}