From 195594bed00995a7e5cd3b1a32ed06a60dd741e7 Mon Sep 17 00:00:00 2001 From: Darien Raymond Date: Fri, 13 Jan 2017 21:58:18 +0100 Subject: [PATCH] fix network list build --- tools/conf/common.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/conf/common.go b/tools/conf/common.go index d003142b..21ed2b8b 100644 --- a/tools/conf/common.go +++ b/tools/conf/common.go @@ -3,6 +3,7 @@ package conf import ( "encoding/json" "strings" + "v2ray.com/core/common/errors" "v2ray.com/core/common/log" v2net "v2ray.com/core/common/net" @@ -84,6 +85,12 @@ func (v *NetworkList) UnmarshalJSON(data []byte) error { } func (v *NetworkList) Build() *v2net.NetworkList { + if v == nil { + return &v2net.NetworkList{ + Network: []v2net.Network{v2net.Network_TCP}, + } + } + list := new(v2net.NetworkList) for _, network := range *v { list.Network = append(list.Network, network.Build())