Documentation ¶
Overview ¶
Package netx provides additional libraries that extend some of the behaviors in the net standard package.
Index ¶
- func BidiCopy(out net.Conn, in net.Conn, bufOut []byte, bufIn []byte) (outErr error, inErr error)
- func BidiCopyWithOpts(out net.Conn, in net.Conn, opts *CopyOpts) (outErr <-chan error, inErr <-chan error)
- func Dial(network string, addr string) (net.Conn, error)
- func DialContext(ctx context.Context, network string, addr string) (net.Conn, error)
- func DialTimeout(network string, addr string, timeout time.Duration) (net.Conn, error)
- func DialUDP(network string, laddr, raddr *net.UDPAddr) (*net.UDPConn, error)
- func EnableNAT64AutoDiscovery()
- func IsTimeout(err error) bool
- func ListenUDP(network string, laddr *net.UDPAddr) (*net.UDPConn, error)
- func OverrideDial(dialFN func(ctx context.Context, net string, addr string) (net.Conn, error))
- func OverrideDialUDP(dialFN func(net string, laddr, raddr *net.UDPAddr) (*net.UDPConn, error))
- func OverrideListenUDP(listenFN func(network string, laddr *net.UDPAddr) (*net.UDPConn, error))
- func OverrideResolveIPs(resolveFN func(host string) ([]net.IP, error))
- func Reset()
- func Resolve(network string, addr string) (*net.TCPAddr, error)
- func ResolveUDPAddr(network string, addr string) (*net.UDPAddr, error)
- func WalkWrapped(conn net.Conn, cb func(net.Conn) bool)
- type CopyOpts
- type WrappedConn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BidiCopy ¶
BidiCopy copies between in and out in both directions using the specified buffers, returning the errors from copying to out and copying to in.
func BidiCopyWithOpts ¶
func BidiCopyWithOpts(out net.Conn, in net.Conn, opts *CopyOpts) (outErr <-chan error, inErr <-chan error)
BidiCopyWithOpts is like the original BidiCopy but providing more options and returning channels for reading the errors rather than the errors themselves.
func DialContext ¶
DialContext dials the given addr on the given net type using the configured dial function, with the given context.
func DialTimeout ¶
DialTimeout dials the given addr on the given net type using the configured dial function, timing out after the given timeout.
func EnableNAT64AutoDiscovery ¶
func EnableNAT64AutoDiscovery()
EnableNAT64 enables automatic discovery of NAT64 prefix using DNS query for ipv4only.arpa. Once enabled, netx will automatically dial IPv4 addresses via IPv6 using this prefix if it is available
func OverrideDial ¶
OverrideDial overrides the global dial function.
func OverrideDialUDP ¶
OverrideDialUDP overrides the global dialUDP function.
func OverrideListenUDP ¶
OverrideListenUDP overrides the global listenUDP function.
func OverrideResolveIPs ¶
OverrideResolveIPs overrides the global IP resolution function.