common

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultALookup is the lookup resolver for DNS A records.
	// You can override it for caching or testing.
	DefaultALookup = net.LookupHost
)

Functions

func AdhocResolveHost

func AdhocResolveHost(hostStr string, replace *pb.Adhoc_Replace) (string, error)

func ExtractHostPort

func ExtractHostPort(hostStr string) (hostName string, port int, err error)

func HostMatches

func HostMatches(host string, matcher string) bool

func NewDynamic

func NewDynamic(add Addresser) *dynamic

NewDynamic creates a new dynamic router that can be have its routes updated.

func PortAllowed

func PortAllowed(port int, portRule *pb.Adhoc_Port) bool

Types

type Addresser

type Addresser interface {
	// Address decides the ip:port to send the request to, if any. Errors may be returned if permission is denied.
	// The returned string must contain contain both ip and port separated by colon.
	Address(hostString string) (string, error)
}

Addresser implements logic that decides what "ad-hoc" ip:port to dial for a backend, if any.

Adhoc rules are a way of forwarding requests to services that fall outside of pre-defined Routes and Backends.

Jump to

Keyboard shortcuts

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