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)
	}
}
func init() {
	if err := internal.RegisterOutboundConnectionHandlerFactory("blackhole", func(space app.Space, config interface{}) (proxy.OutboundConnectionHandler, error) {
		return NewBlackHole(), nil
	}); err != nil {
		panic(err)
	}
}
Exemple #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
		}
	}
}
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)
	}
}