netutil

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrLocalTunnelNotFound = errors.New("no local tunnel found")
)
View Source
var (
	ErrNoMatchingInterface = errors.New("no matching /31 interface found")
)

Functions

This section is empty.

Types

type Interface

type Interface struct {
	Name  string
	Addrs []net.Addr
}

type LocalNet

type LocalNet interface {
	Interfaces() ([]Interface, error)
}

func NewLocalNet

func NewLocalNet(log *slog.Logger) LocalNet

type LocalTunnel

type LocalTunnel struct {
	Interface string
	SourceIP  net.IP
	TargetIP  net.IP
}

func FindLocalTunnel

func FindLocalTunnel(interfaces []Interface, tunnelNet *net.IPNet) (*LocalTunnel, error)

type MockLocalNet

type MockLocalNet struct {
	InterfacesFunc func() ([]Interface, error)
}

func (*MockLocalNet) Interfaces

func (m *MockLocalNet) Interfaces() ([]Interface, error)

Jump to

Keyboard shortcuts

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