瀏覽代碼

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.
Xiang Li 10 年之前
父節點
當前提交
c73e8fd946
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      proxy/httpproxy/director.go

+ 4 - 0
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,