forwarder

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CmdExecutor

type CmdExecutor interface {
	CombinedOutput(cmdName string, args []string, stdin io.Reader) ([]byte, error)
}

type Factory

type Factory struct {
	// contains filtered or unexported fields
}

func NewFactory

func NewFactory(processGroupID int, logger Logger) Factory

func (Factory) NewForwarder

func (f Factory) NewForwarder(opts ForwarderOpts) (Forwarder, error)

func (Factory) NewOriginalDstResolver

func (f Factory) NewOriginalDstResolver() (OriginalDstResolver, error)

type Forwarder

type Forwarder interface {
	CheckPrereqs() error
	Add([]net.IPNet, []net.IP) error
	Reset() error
}

type ForwarderOpts

type ForwarderOpts struct {
	DstTCPPort    int
	DstDNSTCPPort int
	DstDNSUDPPort int
}

type Iptables

type Iptables struct {
	// contains filtered or unexported fields
}

func NewIptables

func NewIptables(opts IptablesOpts, exec CmdExecutor, logger Logger) Iptables

func (Iptables) Add

func (i Iptables) Add(subnets []net.IPNet, dnsIPs []net.IP) error

func (Iptables) CheckPrereqs

func (i Iptables) CheckPrereqs() error

func (Iptables) Reset

func (i Iptables) Reset() error

type IptablesOpts

type IptablesOpts struct {
	DstTCPPort     int
	DstDNSTCPPort  int
	DstDNSUDPPort  int
	ProcessGroupID int
}

type LinuxOriginalDstResolver

type LinuxOriginalDstResolver struct{}

func (LinuxOriginalDstResolver) GetOrigIPPort

func (r LinuxOriginalDstResolver) GetOrigIPPort(conn net.Conn) (net.IP, int, error)

type Locking

type Locking struct {
	// contains filtered or unexported fields
}

func NewLocking

func NewLocking() *Locking

func (*Locking) Add

func (f *Locking) Add(subnets []net.IPNet, dnsIPs []net.IP) error

func (*Locking) CheckPrereqs

func (f *Locking) CheckPrereqs() error

func (*Locking) Reset

func (f *Locking) Reset() error

func (*Locking) SetForwarder

func (f *Locking) SetForwarder(forwarder Forwarder)

type Logger

type Logger interface {
	Error(tag, msg string, args ...interface{})
	Info(tag, msg string, args ...interface{})
	Debug(tag, msg string, args ...interface{})
}

type OriginalDstResolver

type OriginalDstResolver interface {
	GetOrigIPPort(net.Conn) (net.IP, int, error)
}

type OsCmdExecutor

type OsCmdExecutor struct {
	// contains filtered or unexported fields
}

func NewOsCmdExecutor

func NewOsCmdExecutor(logger Logger) OsCmdExecutor

func (OsCmdExecutor) CombinedOutput

func (e OsCmdExecutor) CombinedOutput(cmdName string, args []string, stdin io.Reader) ([]byte, error)

type Pfctl

type Pfctl struct {
	// contains filtered or unexported fields
}

func NewPfctl

func NewPfctl(opts PfctlOpts, logger Logger) *Pfctl

func (*Pfctl) Add

func (f *Pfctl) Add(subnets []net.IPNet, dnsIPs []net.IP) error

func (*Pfctl) CheckPrereqs

func (f *Pfctl) CheckPrereqs() error

func (*Pfctl) Reset

func (f *Pfctl) Reset() error

type PfctlOpts

type PfctlOpts struct {
	DstTCPPort    int
	DstDNSTCPPort int
	DstDNSUDPPort int

	// 0 is root, so root produced traffic wont go through proxy by default
	ProcessGroupID int
}

type PfctlResolver

type PfctlResolver struct {
	// contains filtered or unexported fields
}

func NewPfctlResolver

func NewPfctlResolver(logger Logger) (PfctlResolver, error)

func (PfctlResolver) GetOrigIPPort

func (r PfctlResolver) GetOrigIPPort(conn net.Conn) (net.IP, int, error)

func (PfctlResolver) GetOrigIPPortWithOpts

func (r PfctlResolver) GetOrigIPPortWithOpts(opts PfctlResolverOpts) (net.IP, int, error)

type PfctlResolverOpts

type PfctlResolverOpts struct {
	SrcIP   net.IP
	SrcPort int32
	DstIP   net.IP
	DstPort int32
}

type StaticResolver added in v0.0.4

type StaticResolver struct {
	// contains filtered or unexported fields
}

func NewStaticResolver added in v0.0.4

func NewStaticResolver(ip net.IP, port int) StaticResolver

func (StaticResolver) GetOrigIPPort added in v0.0.4

func (r StaticResolver) GetOrigIPPort(conn net.Conn) (net.IP, int, error)

Jump to

Keyboard shortcuts

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