net

package
v0.3.22 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2025 License: MIT Imports: 5 Imported by: 1

Documentation

Overview

Package net implements the functions, types, and interfaces for the module.

Index

Constants

View Source
const (
	IPv4len = net.IPv4len
	IPv6len = net.IPv6len
)

Variables

This section is empty.

Functions

func HostAddr

func HostAddr(provider NetworkInterfaceProvider, opts ...Option) string

HostAddr now accepts a NetworkInterfaceProvider.

func ParseIP

func ParseIP(ip IP) int64

func RealHostAddr added in v0.3.22

func RealHostAddr(opts ...Option) string

RealHostAddr is a convenience function for external callers to use the real network provider.

Types

type HostConfig added in v0.0.20

type HostConfig struct {
	// contains filtered or unexported fields
}

HostConfig defines the configuration for the host.

func DefaultConfig added in v0.3.21

func DefaultConfig() HostConfig

type IP

type IP = net.IP

func IPv4

func IPv4(a, b, c, d byte) IP

func ToIP

func ToIP(ip int64) IP

type InterfaceWithAddrs added in v0.3.21

type InterfaceWithAddrs interface {
	GetInterface() net.Interface
	GetAddrs() ([]net.Addr, error)
}

InterfaceWithAddrs abstracts a network interface and its addresses for mocking.

type NetworkInterfaceProvider added in v0.3.22

type NetworkInterfaceProvider interface {
	Interfaces() ([]InterfaceWithAddrs, error)
}

NetworkInterfaceProvider now returns InterfaceWithAddrs.

type Option added in v0.0.20

type Option = func(*HostConfig)

func WithCIDRFilters added in v0.0.20

func WithCIDRFilters(cidrs []string) Option

func WithEnvVar added in v0.0.20

func WithEnvVar(name string) Option

func WithFallback added in v0.0.20

func WithFallback(enable bool) Option

func WithInterfacePatterns added in v0.0.20

func WithInterfacePatterns(patterns []string) Option

Directories

Path Synopsis
Package filter implements the functions, types, and interfaces for the module.
Package filter implements the functions, types, and interfaces for the module.

Jump to

Keyboard shortcuts

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