1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-10-03 17:23:43 -04:00
v2fly/net/vmess/config.go

41 lines
890 B
Go
Raw Normal View History

2015-09-12 05:51:42 -04:00
package vmess
import (
"encoding/json"
"github.com/v2ray/v2ray-core"
v2net "github.com/v2ray/v2ray-core/net"
)
type VMessInboundConfig struct {
AllowedClients []core.VUser `json:"clients"`
}
func loadInboundConfig(rawConfig []byte) (VMessInboundConfig, error) {
config := VMessInboundConfig{}
err := json.Unmarshal(rawConfig, &config)
return config, err
}
type VNextConfig struct {
Address string `json:"address"`
Port uint16 `json:"port"`
Users []core.VUser `json:"users"`
}
func (config VNextConfig) ToVNextServer() VNextServer {
return VNextServer{
v2net.DomainAddress(config.Address, config.Port),
config.Users}
}
type VMessOutboundConfig struct {
VNextList []VNextConfig
}
func loadOutboundConfig(rawConfig []byte) (VMessOutboundConfig, error) {
config := VMessOutboundConfig{}
err := json.Unmarshal(rawConfig, &config)
return config, err
}