networking

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// PeerConnectionCheckInterval - time interval to check peer connection status
	PeerConnectionCheckInterval = time.Second * 15
	// LastHandShakeThreshold - threshold for considering inactive connection
	LastHandShakeThreshold = time.Minute * 3
	//
	PeerLocalEndpointConnTicker *time.Ticker
)

Functions

func CheckPeerEndpoints added in v1.2.0

func CheckPeerEndpoints(ctx context.Context, waitg *sync.WaitGroup)

func ClearPeerInfoCache added in v1.5.1

func ClearPeerInfoCache()

ClearPeerInfoCache resets the peer info cache so the next refresh fetches fresh data.

func FindBestEndpoint

func FindBestEndpoint(peerIp, peerPubKey string, peerListenPort, metricsPort int)

FindBestEndpoint - requests against a given addr and port

func GetPeerInfo added in v1.2.0

func GetPeerInfo() (models.HostPeerInfo, error)

GetPeerInfo returns cached HostPeerInfo. If cache is empty, fetches from server and populates it.

func InitialiseIfaceMetricsServer added in v0.90.0

func InitialiseIfaceMetricsServer(ctx context.Context, wg *sync.WaitGroup)

func IpBelongsToInterface added in v0.90.0

func IpBelongsToInterface(ip net.IP) bool

IpBelongsToInterface - function to check if an IP belongs to any network interface

func IsPeerConnected added in v1.2.0

func IsPeerConnected(peer wgtypes.Peer) (connected bool, err error)

isPeerConnected - get peer connection status by checking last handshake time

func RefreshPeerInfoCache added in v1.5.1

func RefreshPeerInfoCache()

RefreshPeerInfoCache fetches fresh peer info from the server and updates the cache. Uses a dedicated mutex to serialize callers and enforce a minimum interval between attempts.

func SetPeerEndpoint added in v1.0.0

func SetPeerEndpoint(peerPubKey string, value cache.EndpointCacheValue) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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