routing

package
v0.0.0-...-c8b0a90 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2023 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DirectTarget = Target{
	Name: "direct",
	Dialer: &net.Dialer{

		DualStack: true,
	},
}

Functions

This section is empty.

Types

type AddressDetails

type AddressDetails struct {
	Address string // for dial functions: [...]:...
	FQDN    string // only the domain name, if available
	IP      net.IP
	Zone    string // ipv6 zone [...%zone]:...
	Port    string
}

func ParseAddress

func ParseAddress(addr string) (*AddressDetails, error)

type Dialer

type Dialer interface {
	// Dial connects to the given address via the proxy.
	Dial(network, addr string) (c net.Conn, err error)
}

type Map

type Map struct {
	Routes []Route
}

first match wins

func ReadMap

func ReadMap(r io.Reader) (*Map, error)

func ReadMapFile

func ReadMapFile(filename string) (*Map, error)

func (Map) Dial

func (m Map) Dial(network, address string) (c net.Conn, err error)

func (Map) Match

func (m Map) Match(network string, address AddressDetails) *Target

func (Map) MatchCommand

func (m Map) MatchCommand(network string, address AddressDetails) string

type Route

type Route interface {
	// could theoretically create dynamic targets for each match
	Match(network string, address AddressDetails) *Target
	Command() string
}

func ParseRoute

func ParseRoute(line string) (Route, error)

type Target

type Target struct {
	Name   string
	Dialer Dialer
}

func ParseTarget

func ParseTarget(name string) (*Target, error)

Jump to

Keyboard shortcuts

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