reject

package
v0.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 3, 2026 License: CC0-1.0 Imports: 5 Imported by: 0

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

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) Dial

func (n *Network) Dial(
	ctx context.Context,
	network, address string,
) (net.Conn, error)

Dial returns an appropriate error based on the network and address.

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

func (n *Network) InterfaceAddrs() ([]net.Addr, error)

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) IsNative added in v0.7.1

func (n *Network) IsNative() bool

func (*Network) Listen

func (n *Network) Listen(
	ctx context.Context,
	network, address string,
) (net.Listener, error)

Listen returns an appropriate error based on the network and address.

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

func (n *Network) ListenUDP(
	ctx context.Context,
	network, laddr string,
) (gonnect.UDPConn, error)

ListenUDP returns an appropriate error based on the network and address.

func (*Network) LookupAddr

func (n *Network) LookupAddr(
	ctx context.Context,
	addr string,
) ([]string, error)

LookupAddr returns a NoSuchHost error.

func (*Network) LookupCNAME

func (n *Network) LookupCNAME(
	ctx context.Context,
	host string,
) (string, error)

LookupCNAME returns a NoSuchHost error.

func (*Network) LookupHost

func (n *Network) LookupHost(
	ctx context.Context,
	host string,
) ([]string, error)

LookupHost returns a NoSuchHost error.

func (*Network) LookupIP

func (n *Network) LookupIP(
	ctx context.Context,
	network, address string,
) ([]net.IP, error)

LookupIP returns a NoSuchHost error.

func (*Network) LookupIPAddr

func (n *Network) LookupIPAddr(
	ctx context.Context,
	host string,
) ([]net.IPAddr, error)

LookupIPAddr returns a NoSuchHost error.

func (*Network) LookupMX

func (n *Network) LookupMX(
	ctx context.Context,
	name string,
) ([]*net.MX, error)

LookupMX returns a NoSuchHost error.

func (*Network) LookupNS

func (n *Network) LookupNS(
	ctx context.Context,
	name string,
) ([]*net.NS, error)

LookupNS returns a NoSuchHost error.

func (*Network) LookupNetIP

func (n *Network) LookupNetIP(
	ctx context.Context,
	network, host string,
) ([]netip.Addr, error)

LookupNetIP returns a NoSuchHost error.

func (*Network) LookupPort

func (n *Network) LookupPort(
	ctx context.Context,
	network, service string,
) (int, error)

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) LookupTXT

func (n *Network) LookupTXT(
	ctx context.Context,
	name string,
) ([]string, error)

LookupTXT 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL