mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2024-11-16 19:56:51 +08:00
Chore: compatible with VMESS WS older version configurations
This commit is contained in:
parent
cd3b139c3f
commit
ac5c57ecef
|
@ -47,6 +47,10 @@ type VmessOption struct {
|
|||
HTTP2Opts HTTP2Options `proxy:"h2-opts,omitempty"`
|
||||
GrpcOpts GrpcOptions `proxy:"grpc-opts,omitempty"`
|
||||
WSOpts WSOptions `proxy:"ws-opts,omitempty"`
|
||||
|
||||
// TODO: compatible with VMESS WS older version configurations
|
||||
WSHeaders map[string]string `proxy:"ws-headers,omitempty"`
|
||||
WSPath string `proxy:"ws-path,omitempty"`
|
||||
}
|
||||
|
||||
type HTTPOptions struct {
|
||||
|
@ -76,6 +80,13 @@ func (v *Vmess) StreamConn(c net.Conn, metadata *C.Metadata) (net.Conn, error) {
|
|||
var err error
|
||||
switch v.option.Network {
|
||||
case "ws":
|
||||
if v.option.WSOpts.Path == "" {
|
||||
v.option.WSOpts.Path = v.option.WSPath
|
||||
}
|
||||
if len(v.option.WSOpts.Headers) == 0 {
|
||||
v.option.WSOpts.Headers = v.option.WSHeaders
|
||||
}
|
||||
|
||||
host, port, _ := net.SplitHostPort(v.addr)
|
||||
wsOpts := &vmess.WebsocketConfig{
|
||||
Host: host,
|
||||
|
|
Loading…
Reference in New Issue
Block a user