proxies

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2025 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Protocol

type Protocol int
const (
	HTTP Protocol = iota
	TCP
)

func (Protocol) String

func (p Protocol) String() string

type Proxy

type Proxy struct {
	Protocol Protocol // Protocol is either HTTP or TCP
	Hostname string
	Port     uint16
}

Proxy represents either a L4 (TCP/UDP), or an L7 (HTTP) proxy for a particular hostname:port.

func ParseProxySpec

func ParseProxySpec(spec string) (Proxy, error)

ParseProxySpec takes a string representing a Proxy spec, and returns a Proxy or an error if the spec is invalid. A proxy spec is a string of the form "hostname:port/protocol", where:

- hostname is a DNS hostname or an IP address - port is a port number - protocol is either "http", "https" or "tcp"

type TargetConfig

type TargetConfig struct {
	NetworkName string
	Links       []string
	Env         []string
	DNS         string
}

TargetConfig represents the config that should be set on a target container to get all its traffic proxied through L4/L7 proxies.

func RunNetworkProxies

func RunNetworkProxies(ctx context.Context, cli docker.Client, proxies []Proxy, keepCtrs, debugDNS bool) (_ TargetConfig, _ func(context.Context) error, retErr error)

RunNetworkProxies starts a set of Proxy and returns a TargetConfig that should be applied to a target container to get all its traffic proxied, a cleanup function to remove the network and proxies, and an error if any.

Jump to

Keyboard shortcuts

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