Chore: compatible with VMESS WS older version configurations
This commit is contained in:
parent
cd3b139c3f
commit
ac5c57ecef
1 changed files with 11 additions and 0 deletions
|
@ -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 a new issue