1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-11-19 10:56:06 -05:00
v2fly/io/jsonvconfigmarshaller.go

36 lines
660 B
Go
Raw Normal View History

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