chore: use fastrand to replace math/rand

This commit is contained in:
wwqgtxx
2023-03-06 18:10:14 +08:00
parent ad6336231c
commit 6a97ab9ecb
26 changed files with 109 additions and 111 deletions

View File

@ -2,11 +2,11 @@ package vmess
import (
"io"
"math/rand"
"net"
"net/http"
"net/url"
"github.com/zhangyunhao116/fastrand"
"golang.org/x/net/http2"
)
@ -26,7 +26,7 @@ type H2Config struct {
func (hc *h2Conn) establishConn() error {
preader, pwriter := io.Pipe()
host := hc.cfg.Hosts[rand.Intn(len(hc.cfg.Hosts))]
host := hc.cfg.Hosts[fastrand.Intn(len(hc.cfg.Hosts))]
path := hc.cfg.Path
// TODO: connect use VMess Host instead of H2 Host
req := http.Request{