inbound.go 636 B

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