1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-06-13 11:20:42 +00:00

check number of socks servers

This commit is contained in:
Darien Raymond 2017-04-11 10:35:14 +02:00
parent 056084defd
commit ac8d882a55
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

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