multihost

package
v0.0.0-...-99b537f Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2024 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MH

type MH struct {
	sync.RWMutex // protects names and addrs
	// contains filtered or unexported fields
}

MH is a list of hostnames and/or ip addresses for one endpoint.

func New

func New(id string) *MH

New returns a new multihost with the given id.

func (*MH) Add

func (h *MH) Add(domainsOrIps []string) int

Add appends the list of IPs, hostnames, and hostname's IPs as resolved. It returns the total number of IPs. Removes duplicates.

func (*MH) Addrs

func (h *MH) Addrs() []netip.AddrPort

Returns ip:port, where ports may be 0.

func (*MH) EqualAddrs

func (h *MH) EqualAddrs(other *MH) bool

func (*MH) Len

func (h *MH) Len() int

func (*MH) Names

func (h *MH) Names() []string

Names returns the list of hostnames or host:ports.

func (*MH) PreferredAddr

func (h *MH) PreferredAddr() netip.AddrPort

prefers v4; see: github.com/WireGuard/wireguard-android/blob/4ba87947a/tunnel/src/main/java/com/wireguard/config/InetEndpoint.java#L97

func (*MH) PreferredAddrs

func (h *MH) PreferredAddrs() []netip.AddrPort

PreferredAddrs returns the list of IPs per the dialer's preference.

func (*MH) Refresh

func (h *MH) Refresh() int

Refresh re-adds the list of IPs, hostnames, and re-resolves the hostname. It returns the total number of IPs.

func (*MH) String

func (h *MH) String() string

Jump to

Keyboard shortcuts

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