mirror of https://github.com/v2ray/v2ray-core
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
486 B
28 lines
486 B
// +build json
|
|
|
|
package net
|
|
|
|
import (
|
|
"encoding/json"
|
|
|
|
"v2ray.com/core/common/collect"
|
|
)
|
|
|
|
func (this *Network) UnmarshalJSON(data []byte) error {
|
|
var str string
|
|
if err := json.Unmarshal(data, &str); err != nil {
|
|
return err
|
|
}
|
|
*this = ParseNetwork(str)
|
|
return nil
|
|
}
|
|
|
|
func (this *NetworkList) UnmarshalJSON(data []byte) error {
|
|
var strlist collect.StringList
|
|
if err := json.Unmarshal(data, &strlist); err != nil {
|
|
return err
|
|
}
|
|
*this = *NewNetworkList(strlist)
|
|
return nil
|
|
}
|