inbound.go 655 B

1234567891011121314151617181920212223242526
  1. package json
  2. import (
  3. "github.com/v2ray/v2ray-core/proxy/internal/config"
  4. "github.com/v2ray/v2ray-core/proxy/internal/config/json"
  5. "github.com/v2ray/v2ray-core/proxy/vmess"
  6. vmessjson "github.com/v2ray/v2ray-core/proxy/vmess/json"
  7. )
  8. type Inbound struct {
  9. AllowedClients []*vmessjson.ConfigUser `json:"clients"`
  10. }
  11. func (c *Inbound) AllowedUsers() []vmess.User {
  12. users := make([]vmess.User, 0, len(c.AllowedClients))
  13. for _, rawUser := range c.AllowedClients {
  14. users = append(users, rawUser)
  15. }
  16. return users
  17. }
  18. func init() {
  19. config.RegisterInboundConnectionConfig("vmess", json.JsonConfigLoader(func() interface{} {
  20. return new(Inbound)
  21. }))
  22. }