diff --git a/proxy/socks/client.go b/proxy/socks/client.go index 52a8a214b..6a18c09fd 100644 --- a/proxy/socks/client.go +++ b/proxy/socks/client.go @@ -27,11 +27,13 @@ func NewClient(ctx context.Context, config *ClientConfig) (*Client, error) { for _, rec := range config.Server { serverList.AddServer(protocol.NewServerSpecFromPB(*rec)) } - client := &Client{ - serverPicker: protocol.NewRoundRobinServerPicker(serverList), + if serverList.Size() == 0 { + return nil, newError("0 target server") } - return client, nil + return &Client{ + serverPicker: protocol.NewRoundRobinServerPicker(serverList), + }, nil } // Process implements proxy.Outbound.Process.