Documentation
¶
Overview ¶
Package reject provides a network implementation that rejects all operations with canonical errors. It implements the gonnect.Network, gonnect.InterfaceNetwork, and gonnect.Resolver interfaces, returning appropriate errors for all methods.
Index ¶
- type Network
- func (n *Network) Dial(ctx context.Context, network, address string) (net.Conn, error)
- func (n *Network) DialTCP(ctx context.Context, network, laddr, raddr string) (gonnect.TCPConn, error)
- func (n *Network) DialUDP(ctx context.Context, network, laddr, raddr string) (gonnect.UDPConn, error)
- func (n *Network) InterfaceAddrs() ([]net.Addr, error)
- func (n *Network) Interfaces() ([]gonnect.NetworkInterface, error)
- func (n *Network) InterfacesByIndex(index int) ([]gonnect.NetworkInterface, error)
- func (n *Network) InterfacesByName(name string) ([]gonnect.NetworkInterface, error)
- func (n *Network) IsNative() bool
- func (n *Network) Listen(ctx context.Context, network, address string) (net.Listener, error)
- func (n *Network) ListenPacket(ctx context.Context, network, address string) (gonnect.PacketConn, error)
- func (n *Network) ListenTCP(ctx context.Context, network, laddr string) (gonnect.TCPListener, error)
- func (n *Network) ListenUDP(ctx context.Context, network, laddr string) (gonnect.UDPConn, error)
- func (n *Network) LookupAddr(ctx context.Context, addr string) ([]string, error)
- func (n *Network) LookupCNAME(ctx context.Context, host string) (string, error)
- func (n *Network) LookupHost(ctx context.Context, host string) ([]string, error)
- func (n *Network) LookupIP(ctx context.Context, network, address string) ([]net.IP, error)
- func (n *Network) LookupIPAddr(ctx context.Context, host string) ([]net.IPAddr, error)
- func (n *Network) LookupMX(ctx context.Context, name string) ([]*net.MX, error)
- func (n *Network) LookupNS(ctx context.Context, name string) ([]*net.NS, error)
- func (n *Network) LookupNetIP(ctx context.Context, network, host string) ([]netip.Addr, error)
- func (n *Network) LookupPort(ctx context.Context, network, service string) (int, error)
- func (n *Network) LookupSRV(ctx context.Context, service, proto, name string) (string, []*net.SRV, error)
- func (n *Network) LookupTXT(ctx context.Context, name string) ([]string, error)
- func (n *Network) PacketDial(ctx context.Context, network, address string) (gonnect.PacketConn, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Network ¶
type Network struct{}
Network is a network implementation that rejects all operations with canonical errors. It implements gonnect.Network, gonnect.InterfaceNetwork, and gonnect.Resolver interfaces.
func (*Network) DialTCP ¶
func (n *Network) DialTCP( ctx context.Context, network, laddr, raddr string, ) (gonnect.TCPConn, error)
DialTCP returns an appropriate error based on the network and address.
func (*Network) DialUDP ¶
func (n *Network) DialUDP( ctx context.Context, network, laddr, raddr string, ) (gonnect.UDPConn, error)
DialUDP returns an appropriate error based on the network and address.
func (*Network) InterfaceAddrs ¶
InterfaceAddrs returns an empty slice and nil error.
func (*Network) Interfaces ¶
func (n *Network) Interfaces() ([]gonnect.NetworkInterface, error)
Interfaces returns an empty slice and nil error.
func (*Network) InterfacesByIndex ¶
func (n *Network) InterfacesByIndex( index int, ) ([]gonnect.NetworkInterface, error)
InterfacesByIndex returns an empty slice and "interface not found" error.
func (*Network) InterfacesByName ¶
func (n *Network) InterfacesByName( name string, ) ([]gonnect.NetworkInterface, error)
InterfacesByName returns an empty slice and "interface not found" error.
func (*Network) ListenPacket ¶
func (n *Network) ListenPacket( ctx context.Context, network, address string, ) (gonnect.PacketConn, error)
ListenPacket returns an appropriate error based on the network and address.
func (*Network) ListenTCP ¶
func (n *Network) ListenTCP( ctx context.Context, network, laddr string, ) (gonnect.TCPListener, error)
ListenTCP returns an appropriate error based on the network and address.
func (*Network) ListenUDP ¶
ListenUDP returns an appropriate error based on the network and address.
func (*Network) LookupAddr ¶
LookupAddr returns a NoSuchHost error.
func (*Network) LookupCNAME ¶
LookupCNAME returns a NoSuchHost error.
func (*Network) LookupHost ¶
LookupHost returns a NoSuchHost error.
func (*Network) LookupIPAddr ¶
LookupIPAddr returns a NoSuchHost error.
func (*Network) LookupNetIP ¶
LookupNetIP returns a NoSuchHost error.
func (*Network) LookupPort ¶
LookupPort returns a NoSuchHost error for the service.
func (*Network) LookupSRV ¶
func (n *Network) LookupSRV( ctx context.Context, service, proto, name string, ) (string, []*net.SRV, error)
LookupSRV returns a NoSuchHost error.
func (*Network) PacketDial ¶ added in v0.4.0
func (n *Network) PacketDial( ctx context.Context, network, address string, ) (gonnect.PacketConn, error)
PacketDial returns an appropriate error based on the network and address.