mirror of
https://github.com/SagerNet/sing-box.git
synced 2025-06-13 21:54:13 +08:00
rename
This commit is contained in:
parent
aa3255f763
commit
1329edf42e
@ -31,5 +31,5 @@ type HTTPOutboundOptions struct {
|
|||||||
Password string `json:"password,omitempty"`
|
Password string `json:"password,omitempty"`
|
||||||
TLS *OutboundTLSOptions `json:"tls,omitempty"`
|
TLS *OutboundTLSOptions `json:"tls,omitempty"`
|
||||||
Path string `json:"path,omitempty"`
|
Path string `json:"path,omitempty"`
|
||||||
Headers OutboundHeader `json:"headers,omitempty"`
|
Headers HTTPHeader `json:"headers,omitempty"`
|
||||||
}
|
}
|
||||||
|
@ -236,12 +236,14 @@ func DNSQueryTypeToString(queryType uint16) string {
|
|||||||
return F.ToString(queryType)
|
return F.ToString(queryType)
|
||||||
}
|
}
|
||||||
|
|
||||||
type OutboundHeader map[string]Listable[string]
|
type HTTPHeader map[string]Listable[string]
|
||||||
|
|
||||||
func (h OutboundHeader) HTTPHeader() http.Header {
|
func (h HTTPHeader) Build() http.Header {
|
||||||
header := make(http.Header)
|
header := make(http.Header)
|
||||||
for name, values := range h {
|
for name, values := range h {
|
||||||
header[http.CanonicalHeaderKey(name)] = values
|
for _, value := range values {
|
||||||
|
header.Add(name, value)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return header
|
return header
|
||||||
}
|
}
|
||||||
|
@ -64,16 +64,16 @@ type V2RayHTTPOptions struct {
|
|||||||
Host Listable[string] `json:"host,omitempty"`
|
Host Listable[string] `json:"host,omitempty"`
|
||||||
Path string `json:"path,omitempty"`
|
Path string `json:"path,omitempty"`
|
||||||
Method string `json:"method,omitempty"`
|
Method string `json:"method,omitempty"`
|
||||||
Headers OutboundHeader `json:"headers,omitempty"`
|
Headers HTTPHeader `json:"headers,omitempty"`
|
||||||
IdleTimeout Duration `json:"idle_timeout,omitempty"`
|
IdleTimeout Duration `json:"idle_timeout,omitempty"`
|
||||||
PingTimeout Duration `json:"ping_timeout,omitempty"`
|
PingTimeout Duration `json:"ping_timeout,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type V2RayWebsocketOptions struct {
|
type V2RayWebsocketOptions struct {
|
||||||
Path string `json:"path,omitempty"`
|
Path string `json:"path,omitempty"`
|
||||||
Headers OutboundHeader `json:"headers,omitempty"`
|
Headers HTTPHeader `json:"headers,omitempty"`
|
||||||
MaxEarlyData uint32 `json:"max_early_data,omitempty"`
|
MaxEarlyData uint32 `json:"max_early_data,omitempty"`
|
||||||
EarlyDataHeaderName string `json:"early_data_header_name,omitempty"`
|
EarlyDataHeaderName string `json:"early_data_header_name,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type V2RayQUICOptions struct{}
|
type V2RayQUICOptions struct{}
|
||||||
|
@ -48,7 +48,7 @@ func NewHTTP(ctx context.Context, router adapter.Router, logger log.ContextLogge
|
|||||||
Username: options.Username,
|
Username: options.Username,
|
||||||
Password: options.Password,
|
Password: options.Password,
|
||||||
Path: options.Path,
|
Path: options.Path,
|
||||||
Headers: options.Headers.HTTPHeader(),
|
Headers: options.Headers.Build(),
|
||||||
}),
|
}),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ func NewClient(ctx context.Context, dialer N.Dialer, serverAddr M.Socksaddr, opt
|
|||||||
serverAddr: serverAddr,
|
serverAddr: serverAddr,
|
||||||
host: options.Host,
|
host: options.Host,
|
||||||
method: options.Method,
|
method: options.Method,
|
||||||
headers: options.Headers.HTTPHeader(),
|
headers: options.Headers.Build(),
|
||||||
transport: transport,
|
transport: transport,
|
||||||
http2: tlsConfig != nil,
|
http2: tlsConfig != nil,
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ func NewServer(ctx context.Context, options option.V2RayHTTPOptions, tlsConfig t
|
|||||||
host: options.Host,
|
host: options.Host,
|
||||||
path: options.Path,
|
path: options.Path,
|
||||||
method: options.Method,
|
method: options.Method,
|
||||||
headers: options.Headers.HTTPHeader(),
|
headers: options.Headers.Build(),
|
||||||
}
|
}
|
||||||
if server.method == "" {
|
if server.method == "" {
|
||||||
server.method = "PUT"
|
server.method = "PUT"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user