Documentation
¶
Index ¶
- Constants
- Variables
- func NewNet() netFacade
- type Addr
- type AddrError
- type Buffers
- type Conn
- type DNSConfigError
- type DNSError
- type Dialer
- type DialerOption
- func WithCancel(c <-chan struct{}) DialerOption
- func WithControl(f func(string, string, syscall.RawConn) error) DialerOption
- func WithControlContext(f func(context.Context, string, string, syscall.RawConn) error) DialerOption
- func WithDeadline(t time.Time) DialerOption
- func WithDualStack() DialerOption
- func WithFallbackDelay(d time.Duration) DialerOption
- func WithKeepAlive(d time.Duration) DialerOption
- func WithKeepAliveConfig(cfg KeepAliveConfig) DialerOption
- func WithLocalAddr(addr Addr) DialerOption
- func WithResolver(r Resolver) DialerOption
- func WithSetMultipathTCP(b bool) DialerOption
- func WithTimeout(d time.Duration) DialerOption
- type Error
- type Flags
- type IP
- type IPAddr
- type IPConn
- type IPMask
- type IPNet
- type Interface
- type InvalidAddrError
- type KeepAliveConfig
- type ListenConfig
- type ListenConfigOption
- type Listener
- type MX
- type NS
- type Net
- type OpError
- type PacketConn
- type ParseError
- type Resolver
- type ResolverOption
- type SRV
- type TCPAddr
- type TCPConn
- type TCPListener
- type UDPAddr
- type UDPConn
- type UnixAddr
- type UnixConn
- type UnixListener
- type UnknownNetworkError
Constants ¶
View Source
const ( IPv4len = net.IPv4len IPv6len = net.IPv6len FlagUp = net.FlagUp FlagBroadcast = net.FlagBroadcast FlagLoopback = net.FlagLoopback FlagPointToPoint = net.FlagPointToPoint FlagMulticast = net.FlagMulticast FlagRunning = net.FlagRunning )
Variables ¶
View Source
var ( JoinHostPort = net.JoinHostPort ParseCIDR = net.ParseCIDR Pipe = net.Pipe SplitHostPort = net.SplitHostPort )
View Source
var ( IPv4bcast = net.IPv4bcast IPv4allsys = net.IPv4allsys IPv4allrouter = net.IPv4allrouter IPv4zero = net.IPv4zero IPv6zero = net.IPv6zero IPv6unspecified = net.IPv6unspecified IPv6loopback = net.IPv6loopback IPv6interfacelocalallnodes = net.IPv6interfacelocalallnodes IPv6linklocalallnodes = net.IPv6linklocalallnodes IPv6linklocalallrouters = net.IPv6linklocalallrouters DefaultResolver = wrapResolver(net.DefaultResolver) ErrClosed = net.ErrClosed ErrWriteToConnected = net.ErrWriteToConnected )
Functions ¶
Types ¶
type DNSConfigError ¶
type DNSConfigError = net.DNSConfigError
type DialerOption ¶
func WithCancel ¶
func WithCancel(c <-chan struct{}) DialerOption
func WithControl ¶
func WithControlContext ¶
func WithDeadline ¶
func WithDeadline(t time.Time) DialerOption
func WithDualStack ¶
func WithDualStack() DialerOption
func WithFallbackDelay ¶
func WithFallbackDelay(d time.Duration) DialerOption
func WithKeepAlive ¶
func WithKeepAlive(d time.Duration) DialerOption
func WithKeepAliveConfig ¶
func WithKeepAliveConfig(cfg KeepAliveConfig) DialerOption
func WithLocalAddr ¶
func WithLocalAddr(addr Addr) DialerOption
func WithResolver ¶
func WithResolver(r Resolver) DialerOption
func WithSetMultipathTCP ¶
func WithSetMultipathTCP(b bool) DialerOption
func WithTimeout ¶
func WithTimeout(d time.Duration) DialerOption
type IPConn ¶
type IPConn interface {
Close() error
File() (f *os.File, err error)
LocalAddr() Addr
Read(b []byte) (int, error)
ReadFrom(b []byte) (int, Addr, error)
ReadFromIP(b []byte) (int, *IPAddr, error)
ReadMsgIP(b, oob []byte) (n, oobn, flags int, addr *IPAddr, err error)
RemoteAddr() Addr
SetDeadline(t time.Time) error
SetReadBuffer(bytes int) error
SetReadDeadline(t time.Time) error
SetWriteBuffer(bytes int) error
SetWriteDeadline(t time.Time) error
SyscallConn() (syscall.RawConn, error)
Write(b []byte) (int, error)
WriteMsgIP(b, oob []byte, addr *IPAddr) (n, oobn int, err error)
WriteTo(b []byte, addr Addr) (int, error)
WriteToIP(b []byte, addr *IPAddr) (int, error)
}
type InvalidAddrError ¶
type InvalidAddrError = net.InvalidAddrError
type KeepAliveConfig ¶
type KeepAliveConfig = net.KeepAliveConfig
type ListenConfig ¶
type ListenConfigOption ¶
type ListenConfigOption func(*net.ListenConfig)
func WithControlLC ¶
func WithKeepAliveConfigLC ¶
func WithKeepAliveConfigLC(kac KeepAliveConfig) ListenConfigOption
func WithKeepAliveLC ¶
func WithKeepAliveLC(d time.Duration) ListenConfigOption
type Net ¶
type Net interface {
JoinHostPort(host, port string) string
LookupAddr(addr string) (names []string, err error)
LookupCNAME(host string) (cname string, err error)
LookupHost(host string) (addrs []string, err error)
LookupPort(network, service string) (port int, err error)
LookupTXT(name string) ([]string, error)
ParseCIDR(s string) (IP, *IPNet, error)
Pipe() (Conn, Conn)
SplitHostPort(hostport string) (host, port string, err error)
// Constructors:
InterfaceAddrs() ([]Addr, error)
Dial(network, address string) (Conn, error)
DialTimeout(network, address string, timeout time.Duration) (Conn, error)
FileConn(f *os.File) (Conn, error)
IPv4(a, b, c, d byte) IP
LookupIP(host string) ([]IP, error)
ParseIP(s string) IP
ResolveIPAddr(network, address string) (*IPAddr, error)
DialIP(network string, laddr, raddr *IPAddr) (IPConn, error)
ListenIP(network string, laddr *IPAddr) (IPConn, error)
CIDRMask(ones, bits int) IPMask
IPv4Mask(a, b, c, d byte) IPMask
InterfaceByIndex(index int) (*Interface, error)
InterfaceByName(name string) (*Interface, error)
Interfaces() ([]Interface, error)
FileListener(f *os.File) (Listener, error)
Listen(network, address string) (Listener, error)
LookupMX(name string) ([]*MX, error)
LookupNS(name string) ([]*NS, error)
FilePacketConn(f *os.File) (PacketConn, error)
ListenPacket(network, address string) (PacketConn, error)
LookupSRV(service, proto, name string) (string, []*SRV, error)
ResolveTCPAddr(network, address string) (*TCPAddr, error)
TCPAddrFromAddrPort(addr netip.AddrPort) *TCPAddr
DialTCP(network string, laddr, raddr *TCPAddr) (TCPConn, error)
ListenTCP(network string, laddr *TCPAddr) (TCPListener, error)
ResolveUDPAddr(network, address string) (*UDPAddr, error)
DialUDP(network string, laddr, raddr *UDPAddr) (UDPConn, error)
ListenMulticastUDP(network string, ifi *Interface, gaddr *UDPAddr) (UDPConn, error)
ListenUDP(network string, laddr *UDPAddr) (UDPConn, error)
ResolveUnixAddr(network, address string) (*UnixAddr, error)
DialUnix(network string, laddr, raddr *UnixAddr) (UnixConn, error)
ListenUnixgram(network string, laddr *UnixAddr) (UnixConn, error)
ListenUnix(network string, laddr *UnixAddr) (UnixListener, error)
NewDialer(options ...DialerOption) Dialer
NewListenConfig(options ...ListenConfigOption) ListenConfig
NewResolver(options ...ResolverOption) Resolver
}
type PacketConn ¶
type PacketConn = net.PacketConn
type ParseError ¶
type ParseError = net.ParseError
type Resolver ¶
type Resolver interface {
LookupAddr(ctx context.Context, addr string) ([]string, error)
LookupCNAME(ctx context.Context, host string) (string, error)
LookupHost(ctx context.Context, host string) (addrs []string, err error)
LookupIP(ctx context.Context, network, host string) ([]IP, error)
LookupIPAddr(ctx context.Context, host string) ([]IPAddr, error)
LookupMX(ctx context.Context, name string) ([]*MX, error)
LookupNS(ctx context.Context, name string) ([]*NS, error)
LookupNetIP(ctx context.Context, network, host string) ([]netip.Addr, error)
LookupPort(ctx context.Context, network, service string) (port int, err error)
LookupSRV(ctx context.Context, service, port, name string) (string, []*SRV, error)
LookupTXT(ctx context.Context, name string) ([]string, error)
GetUnderlyingResolver() *net.Resolver
}
type ResolverOption ¶
func WithDialFunc ¶
func WithPreferGo ¶
func WithPreferGo() ResolverOption
func WithStrictErrors ¶
func WithStrictErrors() ResolverOption
type TCPConn ¶
type TCPConn interface {
Close() error
CloseRead() error
CloseWrite() error
File() (*os.File, error)
LocalAddr() Addr
MultipathTCP() (bool, error)
Read(b []byte) (int, error)
ReadFrom(r io.Reader) (int64, error)
RemoteAddr() Addr
SetDeadline(t time.Time) error
SetKeepAlive(keepalive bool) error
SetKeepAliveConfig(config KeepAliveConfig) error
SetKeepAlivePeriod(d time.Duration) error
SetLinger(sec int) error
SetNoDelay(noDelay bool) error
SetReadBuffer(bytes int) error
SetReadDeadline(t time.Time) error
SetWriteBuffer(bytes int) error
SetWriteDeadline(t time.Time) error
SyscallConn() (syscall.RawConn, error)
Write(b []byte) (int, error)
WriteTo(w io.Writer) (int64, error)
}
type TCPListener ¶
type UDPConn ¶
type UDPConn interface {
Close() error
File() (*os.File, error)
LocalAddr() Addr
Read(b []byte) (int, error)
ReadFrom(b []byte) (int, Addr, error)
ReadFromUDP(b []byte) (int, *UDPAddr, error)
ReadFromUDPAddrPort(b []byte) (int, netip.AddrPort, error)
ReadMsgUDP(b, oob []byte) (n, oobn, flags int, addr *UDPAddr, err error)
ReadMsgUDPAddrPort(b, oob []byte) (n, oobn, flags int, addr netip.AddrPort, err error)
RemoteAddr() Addr
SetDeadline(t time.Time) error
SetReadBuffer(bytes int) error
SetReadDeadline(t time.Time) error
SetWriteBuffer(bytes int) error
SetWriteDeadline(t time.Time) error
SyscallConn() (syscall.RawConn, error)
Write(b []byte) (int, error)
WriteMsgUDP(b, oob []byte, addr *UDPAddr) (n, oobn int, err error)
WriteMsgUDPAddrPort(b, oob []byte, addr netip.AddrPort) (n, oobn int, err error)
WriteTo(b []byte, addr Addr) (int, error)
WriteToUDP(b []byte, addr *UDPAddr) (int, error)
WriteToUDPAddrPort(b []byte, addr netip.AddrPort) (int, error)
}
type UnixConn ¶
type UnixConn interface {
Close() error
CloseRead() error
CloseWrite() error
File() (*os.File, error)
LocalAddr() Addr
Read(b []byte) (int, error)
ReadFrom(b []byte) (int, Addr, error)
ReadFromUnix(b []byte) (int, *UnixAddr, error)
ReadMsgUnix(b, oob []byte) (n, oobn, flags int, addr *UnixAddr, err error)
RemoteAddr() Addr
SetDeadline(t time.Time) error
SetReadBuffer(bytes int) error
SetReadDeadline(t time.Time) error
SetWriteBuffer(bytes int) error
SetWriteDeadline(t time.Time) error
SyscallConn() (syscall.RawConn, error)
Write(b []byte) (int, error)
WriteMsgUnix(b, oob []byte, addr *UnixAddr) (n, oobn int, err error)
WriteTo(b []byte, addr Addr) (int, error)
WriteToUnix(b []byte, addr *UnixAddr) (int, error)
}
type UnixListener ¶
type UnknownNetworkError ¶
type UnknownNetworkError = net.UnknownNetworkError
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
http
|
|
|
client
This package provides an interface to functions and structs in the standard net/http package when using it as an http client to facilitate mocking.
|
This package provides an interface to functions and structs in the standard net/http package when using it as an http client to facilitate mocking. |
|
server
This package provides an interface to functions and structs in the standard net/http package used for servers to facilitate mocking.
|
This package provides an interface to functions and structs in the standard net/http package used for servers to facilitate mocking. |
Click to show internal directories.
Click to hide internal directories.