fixed: invalid argument to Intn (#1133)

This commit is contained in:
落心 2024-03-26 14:19:33 +08:00 committed by GitHub
parent 288899a473
commit 0b4662e4b7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3,6 +3,7 @@ package vmess
import (
"bufio"
"bytes"
"errors"
"fmt"
"net"
"net/http"
@ -54,6 +55,10 @@ func (hc *httpConn) Write(b []byte) (int, error) {
return hc.Conn.Write(b)
}
if len(hc.cfg.Path) == 0 {
return -1, errors.New("path is empty")
}
path := hc.cfg.Path[fastrand.Intn(len(hc.cfg.Path))]
host := hc.cfg.Host
if header := hc.cfg.Headers["Host"]; len(header) != 0 {