v2ray-core/common/net/network_json.go

19 lines
321 B
Go
Raw Normal View History

2016-01-15 13:34:33 +00:00
// +build json
package net
import (
2016-01-15 14:23:12 +00:00
"encoding/json"
"github.com/v2ray/v2ray-core/common/serial"
2016-01-15 13:34:33 +00:00
)
func (this *NetworkList) UnmarshalJSON(data []byte) error {
2016-01-15 14:23:12 +00:00
var strlist serial.StringLiteralList
if err := json.Unmarshal(data, &strlist); err != nil {
2016-01-15 13:34:33 +00:00
return err
}
*this = NewNetworkList(strlist)
return nil
}