diff --git a/doh-client/client.go b/doh-client/client.go index 9c1e4a7..d768f10 100644 --- a/doh-client/client.go +++ b/doh-client/client.go @@ -155,7 +155,7 @@ func NewClient(conf *config.Config) (c *Client, err error) { switch c.conf.Upstream.UpstreamSelector { case config.NginxWRR: if c.conf.Other.Verbose { - log.Println(config.NginxWRR, " mode start") + log.Println(config.NginxWRR, "mode start") } s := selector.NewNginxWRRSelector(time.Duration(c.conf.Other.Timeout) * time.Second) @@ -175,7 +175,7 @@ func NewClient(conf *config.Config) (c *Client, err error) { case config.LVSWRR: if c.conf.Other.Verbose { - log.Println(config.LVSWRR, " mode start") + log.Println(config.LVSWRR, "mode start") } s := selector.NewLVSWRRSelector(time.Duration(c.conf.Other.Timeout) * time.Second) @@ -195,7 +195,7 @@ func NewClient(conf *config.Config) (c *Client, err error) { default: if c.conf.Other.Verbose { - log.Println(config.Random, " mode start") + log.Println(config.Random, "mode start") } // if selector is invalid or random, use random selector, or should we stop program and let user knows he is wrong? diff --git a/doh-client/selector/randomSelector.go b/doh-client/selector/randomSelector.go index 9509845..cd2880c 100644 --- a/doh-client/selector/randomSelector.go +++ b/doh-client/selector/randomSelector.go @@ -42,7 +42,7 @@ func (rs *RandomSelector) Add(url string, upstreamType UpstreamType) (err error) } func (rs *RandomSelector) Get() *Upstream { - return rs.upstreams[rand.Intn(len(rs.upstreams)-1)] + return rs.upstreams[rand.Intn(len(rs.upstreams))] } func (rs *RandomSelector) StartEvaluate() {}