ipn

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: 61 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Block    = x.Block
	Base     = x.Base
	Exit     = x.Exit
	Auto     = x.Auto
	Ingress  = x.Ingress // dummy
	OrbotS5  = x.OrbotS5
	OrbotH1  = x.OrbotH1
	GlobalH1 = x.GlobalH1
	RpnWg    = x.RpnWg
	RpnWs    = x.RpnWs
	Rpn64    = x.Rpn64
	RpnH2    = x.RpnH2
	RpnSE    = x.RpnSE

	SOCKS5   = x.SOCKS5
	HTTP1    = x.HTTP1
	WG       = x.WG
	PIPH2    = x.PIPH2
	PIPWS    = x.PIPWS
	NOOP     = x.NOOP
	INTERNET = x.INTERNET
	RPN      = x.RPN

	TNT = x.TNT
	TZZ = x.TZZ
	TUP = x.TUP
	TOK = x.TOK
	TKO = x.TKO
	END = x.END

	NOMTU  = 0
	MAXMTU = 65535
)
View Source
const (
	FAST = x.WGFAST
)

Variables

View Source
var ProxyNoGateway = GWNoVia{GW: GW{/* contains filtered or unexported fields */}}

ProxyNoGateway is a Router that routes nothing.

Functions

func AnyAddrForUDP

func AnyAddrForUDP(ipp netip.AddrPort) (proto, anyaddr string)

func NewAutoProxy

func NewAutoProxy(ctx context.Context, pxr Proxies) *auto

NewAutoProxy returns a new exit proxy.

func NewBaseProxy

func NewBaseProxy(ctx context.Context, c protect.Controller) *base

Base returns a base proxy.

func NewExit64Proxy

func NewExit64Proxy(ctx context.Context, c protect.Controller) *exit64

NewExit64Proxy returns a new exit64 proxy.

func NewExitProxy

func NewExitProxy(ctx context.Context, c protect.Controller) *exit

NewExitProxy returns a new exit proxy.

func NewGroundProxy

func NewGroundProxy() *ground

NewGroundProxy returns a new ground proxy.

func NewHTTPProxy

func NewHTTPProxy(id string, ctx context.Context, c protect.Controller, po *settings.ProxyOptions) (*http1, error)

func NewPipProxy

func NewPipProxy(ctx context.Context, ctl protect.Controller, po *settings.ProxyOptions) (*piph2, error)

func NewPipWsProxy

func NewPipWsProxy(ctx context.Context, ctl protect.Controller, po *settings.ProxyOptions) (*pipws, error)

NewPipWsProxy creates a new pipws proxy with the given id, controller, and proxy options. The proxy options must contain a valid URL, and the URL must have a path with the format "/ws/<sha256(rsasig)>". The proxy options must also contain a valid auth user (raw client token) and password (expiry + signed raw client token).

func NewProxifier

func NewProxifier(pctx context.Context, c protect.Controller, o x.ProxyListener) *proxifier

NewProxifier returns a new Proxifier instance.

func NewSEasyProxy

func NewSEasyProxy(ctx context.Context, c protect.Controller, sec *seasy.SEApi) (*seproxy, error)

NewSEasyProxy returns a new seproxy.

func NewSocks5Proxy

func NewSocks5Proxy(id string, ctx context.Context, ctl protect.Controller, po *settings.ProxyOptions) (_ *socks5, err error)

func NewWgProxy

func NewWgProxy(id string, ctl protect.Controller, rev netstack.GConnHandler, cfg string) (*wgproxy, error)

ref: github.com/WireGuard/wireguard-android/blob/713947e432/tunnel/tools/libwg-go/api-android.go#L76

func Reaches

func Reaches(p Proxy, hostportOrIPPortCsv string, protos ...string) bool

func Same

func Same(a, b Proxy) bool

Types

type GW

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

GW is a no-op/stub gateway that is either dualstack or not and has dummy stats.

func (*GW) Contains

func (w *GW) Contains(prefix string) bool

Contains implements Router.

func (*GW) IP4

func (w *GW) IP4() bool

IP4 implements Router.

func (*GW) IP6

func (w *GW) IP6() bool

IP6 implements Router.

