dialers

package
v0.0.0-...-5849f3d Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: MPL-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultTimeout time.Duration = 0

DefaultTimeout is the value that will cause DialWithSplitRetry to use the system's default TCP timeout (typically 2-3 minutes).

Variables

This section is empty.

Functions

func Clear

func Clear()

func Confirm

func Confirm(hostOrIP string, addr net.Addr) bool

Confirm marks addr as preferred for hostOrIP

func Confirm2

func Confirm2(hostOrIP string, addr netip.Addr) bool

func Dial

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

Dial dials into addr using the provided dialer and returns a net.Conn, which is guaranteed to be either net.UDPConn or net.TCPConn

func Dial2

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

Dial2 dials into addr using the provided dialer and returns a net.Conn

func Disconfirm

func Disconfirm(hostOrIP string, ip net.Addr) bool

Disconfirm unmarks addr as preferred for hostOrIP

func Disconfirm2

func Disconfirm2(hostOrIP string, ip netip.Addr) bool

Disconfirm2 unmarks addr as preferred for hostOrIP

func For

func For(hostOrIP string) []netip.Addr

For returns addresses for hostOrIP from cache, resolving them if missing. Underlying cache relies on Disconfirm() to remove unreachable IP addrs; if not called, these entries may go stale. Use Resolve() to bypass cache.

func IPProtos

func IPProtos(ippro string)

p must be one of settings.IP4, settings.IP6, or settings.IP46

func Listen

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

Listen listens on for TCP connections on the local address using d.

func ListenPacket

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

ListenPacket listens on for UDP connections on the local address using d. Returned net.Conn is guaranteed to be a *net.UDPConn.

func Mapper

func Mapper(m ipmap.IPMapper)

Mapper is a hostname to IP (a/aaaa) resolver for the network engine; may be nil.

func NetDial

func NetDial(d *net.Dialer, network, addr string) (net.Conn, error)

NetDial connects to the address on the named network using net.Dialer.

func NetListen

func NetListen(cfg *net.ListenConfig, network, local string) (net.Listener, error)

NetListen listens for TCP on local address using cfg.

func NetListenPacket

func NetListenPacket(cfg *net.ListenConfig, network, local string) (net.PacketConn, error)

NetListenPacket listens for UDP on local address using cfg. Returned net.Conn is guaranteed to be a *net.UDPConn.

func New

func New(hostOrIP string, ipps []string) (*ipmap.IPSet, bool)

New re-seeds hostOrIP with a new set of ips or ip:ports.

func ProxyDial

func ProxyDial(d proxy.Dialer, network, addr string) (net.Conn, error)

ProxyDial tries to connect to addr using d

func ProxyDials

func ProxyDials(dd []proxy.Dialer, network, addr string) (c net.Conn, err error)

ProxyDials tries to connect to addr using each dialer in dd

func Resolve

func Resolve(hostname string) ([]netip.Addr, error)

Resolve resolves hostname to IP addresses, bypassing cache. If resolution fails, entries from the cache are returned, if any.

func SplitDial

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

SplitDial dials into addr splitting ClientHello if the first connection is unsuccessful. Using the provided dialer it returns a net.Conn, which may not be net.UDPConn or net.TCPConn

func SplitDial2

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

SplitDial2 is like SplitDial except it splits ClientHello in all TLS connections.

func SplitDialWithTls

func SplitDialWithTls(d *protect.RDial, cfg *tls.Config, addr string) (net.Conn, error)

SplitDialWithTls dials into addr using the provided dialer and returns a tls.Conn

func TlsDial

func TlsDial(d *tls.Dialer, network, addr string) (net.Conn, error)

Types

type DuplexConn

type DuplexConn interface {
	net.Conn
	io.ReaderFrom
	CloseWrite() error
	CloseRead() error
}

DuplexConn represents a bidirectional stream socket.

func DialWithSplit

func DialWithSplit(d *protect.RDial, addr *net.TCPAddr) (DuplexConn, error)

DialWithSplit returns a TCP connection that always splits the initial upstream segment. Like net.Conn, it is intended for two-threaded use, with one thread calling Read and CloseRead, and another calling Write, ReadFrom, and CloseWrite.

func DialWithSplitRetry

func DialWithSplitRetry(dial *protect.RDial, addr *net.TCPAddr) (DuplexConn, error)

DialWithSplitRetry returns a TCP connection that transparently retries by splitting the initial upstream segment if the socket closes without receiving a reply. Like net.Conn, it is intended for two-threaded use, with one thread calling Read and CloseRead, and another calling Write, ReadFrom, and CloseWrite. `dialer` will be used to establish the connection. `addr` is the destination.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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