Explorar o código

check number of shadowsocks servers

Darien Raymond %!s(int64=8) %!d(string=hai) anos
pai
achega
8bb2d02f78
Modificáronse 1 ficheiros con 3 adicións e 0 borrados
  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),
 	}