Documentation ¶
Index ¶
- Constants
- func Clear()
- func Confirm(hostOrIP string, addr net.Addr) bool
- func Confirm2(hostOrIP string, addr netip.Addr) bool
- func Dial(d *protect.RDial, network, addr string) (net.Conn, error)
- func Dial2(d *protect.RDial, network, addr string) (net.Conn, error)
- func Disconfirm(hostOrIP string, addr netip.Addr) bool
- func Disconfirm2(hostOrIP string, addr string) bool
- func Disconfirm3(hostOrIP string, addr net.Addr) bool
- func For(hostOrIP string) []netip.Addr
- func IPProtos(ippro string)
- func Listen(d *protect.RDial, network, local string) (net.Listener, error)
- func ListenPacket(d *protect.RDial, network, local string) (net.PacketConn, error)
- func Mapper(m ipmap.IPMapper)
- func NetDial(d *net.Dialer, network, addr string) (net.Conn, error)
- func NetListen(cfg *net.ListenConfig, network, local string) (net.Listener, error)
- func NetListenPacket(cfg *net.ListenConfig, network, local string) (net.PacketConn, error)
- func New(hostOrIP string, ipps []string) (*ipmap.IPSet, bool)
- func NewProtected(hostOrIP string, ipps []string) (*ipmap.IPSet, bool)
- func ProxyDial(d proxy.Dialer, network, addr string) (net.Conn, error)
- func ProxyDials(dd []proxy.Dialer, network, addr string) (c net.Conn, err error)
- func Resolve(hostname string) ([]netip.Addr, error)
- func SplitDial(d *protect.RDial, network, addr string) (net.Conn, error)
- func SplitDial2(d *protect.RDial, network, addr string) (net.Conn, error)
- func SplitDialWithTls(d *protect.RDial, cfg *tls.Config, addr string) (net.Conn, error)
- func TlsDial(d *tls.Dialer, network, addr string) (net.Conn, error)
- type DuplexConn
Constants ¶
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 Dial ¶
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 Disconfirm ¶
Disconfirm unmarks addr as preferred for hostOrIP
func Disconfirm2 ¶
Disconfirm2 unmarks addr as preferred for hostOrIP
func Disconfirm3 ¶
Disconfirm3 unmarks addr as preferred for hostOrIP
func For ¶
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 ListenPacket ¶
ListenPacket listens on for UDP connections on the local address using d. Returned net.Conn is guaranteed to be a *net.UDPConn.
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 ProxyDials ¶
ProxyDials tries to connect to addr using each dialer in dd
func Resolve ¶
Resolve resolves hostname to IP addresses, bypassing cache. If resolution fails, entries from the cache are returned, if any.
func SplitDial ¶
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 ¶
SplitDial2 is like SplitDial except it splits ClientHello in all TLS connections.
func SplitDialWithTls ¶
SplitDialWithTls dials into addr using the provided dialer and returns a tls.Conn
Types ¶
type DuplexConn ¶
DuplexConn represents a bidirectional stream socket.
func DialWithSplit ¶
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 ¶
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.