transport

package
v0.17.2 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: AGPL-3.0 Imports: 15 Imported by: 0 modules, 0 packages

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

Overview

Package transport is what every outbound HTTPS and TLS client of komando shares, so the environment never decides where a login goes:

  • Certificates are checked against the system's CAs. SSL_CERT_FILE and SSL_CERT_DIR are ignored on every system (roots.go): with its own CA there and its proxy in HTTPS_PROXY, an AI agent would read a stored VPN password, a cluster token or a registry login.
  • The company proxy (HTTPS_PROXY, HTTP_PROXY, NO_PROXY) is used, as curl, kubectl and docker do, when a person runs komando. When an AI agent runs it, the environment is the agent's, and no proxy is taken from it (DistrustEnv). A proxy written in a config file the person keeps (a kubeconfig's proxy-url) still counts.
  • HTTP builds the clients' http.Transport, and Dial opens raw TCP tunnels through the proxy for the connections http.Transport does not make itself (stream upgrades, SSL VPN tunnels).

A connection that goes through a --via path never uses these proxies: the path is its way out.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dial

func Dial(ctx context.Context, pick Func, dial Dialer, target *url.URL, addr string) (net.Conn, error)

Dial opens a TCP connection to addr (the host:port of target) through the proxy that pick chooses for target, or straight with dial when pick is nil or chooses none. dial also reaches the proxy.

func DistrustEnv

func DistrustEnv() (undo func())

DistrustEnv says the environment of this process is an AI agent's: no proxy, and no CA a client library would read from it (AWS_CA_BUNDLE, VAULT_CACERT), is taken from it. The komando program calls it for an agent; an app's calls never reach its process environment. undo is for tests.

func EnvDistrusted

func EnvDistrusted() bool

EnvDistrusted reports whether the environment is an AI agent's.

func HTTP

func HTTP() *http.Transport

HTTP is a new http.Transport for a client of komando, with the timeouts of Go's default one and TLS 1.2 or later. It has no proxy: a client that connects straight (no --via path) sets Proxy to Proxy(), or to the proxy a person's config file names.

func Parse

func Parse(raw string) (*url.URL, error)

Parse checks a proxy URL written in a config file, such as a kubeconfig's proxy-url.

func Roots

func Roots() *x509.CertPool

Roots is a copy of the system's CAs, for a client that adds its own CA to them (a conn's ?ca=).

Types

type Dialer

type Dialer = func(ctx context.Context, network, addr string) (net.Conn, error)

Dialer opens TCP connections.

type Func

type Func = func(*http.Request) (*url.URL, error)

Func picks the proxy for a request; a nil URL means none.

func Proxy

func Proxy() Func

Proxy picks the company proxy that HTTPS_PROXY, HTTP_PROXY and NO_PROXY (or their lower-case names) name, read when a request is made, or none when the environment is an AI agent's. Requests to this computer (localhost, 127.0.0.1, a tunnel's port) never use a proxy.

Directories

Path Synopsis
Package proxytest is a small HTTP CONNECT proxy for tests.
Package proxytest is a small HTTP CONNECT proxy for tests.

Jump to

Keyboard shortcuts

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