protect

package
v0.0.0-...-3c9b203 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: MPL-2.0 Imports: 9 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 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 Listener

type Listener = net.Listener

type PacketConn

type PacketConn = net.PacketConn

type Protector

type Protector = b.Protector

type RDial

type RDial struct {
	Owner   string            // owner tag
	Dialer  proxy.Dialer      // may be nil
	Listen  *net.ListenConfig // may be nil
	RDialer RDialer           // may be nil
}

RDial discards local-addresses

func MakeNsRDial

func MakeNsRDial(who string, c Controller) *RDial

Creates a RDial that can bind to any active interface.

func (*RDial) Accept

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

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".

func (*RDial) Announce

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

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".

func (*RDial) Dial

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

func (*RDial) DialContext

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

func (*RDial) DialTCP

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

func (*RDial) DialUDP

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

type RDialer

type RDialer interface {
	// 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)
	// 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)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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