tsaddr

package
v1.20.1 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2022 License: BSD-3-Clause Imports: 2 Imported by: 65

Documentation

Overview

Package tsaddr handles Tailscale-specific IPs and ranges.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CGNATRange

func CGNATRange() netaddr.IPPrefix

CGNATRange returns the Carrier Grade NAT address range that is the superset range that Tailscale assigns out of. See https://tailscale.com/kb/1015/100.x-addresses. Note that Tailscale does not assign out of the ChromeOSVMRange.

func ChromeOSVMRange

func ChromeOSVMRange() netaddr.IPPrefix

ChromeOSVMRange returns the subset of the CGNAT IPv4 range used by ChromeOS to interconnect the host OS to containers and VMs. We avoid allocating Tailscale IPs from it, to avoid conflicts.

func IPsContainsFunc added in v1.16.0

func IPsContainsFunc(ips []netaddr.IP, f func(netaddr.IP) bool) bool

IPsContainsFunc reports whether f is true for any IP in ips.

func IsTailscaleIP

func IsTailscaleIP(ip netaddr.IP) bool

IsTailscaleIP reports whether ip is an IP address in a range that Tailscale assigns from.

func NewContainsIPFunc added in v1.8.0

func NewContainsIPFunc(addrs []netaddr.IPPrefix) func(ip netaddr.IP) bool

NewContainsIPFunc returns a func that reports whether ip is in addrs.

It's optimized for the cases of addrs being empty and addrs containing 1 or 2 single-IP prefixes (such as one IPv4 address and one IPv6 address).

Otherwise the implementation is somewhat slow.

func PrefixIs4 added in v1.16.0

func PrefixIs4(p netaddr.IPPrefix) bool

PrefixIs4 reports whether p is an IPv4 prefix.

func PrefixIs6 added in v1.16.0

func PrefixIs6(p netaddr.IPPrefix) bool

PrefixIs6 reports whether p is an IPv6 prefix.

func PrefixesContainsFunc added in v1.16.0

func PrefixesContainsFunc(ipp []netaddr.IPPrefix, f func(netaddr.IPPrefix) bool) bool

PrefixesContainsFunc reports whether f is true for any IPPrefix in ipp.

func PrefixesContainsIP added in v1.20.0

func PrefixesContainsIP(ipp []netaddr.IPPrefix, ip netaddr.IP) bool

PrefixesContainsIP reports whether any prefix in ipp contains ip.

func Tailscale4To6 added in v1.2.0

func Tailscale4To6(ipv4 netaddr.IP) netaddr.IP

Tailscale4To6 returns a Tailscale IPv6 address that maps 1:1 to the given Tailscale IPv4 address. Returns a zero IP if ipv4 isn't a Tailscale IPv4 address.

func Tailscale4To6Placeholder added in v1.6.0

func Tailscale4To6Placeholder() netaddr.IP

Tailscale4To6Placeholder returns an IP address that can be used as a source IP when one is required, but a netmap didn't provide any. This address never gets allocated by the 4-to-6 algorithm in control.

Currently used to work around a Windows limitation when programming IPv6 routes in corner cases.

func Tailscale4To6Range added in v1.2.0

func Tailscale4To6Range() netaddr.IPPrefix

Tailscale4To6Range returns the subset of TailscaleULARange used for auto-translated Tailscale ipv4 addresses.

func TailscaleEphemeral6Range added in v1.8.0

func TailscaleEphemeral6Range() netaddr.IPPrefix

TailscaleEphemeral6Range returns the subset of TailscaleULARange used for ephemeral IPv6-only Tailscale nodes.

func TailscaleServiceIP added in v1.0.1

func TailscaleServiceIP() netaddr.IP

TailscaleServiceIP returns the IPv4 listen address of services provided by Tailscale itself such as the MagicDNS proxy.

For IPv6, use TailscaleServiceIPv6.

func TailscaleServiceIPv6 added in v1.20.0

func TailscaleServiceIPv6() netaddr.IP

TailscaleServiceIPv6 returns the IPv6 listen address of the services provided by Tailscale itself such as the MagicDNS proxy.

For IPv4, use TailscaleServiceIP.

func TailscaleULARange added in v1.2.0

func TailscaleULARange() netaddr.IPPrefix

TailscaleULARange returns the IPv6 Unique Local Address range that is the superset range that Tailscale assigns out of.

Types

This section is empty.

Jump to

Keyboard shortcuts

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