v2ray-core/proxy/vmess/inbound/json/inbound.go

26 lines
575 B
Go
Raw Normal View History

2015-10-16 10:03:22 +00:00
package json
import (
2015-10-30 21:42:24 +00:00
"github.com/v2ray/v2ray-core/proxy/common/config/json"
2015-12-07 19:32:38 +00:00
"github.com/v2ray/v2ray-core/proxy/vmess"
vmessjson "github.com/v2ray/v2ray-core/proxy/vmess/json"
2015-10-16 10:03:22 +00:00
)
type Inbound struct {
2015-12-07 19:32:38 +00:00
AllowedClients []*vmessjson.ConfigUser `json:"clients"`
2015-10-16 10:03:22 +00:00
}
2015-12-07 19:32:38 +00:00
func (c *Inbound) AllowedUsers() []vmess.User {
users := make([]vmess.User, 0, len(c.AllowedClients))
2015-10-16 10:03:22 +00:00
for _, rawUser := range c.AllowedClients {
users = append(users, rawUser)
}
return users
}
func init() {
2015-10-30 21:42:24 +00:00
json.RegisterInboundConnectionConfig("vmess", func() interface{} {
2015-10-16 10:03:22 +00:00
return new(Inbound)
})
}