1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-12-27 20:45:28 -05:00

massive refactoring against json config parsing

This commit is contained in:
v2ray
2016-01-15 12:43:06 +01:00
parent f87ab4713c
commit e5fa96f814
51 changed files with 424 additions and 586 deletions

View File

@@ -0,0 +1,26 @@
// +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
})
}