1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-21 17:46:58 -05:00
v2fly/io/jsonvconfigmarshaller.go
2015-09-06 22:10:42 +02:00

38 lines
727 B
Go

package io
import (
"encoding/json"
_ "fmt"
"github.com/v2ray/v2ray-core"
)
type JsonVUser struct {
id string `json:"id"`
email string `json:"email"`
}
type JsonVConfig struct {
RunAs string `json:"runas"`
Port uint8 `json:"port"`
Clients []JsonVUser `json:"users"`
Protocol string `json:"protocol"`
}
type JsonVConfigUnmarshaller struct {
}
func StringToVUser(id string) (u core.VUser, err error) {
return
}
func (*JsonVConfigUnmarshaller) Unmarshall(data []byte) (*core.VConfig, error) {
var jsonConfig JsonVConfig
err := json.Unmarshal(data, &jsonConfig)
if err != nil {
return nil, err
}
var vconfig = new(core.VConfig)
vconfig.RunAs = core.VUser{}
return vconfig, nil
}