advertise

package
v0.0.0-...-d90da2b Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Overview

Package advertise provide utilities to find addresses to advertise to cluster peers.

Index

Constants

This section is empty.

Variables

View Source
var DefaultInterfaces = []string{"eth0", "en0"}

DefaultInterfaces is a default list of common interfaces that are used for local network traffic for Unix-like platforms.

Functions

func FirstAddress

func FirstAddress(interfaces []string) (netip.Addr, error)

FirstAddress returns the "best" IP address from the given interface names. "best" is defined as follow in decreasing order: - IPv4 valid and not link-local unicast - IPv6 valid and not link-local unicast - IPv4 valid and link-local unicast - IPv6 valid and link-local unicast If none of the above are found, an invalid address is returned. Loopback addresses are never selected. If no interfaces are provided, all of the system's network interfaces will retrieved via net.Interfaces and used to find the "best" ip address.

Types

This section is empty.

Jump to

Keyboard shortcuts

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