mirror of https://github.com/v2ray/v2ray-core
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
529 B
27 lines
529 B
9 years ago
|
// +build json
|
||
|
|
||
|
package inbound
|
||
|
|
||
|
import (
|
||
|
"encoding/json"
|
||
|
|
||
|
"github.com/v2ray/v2ray-core/proxy/internal/config"
|
||
|
"github.com/v2ray/v2ray-core/proxy/vmess"
|
||
|
)
|
||
|
|
||
|
func init() {
|
||
|
config.RegisterInboundConnectionConfig("vmess",
|
||
|
func(data []byte) (interface{}, error) {
|
||
|
type JsonConfig struct {
|
||
|
Users []*vmess.User `json:"clients"`
|
||
|
}
|
||
|
jsonConfig := new(JsonConfig)
|
||
|
if err := json.Unmarshal(data, jsonConfig); err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
return &Config{
|
||
|
AllowedUsers: jsonConfig.Users,
|
||
|
}, nil
|
||
|
})
|
||
|
}
|