chain

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2024 License: MIT Imports: 13 Imported by: 150

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BindOption

type BindOption func(opts *BindOptions)

func BacklogBindOption

func BacklogBindOption(backlog int) BindOption

func LoggerBindOption

func LoggerBindOption(logger logger.Logger) BindOption

func MuxBindOption

func MuxBindOption(mux bool) BindOption

func UDPConnTTLBindOption

func UDPConnTTLBindOption(ttl time.Duration) BindOption

func UDPDataBufferSizeBindOption

func UDPDataBufferSizeBindOption(size int) BindOption

func UDPDataQueueSizeBindOption

func UDPDataQueueSizeBindOption(size int) BindOption

type BindOptions

type BindOptions struct {
	Mux               bool
	Backlog           int
	UDPDataQueueSize  int
	UDPDataBufferSize int
	UDPConnTTL        time.Duration
	Logger            logger.Logger
}

type Chainer

type Chainer interface {
	Route(ctx context.Context, network, address string, opts ...RouteOption) Route
}

type DialOption

type DialOption func(opts *DialOptions)

func InterfaceDialOption

func InterfaceDialOption(ifName string) DialOption

func LoggerDialOption

func LoggerDialOption(logger logger.Logger) DialOption

func NetnsDialOption

func NetnsDialOption(netns string) DialOption

func SockOptsDialOption

func SockOptsDialOption(so *SockOpts) DialOption

type DialOptions

type DialOptions struct {
	Interface string
	Netns     string
	SockOpts  *SockOpts
	Logger    logger.Logger
}

type HTTPBodyRewriteSettings added in v0.1.1

type HTTPBodyRewriteSettings struct {
	Type        string
	Pattern     *regexp.Regexp
	Replacement []byte
}

type HTTPNodeSettings

type HTTPNodeSettings struct {
	Host        string
	Header      map[string]string
	Auther      auth.Authenticator
	RewriteURL  []HTTPURLRewriteSetting
	RewriteBody []HTTPBodyRewriteSettings
}

type HTTPURLRewriteSetting

type HTTPURLRewriteSetting struct {
	Pattern     *regexp.Regexp
	Replacement string
}

type Node

type Node struct {
	Name string
	Addr string
	// contains filtered or unexported fields
}

func NewNode

func NewNode(name string, addr string, opts ...NodeOption) *Node

func (*Node) Copy

func (node *Node) Copy() *Node

func (*Node) Marker

func (node *Node) Marker() selector.Marker

Marker implements selector.Markable interface.

func (*Node) Metadata

func (node *Node) Metadata() metadata.Metadata

Metadata implements metadadta.Metadatable interface.

func (*Node) Options

func (node *Node) Options() *NodeOptions

type NodeFilterSettings

type NodeFilterSettings struct {
	Protocol string
	Host     string
	Path     string
}

type NodeOption

type NodeOption func(*NodeOptions)

func BypassNodeOption

func BypassNodeOption(bp bypass.Bypass) NodeOption

func HTTPNodeOption

func HTTPNodeOption(httpSettings *HTTPNodeSettings) NodeOption

func HostMapperNodeOption

func HostMapperNodeOption(m hosts.HostMapper) NodeOption

func MetadataNodeOption

func MetadataNodeOption(md metadata.Metadata) NodeOption

func NetworkNodeOption

func NetworkNodeOption(network string) NodeOption

func NodeFilterOption

func NodeFilterOption(filter *NodeFilterSettings) NodeOption

func ResoloverNodeOption

func ResoloverNodeOption(resolver resolver.Resolver) NodeOption

func TLSNodeOption

func TLSNodeOption(tlsSettings *TLSNodeSettings) NodeOption

func TransportNodeOption

func TransportNodeOption(tr Transporter) NodeOption

type NodeOptions

type NodeOptions struct {
	Network    string
	Transport  Transporter
	Bypass     bypass.Bypass
	Resolver   resolver.Resolver
	HostMapper hosts.HostMapper
	Filter     *NodeFilterSettings
	HTTP       *HTTPNodeSettings
	TLS        *TLSNodeSettings
	Metadata   metadata.Metadata
}

type Route

type Route interface {
	Dial(ctx context.Context, network, address string, opts ...DialOption) (net.Conn, error)
	Bind(ctx context.Context, network, address string, opts ...BindOption) (net.Listener, error)
	Nodes() []*Node
}

type RouteOption

type RouteOption func(opts *RouteOptions)

func WithHostRouteOption

func WithHostRouteOption(host string) RouteOption

type RouteOptions

type RouteOptions struct {
	Host string
}

type Router

type Router interface {
	Options() *RouterOptions
	Dial(ctx context.Context, network, address string) (net.Conn, error)
	Bind(ctx context.Context, network, address string, opts ...BindOption) (net.Listener, error)
}

type RouterOption

type RouterOption func(*RouterOptions)

func ChainRouterOption

func ChainRouterOption(chain Chainer) RouterOption

func HostMapperRouterOption

func HostMapperRouterOption(m hosts.HostMapper) RouterOption

func InterfaceRouterOption

func InterfaceRouterOption(ifceName string) RouterOption

func LoggerRouterOption

func LoggerRouterOption(logger logger.Logger) RouterOption

func NetnsRouterOption

func NetnsRouterOption(netns string) RouterOption

func RecordersRouterOption

func RecordersRouterOption(recorders ...recorder.RecorderObject) RouterOption

func ResolverRouterOption

func ResolverRouterOption(resolver resolver.Resolver) RouterOption

func RetriesRouterOption

func RetriesRouterOption(retries int) RouterOption

func SockOptsRouterOption

func SockOptsRouterOption(so *SockOpts) RouterOption

func TimeoutRouterOption

func TimeoutRouterOption(timeout time.Duration) RouterOption

type RouterOptions

type RouterOptions struct {
	Retries    int
	Timeout    time.Duration
	IfceName   string
	Netns      string
	SockOpts   *SockOpts
	Chain      Chainer
	Resolver   resolver.Resolver
	HostMapper hosts.HostMapper
	Recorders  []recorder.RecorderObject
	Logger     logger.Logger
}

type SockOpts

type SockOpts struct {
	Mark int
}

type TLSNodeSettings

type TLSNodeSettings struct {
	ServerName string
	Secure     bool
	Options    struct {
		MinVersion   string
		MaxVersion   string
		CipherSuites []string
	}
}

type TransportOption

type TransportOption func(*TransportOptions)

func AddrTransportOption

func AddrTransportOption(addr string) TransportOption

func InterfaceTransportOption

func InterfaceTransportOption(ifceName string) TransportOption

func NetnsTransportOption

func NetnsTransportOption(netns string) TransportOption

func RouteTransportOption

func RouteTransportOption(route Route) TransportOption

func SockOptsTransportOption

func SockOptsTransportOption(so *SockOpts) TransportOption

type TransportOptions

type TransportOptions struct {
	Addr     string
	IfceName string
	Netns    string
	SockOpts *SockOpts
	Route    Route
}

type Transporter

type Transporter interface {
	Dial(ctx context.Context, addr string) (net.Conn, error)
	Handshake(ctx context.Context, conn net.Conn) (net.Conn, error)
	Connect(ctx context.Context, conn net.Conn, network, address string) (net.Conn, error)
	Bind(ctx context.Context, conn net.Conn, network, address string, opts ...connector.BindOption) (net.Listener, error)
	Multiplex() bool
	Options() *TransportOptions
	Copy() Transporter
}

Jump to

Keyboard shortcuts

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