meshimport

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IssueInvalidSnapshot            = "invalid_snapshot"
	IssueInvalidCA                  = "invalid_ca"
	IssueCAFingerprintMismatch      = "ca_fingerprint_mismatch"
	IssueCACertificateExpired       = "ca_certificate_expired"
	IssueCACertificateNearExpiry    = "ca_certificate_near_expiry"
	IssueInvalidHostCertificate     = "invalid_host_certificate"
	IssueInvalidHostAddresses       = "invalid_host_addresses"
	IssueInvalidUnsafeNetworks      = "invalid_unsafe_networks"
	IssueHostCertificateExpired     = "host_certificate_expired"
	IssueHostCertificateNotYetValid = "host_certificate_not_yet_valid"
	IssueHostCertificateNearExpiry  = "host_certificate_near_expiry"
	IssueConfigNameMismatch         = "config_name_mismatch"
	IssueAddressOutsideNetwork      = "address_outside_network"
	IssueDuplicateOverlayAddress    = "duplicate_overlay_address"
	IssueEndpointConflict           = "endpoint_conflict"
	IssueInvalidEndpoint            = "invalid_endpoint"
	IssueUnknownStaticHost          = "unknown_static_host"
	IssueUnresolvedLighthouse       = "unresolved_lighthouse"
	IssueUnresolvedRelay            = "unresolved_relay"
	IssueMissingRoleEndpoint        = "missing_role_endpoint"
	IssueDivergentFirewall          = "divergent_firewall"
	IssueInvalidFirewall            = "invalid_firewall"
	IssueInvalidAdvanced            = "invalid_advanced"
	IssueDivergentBlocklist         = "divergent_blocklist"
	IssueInvalidBlocklist           = "invalid_blocklist"
	IssueExtraCARoot                = "extra_ca_root"
	IssueUnsupportedConfigKey       = "unsupported_config_key"
	IssueInvalidNetworkCIDR         = "invalid_network_cidr"
)

Variables

View Source
var (
	ErrSnapshotTooLarge = errors.New("mesh import snapshot is too large")
	ErrInvalidAgentPath = errors.New("invalid Nebula agent path")
)

Functions

func ValidateSnapshot

func ValidateSnapshot(snapshot Snapshot, limits Limits) error

func WarningAcknowledgementKey

func WarningAcknowledgementKey(issue Issue) string

WarningAcknowledgementKey is a stable opaque identifier for one exact warning. A changed preview therefore invalidates acknowledgements naturally.

Types

type AgentProfile

type AgentProfile = models.AgentProfile

type ConfigSnapshot

type ConfigSnapshot struct {
	ReportedName       string              `json:"reported_name,omitempty"`
	CARootFingerprints []string            `json:"ca_root_fingerprints,omitempty"`
	Blocklist          []string            `json:"blocklist,omitempty"`
	StaticHostMap      map[string][]string `json:"static_host_map,omitempty"`
	LighthouseHosts    []string            `json:"lighthouse_hosts,omitempty"`
	Relays             []string            `json:"relays,omitempty"`
	AmLighthouse       bool                `json:"am_lighthouse,omitempty"`
	AmRelay            bool                `json:"am_relay,omitempty"`
	ListenHost         string              `json:"listen_host,omitempty"`
	ListenPort         int                 `json:"listen_port,omitempty"`
	Punchy             *bool               `json:"punchy,omitempty"`
	PunchyRespond      *bool               `json:"punchy_respond,omitempty"`
	MTU                int                 `json:"mtu,omitempty"`
	TunDevice          string              `json:"tun_device,omitempty"`
	UnsafeRoutes       []UnsafeRoute       `json:"unsafe_routes,omitempty"`
	Firewall           FirewallPolicy      `json:"firewall"`
	UnsupportedKeys    []string            `json:"unsupported_keys,omitempty"`
}

type FirewallPolicy

type FirewallPolicy struct {
	Inbound  []FirewallRule `json:"inbound"`
	Outbound []FirewallRule `json:"outbound"`
}

type FirewallRule

type FirewallRule struct {
	Port      string `json:"port"`
	Proto     string `json:"proto"`
	Group     string `json:"group"`
	Cidr      string `json:"cidr,omitempty"`
	LocalCidr string `json:"local_cidr,omitempty"`
}

type HostProposal

type HostProposal struct {
	SnapshotID string       `json:"snapshot_id"`
	Profile    AgentProfile `json:"profile"`
	Host       models.Host  `json:"host"`
}

type Issue

type Issue struct {
	Code       string `json:"code"`
	SnapshotID string `json:"snapshot_id,omitempty"`
	HostName   string `json:"host_name,omitempty"`
	Field      string `json:"field,omitempty"`
	Message    string `json:"message"`
}

type Limits

type Limits struct {
	MaxSnapshotBytes int
	MaxPathBytes     int
}

type PreviewInput

type PreviewInput struct {
	Session   *models.MeshImport
	Network   *models.Network
	CA        *models.CA
	Snapshots []*models.MeshImportSnapshot
	Now       time.Time
}

type Proposal

type Proposal struct {
	Hosts     []HostProposal `json:"hosts"`
	Firewall  FirewallPolicy `json:"firewall"`
	Blocklist []string       `json:"blocklist"`
}

type ReconcileInput

type ReconcileInput struct {
	NetworkID        string
	CAID             string
	NetworkCIDRs     []string
	CACertificatePEM string
	CAFingerprint    string
	Snapshots        []Snapshot
	Now              time.Time
	NearExpiryWindow time.Duration
	ValidationLimits Limits
}

type Report

type Report struct {
	Blockers []Issue  `json:"blockers"`
	Warnings []Issue  `json:"warnings"`
	Proposal Proposal `json:"proposal"`
}

func BuildPreview

func BuildPreview(input PreviewInput) Report

BuildPreview decodes stored discovery payloads and reconciles them against the normalized session scope. Database columns remain authoritative for all identity fields; an agent-supplied JSON payload cannot choose its row ids.

func Reconcile

func Reconcile(input ReconcileInput) Report

type Snapshot

type Snapshot struct {
	ID             string         `json:"id"`
	HostID         string         `json:"host_id"`
	CertificatePEM string         `json:"certificate_pem"`
	Profile        AgentProfile   `json:"profile"`
	Config         ConfigSnapshot `json:"config"`
}

type UnsafeRoute

type UnsafeRoute struct {
	Route string `json:"route"`
	Via   string `json:"via"`
}

Jump to

Keyboard shortcuts

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