network

package
v0.0.0-...-0f8ce4c Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2025 License: Apache-2.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

type Service struct {
	// If set, use the given static network configuration instead of relying on
	// autoconfiguration.
	StaticConfig *netpb.Net

	// Vendor Class identifier of the system
	DHCPVendorClassID string

	DNS *dns.Service

	// Status is the current status of the network as seen by the service.
	Status memory.Value[*node.NetStatus]
	// contains filtered or unexported fields
}

Service is the network service for this node. It maintains all networking-related functionality, but is generally not aware of the inner workings of Metropolis, instead functioning in a generic manner. Once created via New, it can be started and restarted arbitrarily, but the service object itself must be long-lived.

func New

func New(staticConfig *netpb.Net, dnsHandlerNames []string, ipamPrefixSrc event.Value[*ipam.Prefixes]) *Service

New instantiates a new network service. If autoconfiguration is desired, staticConfig must be set to nil. If staticConfig is set to a non-nil value, it will be used instead of autoconfiguration. If dnsHandlerNames is non-nil, DNS handlers with these names must be set on the DNS service with s.DNS.SetHandler. When serving DNS queries, they will be tried in the order they appear here before forwarding.

func (*Service) AddLoopbackIP

func (s *Service) AddLoopbackIP(ip net.IP) error

AddLoopbackIP adds the given IP to a loopback interface which can then be used to bind listeners to. Once this function returns, the IP is assigned and is ready to use. It's recommended to use defer to call ReleaseLoopbackIP to make sure IPs are released when the goroutine using it exits.

func (*Service) ReleaseLoopbackIP

func (s *Service) ReleaseLoopbackIP(ip net.IP) error

ReleaseLoopbackIP releases an IP allocated by AddLoopbackIP. Calling it multiple times for the same IP is an error.

func (*Service) Run

func (s *Service) Run(ctx context.Context) error

Directories

Path Synopsis
Package hostsfile implements a service which owns and writes all node-local files/interfaces used by the system to resolve the local node's name and the names of other nodes in the cluster:
Package hostsfile implements a service which owns and writes all node-local files/interfaces used by the system to resolve the local node's name and the names of other nodes in the cluster:
Package ipam is just a stub right now which contains a type for describing prefix lists.
Package ipam is just a stub right now which contains a type for describing prefix lists.
Package overlay implements a Cluster Networking mesh service running on all Metropolis nodes.
Package overlay implements a Cluster Networking mesh service running on all Metropolis nodes.

Jump to

Keyboard shortcuts

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