lan

package
v0.49.1 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2026 License: Apache-2.0 Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package lan finds the address a second device on the same network can reach this machine at.

The daemon binds loopback and nothing else unless the user turns LAN access on. When they do, it binds **one named address** rather than `0.0.0.0`. The difference matters: `0.0.0.0` accepts on every interface a machine has now or acquires later — a VPN that comes up, a container bridge, a phone tethered over USB — and none of those were what the user agreed to. A single address is a promise that can be shown on screen and checked.

Nothing here reaches the network. The addresses come from the kernel's own interface list; no name is registered, no discovery packet is sent, and nothing outside the machine learns that Caprock is running until somebody types a code into it.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoAddress = errors.New("no private network address on this machine")

ErrNoAddress is returned when the machine has no private IPv4 address — a laptop with wifi off, or a host whose only route is a public address we deliberately will not bind.

Functions

func Address

func Address() (net.IP, error)

Address returns the private IPv4 address a device on the same network would use to reach this machine.

IPv4 only, and private only. A link-local address (169.254/16) means the interface never got a lease and nothing can route to it; a public address on an interface would put the dashboard on the internet, which is a different decision from "let my tablet in" and is not one this function will make on anyone's behalf.

When several qualify — wifi and ethernet both up, or a VPN alongside either — the first in interface order wins and the rest are returned by Addresses so the user can be shown the choice rather than guessed at.

func Addresses

func Addresses() ([]net.IP, error)

Addresses returns every private IPv4 address on an interface that is up, in the order the kernel lists them.

Types

This section is empty.

Jump to

Keyboard shortcuts

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