mirror of
https://github.com/SagerNet/sing-box.git
synced 2025-06-13 21:54:13 +08:00
Add support for the customization of the host domain in WebSocket (One of the V2Ray transport layers)
This commit is contained in:
parent
556c74ee15
commit
7044de8e4c
@ -92,6 +92,7 @@ Specifies the timeout duration after sending a PING frame, within which a respon
|
||||
```json
|
||||
{
|
||||
"type": "ws",
|
||||
"host": "",
|
||||
"path": "",
|
||||
"headers": {},
|
||||
"max_early_data": 0,
|
||||
@ -99,6 +100,10 @@ Specifies the timeout duration after sending a PING frame, within which a respon
|
||||
}
|
||||
```
|
||||
|
||||
#### host
|
||||
|
||||
Host domain.
|
||||
|
||||
#### path
|
||||
|
||||
Path of HTTP request.
|
||||
|
@ -91,6 +91,7 @@ HTTP 请求的额外标头
|
||||
```json
|
||||
{
|
||||
"type": "ws",
|
||||
"host": "",
|
||||
"path": "",
|
||||
"headers": {},
|
||||
"max_early_data": 0,
|
||||
@ -98,6 +99,10 @@ HTTP 请求的额外标头
|
||||
}
|
||||
```
|
||||
|
||||
#### host
|
||||
|
||||
主机域名。
|
||||
|
||||
#### path
|
||||
|
||||
HTTP 请求路径
|
||||
|
@ -75,6 +75,7 @@ type V2RayHTTPOptions struct {
|
||||
}
|
||||
|
||||
type V2RayWebsocketOptions struct {
|
||||
Host string `json:"host,omitempty"`
|
||||
Path string `json:"path,omitempty"`
|
||||
Headers HTTPHeader `json:"headers,omitempty"`
|
||||
MaxEarlyData uint32 `json:"max_early_data,omitempty"`
|
||||
|
@ -43,7 +43,11 @@ func NewClient(ctx context.Context, dialer N.Dialer, serverAddr M.Socksaddr, opt
|
||||
} else {
|
||||
requestURL.Scheme = "wss"
|
||||
}
|
||||
requestURL.Host = serverAddr.String()
|
||||
if options.Host == "" {
|
||||
requestURL.Host = serverAddr.String()
|
||||
} else {
|
||||
requestURL.Host = options.Host
|
||||
}
|
||||
requestURL.Path = options.Path
|
||||
err := sHTTP.URLSetPath(&requestURL, options.Path)
|
||||
if err != nil {
|
||||
|
Loading…
x
Reference in New Issue
Block a user