inbound.go 668 B

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