mirror of
https://github.com/tailscale/tailscale.git
synced 2025-12-23 09:06:24 +00:00
feature, net/tshttpproxy: pull out support for using proxies as a feature
Saves 139 KB. Also Synology support, which I saw had its own large-ish proxy parsing support on Linux, but support for proxies without Synology proxy support is reasonable, so I pulled that out as its own thing. Updates #12614 Change-Id: I22de285a3def7be77fdcf23e2bec7c83c9655593 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
committed by
Brad Fitzpatrick
parent
9b997c8f2f
commit
442a3a779d
@@ -3,6 +3,11 @@
|
||||
|
||||
package feature
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
// HookCanAutoUpdate is a hook for the clientupdate package
|
||||
// to conditionally initialize.
|
||||
var HookCanAutoUpdate Hook[func() bool]
|
||||
@@ -15,3 +20,23 @@ func CanAutoUpdate() bool {
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// HookProxyFromEnvironment is a hook for feature/useproxy to register
|
||||
// a function to use as http.ProxyFromEnvironment.
|
||||
var HookProxyFromEnvironment Hook[func(*http.Request) (*url.URL, error)]
|
||||
|
||||
// HookProxyInvalidateCache is a hook for feature/useproxy to register
|
||||
// [tshttpproxy.InvalidateCache].
|
||||
var HookProxyInvalidateCache Hook[func()]
|
||||
|
||||
// HookProxyGetAuthHeader is a hook for feature/useproxy to register
|
||||
// [tshttpproxy.GetAuthHeader].
|
||||
var HookProxyGetAuthHeader Hook[func(*url.URL) (string, error)]
|
||||
|
||||
// HookProxySetSelfProxy is a hook for feature/useproxy to register
|
||||
// [tshttpproxy.SetSelfProxy].
|
||||
var HookProxySetSelfProxy Hook[func(...string)]
|
||||
|
||||
// HookProxySetTransportGetProxyConnectHeader is a hook for feature/useproxy to register
|
||||
// [tshttpproxy.SetTransportGetProxyConnectHeader].
|
||||
var HookProxySetTransportGetProxyConnectHeader Hook[func(*http.Transport)]
|
||||
|
||||
Reference in New Issue
Block a user