Chore: code style
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/Dreamacro/clash/common/convert"
|
||||
"github.com/Dreamacro/clash/component/dialer"
|
||||
"github.com/Dreamacro/clash/component/resolver"
|
||||
C "github.com/Dreamacro/clash/constant"
|
||||
@@ -115,6 +116,9 @@ func (v *Vmess) StreamConn(c net.Conn, metadata *C.Metadata) (net.Conn, error) {
|
||||
} else if host := wsOpts.Headers.Get("Host"); host != "" {
|
||||
wsOpts.TLSConfig.ServerName = host
|
||||
}
|
||||
} else {
|
||||
wsOpts.Headers.Set("Host", convert.RandHost())
|
||||
convert.SetUserAgent(wsOpts.Headers)
|
||||
}
|
||||
c, err = vmess.StreamWebsocketConn(c, wsOpts)
|
||||
case "http":
|
||||
@@ -134,6 +138,9 @@ func (v *Vmess) StreamConn(c net.Conn, metadata *C.Metadata) (net.Conn, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
} else {
|
||||
http.Header(v.option.HTTPOpts.Headers).Set("Host", convert.RandHost())
|
||||
convert.SetUserAgent(v.option.HTTPOpts.Headers)
|
||||
}
|
||||
|
||||
host, _, _ := net.SplitHostPort(v.addr)
|
||||
|
||||
@@ -308,7 +308,7 @@ func proxiesParseAndFilter(filter string, filterReg *regexp.Regexp, forceCertVer
|
||||
if err := yaml.Unmarshal(buf, schema); err != nil {
|
||||
proxies, err1 := convert.ConvertsV2Ray(buf)
|
||||
if err1 != nil {
|
||||
return nil, fmt.Errorf("%s, %w", err.Error(), err1)
|
||||
return nil, fmt.Errorf("%w, %s", err, err1.Error())
|
||||
}
|
||||
schema.Proxies = proxies
|
||||
}
|
||||
|
||||
@@ -72,9 +72,7 @@ func (h *HTTPVehicle) Read() ([]byte, error) {
|
||||
req.SetBasicAuth(user.Username(), password)
|
||||
}
|
||||
|
||||
if req.UserAgent() == "" {
|
||||
convert.SetUserAgent(req)
|
||||
}
|
||||
convert.SetUserAgent(req.Header)
|
||||
|
||||
req = req.WithContext(ctx)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user