inbound.go 575 B

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