proxy

package
v1.833.381 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 16, 2026 License: Apache-2.0 Imports: 10 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultHttpClient *http.Client
	ProxyHttpClient   *http.Client
)
View Source
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

func GetHttpClient(url string) *http.Client

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

func Local(url string) *http.Client

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL