natdiscovery

package
v0.22.1 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RecheckTime                    = (2 * time.Second).Nanoseconds()
	TotalTimeout                   = (60 * time.Second).Nanoseconds()
	TotalTimeoutLoadBalancer       = (6 * time.Second).Nanoseconds()
	PublicToPrivateFailoverTimeout = time.Second.Nanoseconds()
)

Functions

func ToDuration added in v0.21.0

func ToDuration(v *int64) time.Duration

Types

type Config added in v0.21.0

type Config struct {
	LocalEndpoint *endpoint.Local

	// These are hooks to allow unit tests to mock behavior.
	CreateServerConnection CreateServerConnectionFn
	FindSourceIP           FindSrcIPFunction
	RunLoop                func(stopCh <-chan struct{}, doCheck func())
}

type CreateServerConnectionFn added in v0.21.0

type CreateServerConnectionFn func(port int32, family k8snet.IPFamily) (ServerConnection, error)

type FindSrcIPFunction added in v0.21.0

type FindSrcIPFunction func(destinationIP string, family k8snet.IPFamily) string

type Interface

type Interface interface {
	Run(stopCh <-chan struct{}) error
	AddEndpoint(endpoint *v1.Endpoint, family k8snet.IPFamily)
	RemoveEndpoint(endpointName string)
	GetReadyChannel() chan *NATEndpointInfo
}

func New

func New(localEndpoint *endpoint.Local) (Interface, error)

func NewWithConfig added in v0.21.0

func NewWithConfig(config Config) (Interface, error)

type NATEndpointInfo

type NATEndpointInfo struct {
	Endpoint  v1.Endpoint
	UseNAT    bool
	UseIP     string
	UseFamily k8snet.IPFamily
}

type ServerConnection added in v0.21.0

type ServerConnection interface {
	Close() error
	ReadFromUDP(b []byte) (int, *net.UDPAddr, error)
	WriteToUDP(b []byte, addr *net.UDPAddr) (int, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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