fix network list build

pull/362/head
Darien Raymond 8 years ago
parent 0a91893a26
commit 195594bed0
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

@ -3,6 +3,7 @@ package conf
import ( import (
"encoding/json" "encoding/json"
"strings" "strings"
"v2ray.com/core/common/errors" "v2ray.com/core/common/errors"
"v2ray.com/core/common/log" "v2ray.com/core/common/log"
v2net "v2ray.com/core/common/net" v2net "v2ray.com/core/common/net"
@ -84,6 +85,12 @@ func (v *NetworkList) UnmarshalJSON(data []byte) error {
} }
func (v *NetworkList) Build() *v2net.NetworkList { func (v *NetworkList) Build() *v2net.NetworkList {
if v == nil {
return &v2net.NetworkList{
Network: []v2net.Network{v2net.Network_TCP},
}
}
list := new(v2net.NetworkList) list := new(v2net.NetworkList)
for _, network := range *v { for _, network := range *v {
list.Network = append(list.Network, network.Build()) list.Network = append(list.Network, network.Build())

Loading…
Cancel
Save