Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( DefaultHttpClient *http.Client ProxyHttpClient *http.Client )
var Public = outbound.Client(outbound.Options{ Timeout: 60 * time.Second, Redirects: 5, Limit: 64 << 20, })
Public is the client for a URL chosen by whoever wrote the request — a document a person named, an image in a message, a page to crawl. This process runs inside the cluster, where in-namespace service names resolve and 169.254.169.254 hands out credentials to anyone who asks, so an unrestricted GET on such a URL is a credential read, not a fetch.
It is hanzoai/outbound's client, the one rule every Hanzo service reaches a tenant's address by: judged at the dial, on the address the socket connects to (so a name that answers public once and private the next time is refused on the answer that would have been used), every redirect a new dial judged the same way, no proxy, and the IANA special-purpose registries rather than net.IP's predicates. A refusal is outbound.ErrRefused.
A test that must reach a loopback server swaps this variable; outbound has no switch that turns the rule off.
Functions ¶
func GetHttpClient ¶
GetHttpClient answers the client a URL should be fetched with, and always answers one.
The two package clients are filled by InitHttpClient at boot, so anything running before that line got nil and dereferenced it — a panic rather than a request. Three tests already worked around it by calling InitHttpClient themselves, which is the ordering problem stated out loud.
The fallback is http.DefaultClient, which is what the non-proxy path resolves to anyway; a deployment that configured a proxy still gets it, because by then InitHttpClient has run.
func InitHttpClient ¶
func InitHttpClient()
func Local ¶ added in v1.833.53
Local returns the client to use for a base URL, or nil to take the verifying default. A non-nil result accepts any certificate and is returned ONLY for this machine, where a model server's certificate is self-signed because nobody issues one for 127.0.0.1. Anything that does not clearly name this machine — a look-alike host, an unparseable URL — is remote and verifies.
Types ¶
This section is empty.