func init() { if err := internal.RegisterInboundConnectionHandlerFactory("socks", func(space app.Space, rawConfig interface{}) (proxy.InboundConnectionHandler, error) { return NewSocksServer(space, rawConfig.(Config)), nil }); err != nil { panic(err) } }
func init() { if err := internal.RegisterInboundConnectionHandlerFactory("dokodemo-door", func(space app.Space, rawConfig interface{}) (proxy.InboundConnectionHandler, error) { config := rawConfig.(Config) return NewDokodemoDoor(space, config), nil }); err != nil { panic(err) } }
func RegisterInboundConnectionHandlerCreator(prefix string, creator internal.InboundConnectionHandlerCreator) (string, error) { for { name := prefix + randomString() err := internal.RegisterInboundConnectionHandlerFactory(name, creator) if err != internal.ErrorNameExists { return name, err } } }
func init() { if err := internal.RegisterInboundConnectionHandlerFactory("vmess", func(space app.Space, rawConfig interface{}) (proxy.InboundConnectionHandler, error) { config := rawConfig.(Config) allowedClients := user.NewTimedUserSet() for _, user := range config.AllowedUsers() { allowedClients.AddUser(user) } return NewVMessInboundHandler(space, allowedClients), nil }); err != nil { panic(err) } }