lannet

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package lannet answers "what address can peers on the local network reach this host at" — shared by the CLI (QR links) and the daemon's bridge listener.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsCGNAT

func IsCGNAT(ip net.IP) bool

IsCGNAT reports whether ip is in 100.64.0.0/10 — the shared-address range Tailscale assigns tailnet devices from. Used to tell a tailnet address apart from a physical LAN one.

func LANIP

func LANIP() (net.IP, error)

LANIP returns a non-loopback IPv4 address other devices on the local network can reach this host at — the address the QR advertises so the phone can connect to the laptop's gateway and Metro.

Primary method is the UDP-dial trick: "connecting" a UDP socket to a public address makes the kernel select the egress interface (no packets are sent), and its local address is the one a peer on that path sees. Falls back to scanning interfaces for a private (RFC1918) IPv4 when the dial can't resolve a usable address (e.g. no default route).

NB: with a VPN/tailscale exit node active, the dial trick returns the tunnel address (e.g. 100.64/10) — callers that need a physical-LAN address should check IsCGNAT.

func TailnetIP

func TailnetIP() net.IP

TailnetIP scans interfaces for a CGNAT (100.64/10) IPv4 — present exactly when Tailscale is up, regardless of install flavor (GUI network extension or tailscaled daemon).

Types

This section is empty.

Jump to

Keyboard shortcuts

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