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-07 17:12:31 +02:00

36 lines
660 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 {
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)
return vconfig, nil
}