Versions in this module Expand all Collapse all v1 v1.0.7 Jun 29, 2025 v1.0.6 Jun 22, 2025 v1.0.5 Jun 22, 2025 v1.0.4 Jun 22, 2025 v1.0.3 Jun 19, 2025 v1.0.2 Jun 19, 2025 Changes in this version + const IPv4len + const IPv6len + var DefaultResolver = &Resolver + var ErrClosed error = errClosed + var ErrWriteToConnected = errors.New("use of WriteTo with pre-connected connection") + var IPv4allrouter = IPv4(224, 0, 0, 2) + var IPv4allsys = IPv4(224, 0, 0, 1) + var IPv4bcast = IPv4(255, 255, 255, 255) + var IPv4zero = IPv4(0, 0, 0, 0) + var IPv6interfacelocalallnodes = IP + var IPv6linklocalallnodes = IP + var IPv6linklocalallrouters = IP + var IPv6loopback = IP + var IPv6unspecified = IP + var IPv6zero = IP + func JoinHostPort(host, port string) string + func LookupAddr(addr string) (names []string, err error) + func LookupCNAME(host string) (cname string, err error) + func LookupHost(host string) (addrs []string, err error) + func LookupPort(network, service string) (port int, err error) + func LookupTXT(name string) ([]string, error) + func ParseCIDR(s string) (IP, *IPNet, error) + func Pipe() (Conn, Conn) + func SplitHostPort(hostport string) (host, port string, err error) + type Addr interface + Network func() string + String func() string + func InterfaceAddrs() ([]Addr, error) + type AddrError struct + Addr string + Err string + func (e *AddrError) Error() string + func (e *AddrError) Temporary() bool + func (e *AddrError) Timeout() bool + type Buffers [][]byte + func (v *Buffers) Read(p []byte) (n int, err error) + func (v *Buffers) WriteTo(w io.Writer) (n int64, err error) + type Conn interface + Close func() error + LocalAddr func() Addr + Read func(b []byte) (n int, err error) + RemoteAddr func() Addr + SetDeadline func(t time.Time) error + SetReadDeadline func(t time.Time) error + SetWriteDeadline func(t time.Time) error + Write func(b []byte) (n int, err error) + func Dial(network, address string) (Conn, error) + func DialTimeout(network, address string, timeout time.Duration) (Conn, error) + func FileConn(f *os.File) (c Conn, err error) + type DNSConfigError struct + Err error + func (e *DNSConfigError) Error() string + func (e *DNSConfigError) Temporary() bool + func (e *DNSConfigError) Timeout() bool + func (e *DNSConfigError) Unwrap() error + type DNSError struct + Err string + IsNotFound bool + IsTemporary bool + IsTimeout bool + Name string + Server string + UnwrapErr error + func (e *DNSError) Error() string + func (e *DNSError) Temporary() bool + func (e *DNSError) Timeout() bool + func (e *DNSError) Unwrap() error + type Dialer struct + Cancel <-chan struct{} + Control func(network, address string, c syscall.RawConn) error + ControlContext func(ctx context.Context, network, address string, c syscall.RawConn) error + Deadline time.Time + DualStack bool + FallbackDelay time.Duration + KeepAlive time.Duration + KeepAliveConfig KeepAliveConfig + LocalAddr Addr + Resolver *Resolver + Timeout time.Duration + func (d *Dialer) Dial(network, address string) (Conn, error) + func (d *Dialer) DialContext(ctx context.Context, network, address string) (Conn, error) + func (d *Dialer) MultipathTCP() bool + func (d *Dialer) SetMultipathTCP(use bool) + type Error interface + Temporary func() bool + Timeout func() bool + type Flags uint + const FlagBroadcast + const FlagLoopback + const FlagMulticast + const FlagPointToPoint + const FlagRunning + const FlagUp + func (f Flags) String() string + type HardwareAddr []byte + func ParseMAC(s string) (hw HardwareAddr, err error) + func (a HardwareAddr) String() string + type IP []byte + func IPv4(a, b, c, d byte) IP + func LookupIP(host string) ([]IP, error) + func ParseIP(s string) IP + func (ip *IP) UnmarshalText(text []byte) error + func (ip IP) AppendText(b []byte) ([]byte, error) + func (ip IP) DefaultMask() IPMask + func (ip IP) Equal(x IP) bool + func (ip IP) IsGlobalUnicast() bool + func (ip IP) IsInterfaceLocalMulticast() bool + func (ip IP) IsLinkLocalMulticast() bool + func (ip IP) IsLinkLocalUnicast() bool + func (ip IP) IsLoopback() bool + func (ip IP) IsMulticast() bool + func (ip IP) IsPrivate() bool + func (ip IP) IsUnspecified() bool + func (ip IP) MarshalText() ([]byte, error) + func (ip IP) Mask(mask IPMask) IP + func (ip IP) String() string + func (ip IP) To16() IP + func (ip IP) To4() IP + type IPAddr struct + IP IP + Zone string + func ResolveIPAddr(network, address string) (*IPAddr, error) + func (a *IPAddr) Network() string + func (a *IPAddr) String() string + type IPConn struct + func DialIP(network string, laddr, raddr *IPAddr) (*IPConn, error) + func ListenIP(network string, laddr *IPAddr) (*IPConn, error) + func (c *IPConn) Close() error + func (c *IPConn) File() (f *os.File, err error) + func (c *IPConn) LocalAddr() Addr + func (c *IPConn) Read(b []byte) (int, error) + func (c *IPConn) ReadFrom(b []byte) (int, Addr, error) + func (c *IPConn) ReadFromIP(b []byte) (int, *IPAddr, error) + func (c *IPConn) ReadMsgIP(b, oob []byte) (n, oobn, flags int, addr *IPAddr, err error) + func (c *IPConn) RemoteAddr() Addr + func (c *IPConn) SetDeadline(t time.Time) error + func (c *IPConn) SetReadBuffer(bytes int) error + func (c *IPConn) SetReadDeadline(t time.Time) error + func (c *IPConn) SetWriteBuffer(bytes int) error + func (c *IPConn) SetWriteDeadline(t time.Time) error + func (c *IPConn) SyscallConn() (syscall.RawConn, error) + func (c *IPConn) Write(b []byte) (int, error) + func (c *IPConn) WriteMsgIP(b, oob []byte, addr *IPAddr) (n, oobn int, err error) + func (c *IPConn) WriteTo(b []byte, addr Addr) (int, error) + func (c *IPConn) WriteToIP(b []byte, addr *IPAddr) (int, error) + type IPMask []byte + func CIDRMask(ones, bits int) IPMask + func IPv4Mask(a, b, c, d byte) IPMask + func (m IPMask) Size() (ones, bits int) + func (m IPMask) String() string + type IPNet struct + IP IP + Mask IPMask + func (n *IPNet) Contains(ip IP) bool + func (n *IPNet) Network() string + func (n *IPNet) String() string + type Interface struct + Flags Flags + HardwareAddr HardwareAddr + Index int + MTU int + Name string + func InterfaceByIndex(index int) (*Interface, error) + func InterfaceByName(name string) (*Interface, error) + func Interfaces() ([]Interface, error) + func (ifi *Interface) Addrs() ([]Addr, error) + func (ifi *Interface) MulticastAddrs() ([]Addr, error) + type InvalidAddrError string + func (e InvalidAddrError) Error() string + func (e InvalidAddrError) Temporary() bool + func (e InvalidAddrError) Timeout() bool + type KeepAliveConfig struct + Count int + Enable bool + Idle time.Duration + Interval time.Duration + type ListenConfig struct + Control func(network, address string, c syscall.RawConn) error + KeepAlive time.Duration + KeepAliveConfig KeepAliveConfig + func (lc *ListenConfig) Listen(ctx context.Context, network, address string) (Listener, error) + func (lc *ListenConfig) ListenPacket(ctx context.Context, network, address string) (PacketConn, error) + func (lc *ListenConfig) MultipathTCP() bool + func (lc *ListenConfig) SetMultipathTCP(use bool) + type Listener interface + Accept func() (Conn, error) + Addr func() Addr + Close func() error + func FileListener(f *os.File) (ln Listener, err error) + func Listen(network, address string) (Listener, error) + type MX struct + Host string + Pref uint16 + func LookupMX(name string) ([]*MX, error) + type NS struct + Host string + func LookupNS(name string) ([]*NS, error) + type OpError struct + Addr Addr + Err error + Net string + Op string + Source Addr + func (e *OpError) Error() string + func (e *OpError) Temporary() bool + func (e *OpError) Timeout() bool + func (e *OpError) Unwrap() error + type PacketConn interface + Close func() error + LocalAddr func() Addr + ReadFrom func(p []byte) (n int, addr Addr, err error) + SetDeadline func(t time.Time) error + SetReadDeadline func(t time.Time) error + SetWriteDeadline func(t time.Time) error + WriteTo func(p []byte, addr Addr) (n int, err error) + func FilePacketConn(f *os.File) (c PacketConn, err error) + func ListenPacket(network, address string) (PacketConn, error) + type ParseError struct + Text string + Type string + func (e *ParseError) Error() string + func (e *ParseError) Temporary() bool + func (e *ParseError) Timeout() bool + type Resolver struct + Dial func(ctx context.Context, network, address string) (Conn, error) + PreferGo bool + StrictErrors bool + func (r *Resolver) LookupAddr(ctx context.Context, addr string) ([]string, error) + func (r *Resolver) LookupCNAME(ctx context.Context, host string) (string, error) + func (r *Resolver) LookupHost(ctx context.Context, host string) (addrs []string, err error) + func (r *Resolver) LookupIP(ctx context.Context, network, host string) ([]IP, error) + func (r *Resolver) LookupIPAddr(ctx context.Context, host string) ([]IPAddr, error) + func (r *Resolver) LookupMX(ctx context.Context, name string) ([]*MX, error) + func (r *Resolver) LookupNS(ctx context.Context, name string) ([]*NS, error) + func (r *Resolver) LookupNetIP(ctx context.Context, network, host string) ([]netip.Addr, error) + func (r *Resolver) LookupPort(ctx context.Context, network, service string) (port int, err error) + func (r *Resolver) LookupSRV(ctx context.Context, service, proto, name string) (string, []*SRV, error) + func (r *Resolver) LookupTXT(ctx context.Context, name string) ([]string, error) + type SRV struct + Port uint16 + Priority uint16 + Target string + Weight uint16 + func LookupSRV(service, proto, name string) (cname string, addrs []*SRV, err error) + type TCPAddr struct + IP IP + Port int + Zone string + func ResolveTCPAddr(network, address string) (*TCPAddr, error) + func TCPAddrFromAddrPort(addr netip.AddrPort) *TCPAddr + func (a *TCPAddr) AddrPort() netip.AddrPort + func (a *TCPAddr) Network() string + func (a *TCPAddr) String() string + type TCPConn struct + func DialTCP(network string, laddr, raddr *TCPAddr) (*TCPConn, error) + func (c *TCPConn) Close() error + func (c *TCPConn) CloseRead() error + func (c *TCPConn) CloseWrite() error + func (c *TCPConn) File() (f *os.File, err error) + func (c *TCPConn) LocalAddr() Addr + func (c *TCPConn) MultipathTCP() (bool, error) + func (c *TCPConn) Read(b []byte) (int, error) + func (c *TCPConn) ReadFrom(r io.Reader) (int64, error) + func (c *TCPConn) RemoteAddr() Addr + func (c *TCPConn) SetDeadline(t time.Time) error + func (c *TCPConn) SetKeepAlive(keepalive bool) error + func (c *TCPConn) SetKeepAliveConfig(config KeepAliveConfig) error + func (c *TCPConn) SetKeepAlivePeriod(d time.Duration) error + func (c *TCPConn) SetLinger(sec int) error + func (c *TCPConn) SetNoDelay(noDelay bool) error + func (c *TCPConn) SetReadBuffer(bytes int) error + func (c *TCPConn) SetReadDeadline(t time.Time) error + func (c *TCPConn) SetWriteBuffer(bytes int) error + func (c *TCPConn) SetWriteDeadline(t time.Time) error + func (c *TCPConn) SyscallConn() (syscall.RawConn, error) + func (c *TCPConn) Write(b []byte) (int, error) + func (c *TCPConn) WriteTo(w io.Writer) (int64, error) + type TCPListener struct + func ListenTCP(network string, laddr *TCPAddr) (*TCPListener, error) + func (l *TCPListener) Accept() (Conn, error) + func (l *TCPListener) AcceptTCP() (*TCPConn, error) + func (l *TCPListener) Addr() Addr + func (l *TCPListener) Close() error + func (l *TCPListener) File() (f *os.File, err error) + func (l *TCPListener) SetDeadline(t time.Time) error + func (l *TCPListener) SyscallConn() (syscall.RawConn, error) + type UDPAddr struct + IP IP + Port int + Zone string + func ResolveUDPAddr(network, address string) (*UDPAddr, error) + func UDPAddrFromAddrPort(addr netip.AddrPort) *UDPAddr + func (a *UDPAddr) AddrPort() netip.AddrPort + func (a *UDPAddr) Network() string + func (a *UDPAddr) String() string + type UDPConn struct + func DialUDP(network string, laddr, raddr *UDPAddr) (*UDPConn, error) + func ListenMulticastUDP(network string, ifi *Interface, gaddr *UDPAddr) (*UDPConn, error) + func ListenUDP(network string, laddr *UDPAddr) (*UDPConn, error) + func (c *UDPConn) Close() error + func (c *UDPConn) File() (f *os.File, err error) + func (c *UDPConn) LocalAddr() Addr + func (c *UDPConn) Read(b []byte) (int, error) + func (c *UDPConn) ReadFrom(b []byte) (int, Addr, error) + func (c *UDPConn) ReadFromUDP(b []byte) (n int, addr *UDPAddr, err error) + func (c *UDPConn) ReadFromUDPAddrPort(b []byte) (n int, addr netip.AddrPort, err error) + func (c *UDPConn) ReadMsgUDP(b, oob []byte) (n, oobn, flags int, addr *UDPAddr, err error) + func (c *UDPConn) ReadMsgUDPAddrPort(b, oob []byte) (n, oobn, flags int, addr netip.AddrPort, err error) + func (c *UDPConn) RemoteAddr() Addr + func (c *UDPConn) SetDeadline(t time.Time) error + func (c *UDPConn) SetReadBuffer(bytes int) error + func (c *UDPConn) SetReadDeadline(t time.Time) error + func (c *UDPConn) SetWriteBuffer(bytes int) error + func (c *UDPConn) SetWriteDeadline(t time.Time) error + func (c *UDPConn) SyscallConn() (syscall.RawConn, error) + func (c *UDPConn) Write(b []byte) (int, error) + func (c *UDPConn) WriteMsgUDP(b, oob []byte, addr *UDPAddr) (n, oobn int, err error) + func (c *UDPConn) WriteMsgUDPAddrPort(b, oob []byte, addr netip.AddrPort) (n, oobn int, err error) + func (c *UDPConn) WriteTo(b []byte, addr Addr) (int, error) + func (c *UDPConn) WriteToUDP(b []byte, addr *UDPAddr) (int, error) + func (c *UDPConn) WriteToUDPAddrPort(b []byte, addr netip.AddrPort) (int, error) + type UnixAddr struct + Name string + Net string + func ResolveUnixAddr(network, address string) (*UnixAddr, error) + func (a *UnixAddr) Network() string + func (a *UnixAddr) String() string + type UnixConn struct + func DialUnix(network string, laddr, raddr *UnixAddr) (*UnixConn, error) + func ListenUnixgram(network string, laddr *UnixAddr) (*UnixConn, error) + func (c *UnixConn) Close() error + func (c *UnixConn) CloseRead() error + func (c *UnixConn) CloseWrite() error + func (c *UnixConn) File() (f *os.File, err error) + func (c *UnixConn) LocalAddr() Addr + func (c *UnixConn) Read(b []byte) (int, error) + func (c *UnixConn) ReadFrom(b []byte) (int, Addr, error) + func (c *UnixConn) ReadFromUnix(b []byte) (int, *UnixAddr, error) + func (c *UnixConn) ReadMsgUnix(b, oob []byte) (n, oobn, flags int, addr *UnixAddr, err error) + func (c *UnixConn) RemoteAddr() Addr + func (c *UnixConn) SetDeadline(t time.Time) error + func (c *UnixConn) SetReadBuffer(bytes int) error + func (c *UnixConn) SetReadDeadline(t time.Time) error + func (c *UnixConn) SetWriteBuffer(bytes int) error + func (c *UnixConn) SetWriteDeadline(t time.Time) error + func (c *UnixConn) SyscallConn() (syscall.RawConn, error) + func (c *UnixConn) Write(b []byte) (int, error) + func (c *UnixConn) WriteMsgUnix(b, oob []byte, addr *UnixAddr) (n, oobn int, err error) + func (c *UnixConn) WriteTo(b []byte, addr Addr) (int, error) + func (c *UnixConn) WriteToUnix(b []byte, addr *UnixAddr) (int, error) + type UnixListener struct + func ListenUnix(network string, laddr *UnixAddr) (*UnixListener, error) + func (l *UnixListener) Accept() (Conn, error) + func (l *UnixListener) AcceptUnix() (*UnixConn, error) + func (l *UnixListener) Addr() Addr + func (l *UnixListener) Close() error + func (l *UnixListener) File() (f *os.File, err error) + func (l *UnixListener) SetDeadline(t time.Time) error + func (l *UnixListener) SetUnlinkOnClose(unlink bool) + func (l *UnixListener) SyscallConn() (syscall.RawConn, error) + type UnknownNetworkError string + func (e UnknownNetworkError) Error() string + func (e UnknownNetworkError) Temporary() bool + func (e UnknownNetworkError) Timeout() bool