netplane

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: Apache-2.0 Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package netplane connects the emulator process to the container networks it creates (Section 3.3). Every container the emulator runs is attached to an internal "services" network on which the emulator's own endpoints (gateway, metadata, DNS, registry, ...) are reachable at the network's gateway address through forwarders, and optionally to an "external" network that provides internet egress (public IPs).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains(cidr, ip string) bool

Contains reports whether ip lies inside cidr.

func HostPort

func HostPort(addr string) (string, int)

HostPort splits "ip:port" into its parts with a numeric port.

Types

type Net

type Net struct {
	// Name is the runtime network name.
	Name string
	// Subnet is the IPv4 CIDR.
	Subnet string
	// Gateway is the host-side address on the network.
	Gateway string
}

Net describes a container network.

type Plane

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

Plane manages the services and external networks of one instance.

func New

func New(rt *runtime.Manager, endpoints func() map[string]string, log *slog.Logger) *Plane

New returns a plane. endpoints returns the current host endpoint map (name → host:port), as recorded by emu.Endpoints.

func (*Plane) Addr

func (p *Plane) Addr(ctx context.Context, name string) (string, error)

Addr returns the address at which containers on the services network reach the named emulator endpoint ("gateway", "metadata", "dns", "ar", ...), starting a forwarder on the services gateway if needed. The port is the same as the host endpoint's when it is free.

func (*Plane) Close

func (p *Plane) Close()

Close stops all forwarders. Networks are left to runtime cleanup.

func (*Plane) External

func (p *Plane) External(ctx context.Context) (Net, error)

External returns the external (egress-capable) network, creating it on first use.

func (*Plane) Runtime

func (p *Plane) Runtime() *runtime.Manager

Runtime returns the runtime manager.

func (*Plane) Services

func (p *Plane) Services(ctx context.Context) (Net, error)

Services returns the internal services network, creating it on first use.

Jump to

Keyboard shortcuts

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