mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2024-06-06 15:16:55 +00:00
fixed: invalid argument to Intn (#1133)
This commit is contained in:
parent
288899a473
commit
0b4662e4b7
|
@ -3,6 +3,7 @@ package vmess
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
@ -54,6 +55,10 @@ func (hc *httpConn) Write(b []byte) (int, error) {
|
||||||
return hc.Conn.Write(b)
|
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))]
|
path := hc.cfg.Path[fastrand.Intn(len(hc.cfg.Path))]
|
||||||
host := hc.cfg.Host
|
host := hc.cfg.Host
|
||||||
if header := hc.cfg.Headers["Host"]; len(header) != 0 {
|
if header := hc.cfg.Headers["Host"]; len(header) != 0 {
|
||||||
|
|
Loading…
Reference in a new issue