Browse Source

check number of shadowsocks servers

Darien Raymond 8 năm trước cách đây
mục cha
commit
8bb2d02f78
1 tập tin đã thay đổi với 3 bổ sung0 xóa
  1. 3 0
      proxy/shadowsocks/client.go

+ 3 - 0
proxy/shadowsocks/client.go

@@ -28,6 +28,9 @@ func NewClient(ctx context.Context, config *ClientConfig) (*Client, error) {
 	for _, rec := range config.Server {
 		serverList.AddServer(protocol.NewServerSpecFromPB(*rec))
 	}
+	if serverList.Size() == 0 {
+		return nil, newError("0 server")
+	}
 	client := &Client{
 		serverPicker: protocol.NewRoundRobinServerPicker(serverList),
 	}