From c73e8fd9465950b8b2de52ccadac8df18dc02fcc Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Fri, 27 May 2016 10:28:00 -0700 Subject: [PATCH] httpproxy: init the rand that we use to randomize endpoints This is actually does not change anything. The endpoints are already randomized before feeding into proxy. But it makes the proxy more safe. --- proxy/httpproxy/director.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/proxy/httpproxy/director.go b/proxy/httpproxy/director.go index 2495d4878..d41450133 100644 --- a/proxy/httpproxy/director.go +++ b/proxy/httpproxy/director.go @@ -27,6 +27,10 @@ const defaultRefreshInterval = 30000 * time.Millisecond var once sync.Once +func init() { + rand.Seed(time.Now().UnixNano()) +} + func newDirector(urlsFunc GetProxyURLs, failureWait time.Duration, refreshInterval time.Duration) *director { d := &director{ uf: urlsFunc,