peerexchange

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package peerexchange orchestrates peer endpoint exchange for plexd mesh nodes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	nat.Config
}

Config holds the configuration for peer endpoint exchange. It embeds nat.Config to reuse NAT traversal settings.

func (*Config) ApplyDefaults

func (c *Config) ApplyDefaults()

ApplyDefaults sets default values for zero-valued fields.

func (*Config) Validate

func (c *Config) Validate() error

Validate checks that configuration values are within acceptable ranges.

type Exchanger

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

Exchanger orchestrates peer endpoint exchange: STUN discovery and control plane reporting.

func NewExchanger

func NewExchanger(discoverer *nat.Discoverer, cpClient *api.ControlPlane, cfg Config, logger *slog.Logger) *Exchanger

NewExchanger creates a new Exchanger.

func (*Exchanger) LastResult

func (e *Exchanger) LastResult() *nat.DiscoveryResult

LastResult returns the most recently discovered NAT info.

func (*Exchanger) Run

func (e *Exchanger) Run(ctx context.Context, nodeID string) error

Run starts the endpoint exchange loop. If NAT is disabled, it returns nil immediately. Otherwise, it delegates to nat.Discoverer.Run. It blocks until ctx is cancelled.

Jump to

Keyboard shortcuts

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