mirror of
https://github.com/shtorm-7/sing-box-extended.git
synced 2026-07-19 05:54:15 +03:00
Add new admin panel, failover, dns fallback, providers, limiters. Update XHTTP
This commit is contained in:
@@ -145,6 +145,17 @@ func ApplyPaddingToCookie(req *http.Request, name, value string) {
|
||||
})
|
||||
}
|
||||
|
||||
func ApplyPaddingToResponseCookie(writer http.ResponseWriter, name, value string) {
|
||||
if name == "" || value == "" {
|
||||
return
|
||||
}
|
||||
http.SetCookie(writer, &http.Cookie{
|
||||
Name: name,
|
||||
Value: value,
|
||||
Path: "/",
|
||||
})
|
||||
}
|
||||
|
||||
func ApplyPaddingToQuery(u *url.URL, key, value string) {
|
||||
if u == nil || key == "" || value == "" {
|
||||
return
|
||||
@@ -193,6 +204,19 @@ func ApplyXPaddingToRequest(req *http.Request, config XPaddingConfig) {
|
||||
}
|
||||
}
|
||||
|
||||
func ApplyXPaddingToResponse(writer http.ResponseWriter, config XPaddingConfig) {
|
||||
placement := config.Placement.Placement
|
||||
if placement == option.PlacementHeader || placement == option.PlacementQueryInHeader {
|
||||
ApplyXPaddingToHeader(writer.Header(), config)
|
||||
return
|
||||
}
|
||||
paddingValue := GeneratePadding(config.Method, config.Length)
|
||||
switch placement {
|
||||
case option.PlacementCookie:
|
||||
ApplyPaddingToResponseCookie(writer, config.Placement.Key, paddingValue)
|
||||
}
|
||||
}
|
||||
|
||||
func ExtractXPaddingFromRequest(options *option.V2RayXHTTPBaseOptions, req *http.Request, obfsMode bool) (string, string) {
|
||||
if req == nil {
|
||||
return "", ""
|
||||
|
||||
Reference in New Issue
Block a user