func (*GW) MTU

func (w *GW) MTU() (int, error)

MTU implements Router.

func (*GW) Reaches

func (w *GW) Reaches(hostportOrIPPortCsv string) bool

Reaches implements Router.

func (*GW) Stat

func (w *GW) Stat() *x.RouterStats

Stat implements Router.

type GWNoVia

type GWNoVia struct {
	NoVia
	GW
}

todo: impl a baseproxy for common fns ID, GetAddr, Status, Via, Hop etc

type NoDNS

type NoDNS struct{}

func (NoDNS) DNS

func (NoDNS) DNS() string

type NoFwd

type NoFwd struct{}

NoFwd is a proxy that does not support listening or forwarding.

func (NoFwd) Accept

func (NoFwd) Accept(network, local string) (protect.Listener, error)

Accept implements Proxy.

func (NoFwd) Announce

func (NoFwd) Announce(network, local string) (protect.PacketConn, error)

Announce implements Proxy.

func (NoFwd) Probe

Probe implements Proxy.

type NoProxy

type NoProxy struct {
	NoDNS
	ProtoAgnostic
	SkipRefresh
	NoFwd
	GWNoVia
}

func (NoProxy) Dial

func (NoProxy) Dial(string, string) (protect.Conn, error)

func (NoProxy) DialBind

func (NoProxy) DialBind(string, string, string) (protect.Conn, error)

func (NoProxy) Dialer

func (NoProxy) Dialer() protect.RDialer

func (NoProxy) GetAddr

func (NoProxy) GetAddr() string

func (NoProxy) Handle

func (NoProxy) Handle() uintptr

func (NoProxy) ID

func (NoProxy) ID() string

func (NoProxy) Reaches

func (NoProxy) Reaches(string) bool

func (NoProxy) Router

func (NoProxy) Router() x.Router

func (NoProxy) Status

func (NoProxy) Status() int

func (NoProxy) Stop

func (NoProxy) Stop() error

func (NoProxy) Type

func (NoProxy) Type() string

type NoVia

type NoVia struct{}

func (NoVia) Hop

func (NoVia) Hop(Proxy) error

func (NoVia) Via

func (NoVia) Via() (x.Proxy, error)

type ProtoAgnostic

type ProtoAgnostic struct{}

ProtoAgnostic is a proxy that does not care about protocol changes.

func (ProtoAgnostic) OnProtoChange

func (ProtoAgnostic) OnProtoChange() (string, bool)

OnProtoChange implements Proxy.

type Proxies

type Proxies interface {
	x.Proxies
	// ProxyFor returns a transport from this multi-transport.
	ProxyFor(id string) (Proxy, error)
	// ProxyTo returns the proxy to use for ipp from given pids.
	ProxyTo(ipp netip.AddrPort, uid string, pids []string) (Proxy, error)
	// RefreshProto broadcasts proto change to all active proxies.
	RefreshProto(l3 string)
	// LiveProxies returns a csv of active proxies.
	LiveProxies() string
	// Reverser sets the reverse proxy for all proxies.
	Reverser(r netstack.GConnHandler) error
}

type Proxy

type Proxy interface {
	x.Proxy
	protect.RDialer

	// Dialer returns the dialer for this proxy, which is an
	// adapter for protect.RDialer interface, but with the caveat that
	// not all Proxy instances implement DialTCP and DialUDP, though are
	// guaranteed to implement Dial.
	Dialer() protect.RDialer

	// onProtoChange returns true if the proxy must be re-added with cfg on proto changes.
	OnProtoChange() (cfg string, readd bool)
	// Gateway sets proxy p as the gateway for this router.
	Hop(p Proxy) error
	// contains filtered or unexported methods
}

type SkipRefresh

type SkipRefresh struct{}

SkipRefresh is a proxy that does not need to be refreshed or pinged on network changes.

func (SkipRefresh) Ping

func (SkipRefresh) Ping() bool

Ping implements Proxy.

func (SkipRefresh) Refresh

func (SkipRefresh) Refresh() error

Refresh implements Proxy.

type WgProxy

type WgProxy interface {
	Proxy
	tun.Device

	IpcSet(txt string) error
	// contains filtered or unexported methods
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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