mirror of
https://github.com/m13253/dns-over-https.git
synced 2026-10-23 17:22:52 +00:00
Fix random selector (#41)
* Fix a bug: when only have one upstream, random selector will panic Signed-off-by: Sherlock Holo <sherlockya@gmail.com>
This commit is contained in:
1 parent
475894baaa
commit
17e5848178
2 files changed
+4
-4
No files matched your search
@@ -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() {}
|
||||
|
||||
Reference in new issue
Block a user