network

package
v0.0.0-...-5fb8a3f Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2024 License: Apache-2.0 Imports: 31 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[*Status]
	// 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) *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

type Status

type Status struct {
	ExternalAddress net.IP
}

Status is the current network status of the host. It will be updated by the network Service whenever the node's network configuration changes. Spurious changes might occur, consumers should ensure that the change that occured is meaningful to them.

Directories

Path Synopsis
Package dhcp4c implements a DHCPv4 Client as specified in RFC2131 (with some notable deviations).
Package dhcp4c implements a DHCPv4 Client as specified in RFC2131 (with some notable deviations).
callback
Package callback contains minimal callbacks for configuring the kernel with options received over DHCP.
Package callback contains minimal callbacks for configuring the kernel with options received over DHCP.
transport
Package transport contains Linux-based transports for the DHCP broadcast and unicast specifications.
Package transport contains Linux-based transports for the DHCP broadcast and unicast specifications.
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:

Jump to

Keyboard shortcuts

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