protect

package
v0.0.0-...-99b537f Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2024 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UidSelf   = b.UidSelf
	UidSystem = b.UidSystem
	Localhost = b.Localhost
)

See: ipmap.LookupNetIP; UidSelf -> dnsx.Default; UidSystem -> dnsx.System

Variables

This section is empty.

Functions

func MakeDialer

func MakeDialer(p Protector) *net.Dialer

unused: Creates a dialer that binds to a particular ip.

func MakeListenConfig

func MakeListenConfig(p Protector) *net.ListenConfig

unused: Creates a listener that binds to a particular ip.

func MakeNsDialer

func MakeNsDialer(who string, c Controller) *net.Dialer

Creates a net.Dialer that can bind to any active interface.

func MakeNsICMPListener

func MakeNsICMPListener(who string, c Controller) *icmplistener

func MakeNsICMPListenerExt

func MakeNsICMPListenerExt(who string, ctl Controller, ext []ControlFn) *icmplistener

func MakeNsListenConfigExt

func MakeNsListenConfigExt(who string, ctl Controller, ext []ControlFn) *net.ListenConfig

Creates a listener that can bind to any active interface, with additional control fns.

func MakeNsListener

func MakeNsListener(who string, c Controller) *net.ListenConfig

Creates a listener that can bind to any active interface.

func NeverResolve

func NeverResolve(hostname string) bool

never resolve system/default resolver; expected to have seeded ips

Types

type Conn

type Conn = net.Conn

Adapter to keep gomobile happy as it can't export net.Conn

type ControlFn

type ControlFn func(network, addr string, c syscall.RawConn) (err error)

type Controller

type Controller = b.Controller

type DialFn

type DialFn func(network, addr string) (net.Conn, error)

type Listener

type Listener = net.Listener

type MinConn

type MinConn = core.MinConn

type PacketConn

type PacketConn = net.PacketConn

type Protector

type Protector = b.Protector

type RDial

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

RDial adapts dialers and listeners to RDialer. It always discards bind address.

func MakeNsRDial

func MakeNsRDial(who string, ctx context.Context, c Controller) *RDial

Creates a RDial that can bind to any active interface.

func MakeNsRDialExt

func MakeNsRDialExt(who string, ctx context.Context, ctl Controller, ext []ControlFn) *RDial

Creates a RDial that can bind to any active interface, with additional control fns.

func (*RDial) Accept

func (d *RDial) Accept(network, local string) (net.Listener, error)

Accept implements RDialer interface.

func (*RDial) AcceptTCP

func (d *RDial) AcceptTCP(network string, local string) (*net.TCPListener, error)

AcceptTCP creates a listener on the local address. network must be "tcp" or "tcp4" or "tcp6". Helper method for d.Accept("tcp", local)

func (*RDial) Announce

func (d *RDial) Announce(network, local string) (net.PacketConn, error)

Announce implements RDialer.

func (*RDial) AnnounceUDP

func (d *RDial) AnnounceUDP(network, local string) (*net.UDPConn, error)

AnnounceUDP announces the local address. network must be "udp" or "udp4" or "udp6". Helper method for d.Announce("udp", local)

func (*RDial) Dial

func (d *RDial) Dial(network, addr string) (net.Conn, error)

Dial implements RDialer.

func (*RDial) DialBind

func (d *RDial) DialBind(network, local, remote string) (net.Conn, error)

DialBind implements RDialer.

func (*RDial) DialContext

func (d *RDial) DialContext(ctx context.Context, network, addr string) (net.Conn, error)

func (*RDial) DialTCP

func (d *RDial) DialTCP(network string, laddr, raddr *net.TCPAddr) (*net.TCPConn, error)

DialTCP creates a net.TCPConn to raddr. Helper method for d.Dial("tcp", laddr.String(), raddr.String())

func (*RDial) DialUDP

func (d *RDial) DialUDP(network string, laddr, raddr *net.UDPAddr) (*net.UDPConn, error)

DialUDP creates a net.UDPConn to raddr. Helper method for d.Dial("udp", laddr.String(), raddr.String())

func (*RDial) Handle

func (d *RDial) Handle() uintptr

Handle implements RDialer.

func (*RDial) Probe

func (d *RDial) Probe(network, local string) (PacketConn, error)

Probe implements RDialer.

func (*RDial) ProbeICMP

func (d *RDial) ProbeICMP(network, local string) (net.PacketConn, error)

ProbeICMP listens on the local address for ICMP packets sent over UDP. network must be "udp" or "udp4" or "udp6". Helper method for d.Probe("udp", local)

type RDialer

type RDialer interface {
	// Handle uniquely identifies the concrete type backing this dialer.
	// Useful as a phantom reference to this dialer.
	// github.com/hashicorp/terraform/blob/325d18262/internal/configs/configschema/decoder_spec.go#L32
	Handle() uintptr
	// Dial creates a connection to the given address,
	// the resulting net.Conn must be a *net.TCPConn if
	// network is "tcp" or "tcp4" or "tcp6" and must be
	// a *net.UDPConn if network is "udp" or "udp4" or "udp6".
	Dial(network, addr string) (Conn, error)
	// DialBind is like Dial but creates a connection to
	// the remote address bounded from the local port (not ip).
	// If local is invalid ip:port (ip must be present but not used),
	// it delegates to Dial(network, remote).
	DialBind(network, local, remote string) (Conn, error)
	// Announce announces the local address. network must be
	// packet-oriented ("udp" or "udp4" or "udp6").
	Announce(network, local string) (PacketConn, error)
	// Accept creates a listener on the local address. network
	// must be stream-oriented ("tcp" or "tcp4" or "tcp6").
	Accept(network, local string) (Listener, error)
	// Probe listens on the local address for ICMP packets sent
	// over UDP. Network must be "udp" or "udp4" or "udp6".
	Probe(network, local string) (PacketConn, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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