Exemplo n.º 1
0
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)
	}
}
Exemplo n.º 3
0
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
		}
	}
}
Exemplo n.º 4
0
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)
	}
}