mobile

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package mobile is everything `pano mobile` needs to put a phone behind the proxy: finding the Mac's LAN address, a listener that only admits the local network, the root certificate as an Apple configuration profile and as DER for Android, and the setup site the phone opens — one page that names the proxy settings, hands out the certificate and reports, live, how far the device has got.

The site is reachable three ways: directly at http://<lan-ip>:<port> before the phone proxies anything (that is what the QR code encodes), through the proxy at the same address once it does, and at http(s)://pano.internal from any client whose traffic already passes through pano.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoLAN = errors.New("mobile: no LAN address found — is Wi-Fi (or Ethernet) connected?")

ErrNoLAN is returned when no interface carries a private IPv4 address.

Functions

func Expires

func Expires(t time.Time) string

Expires formats the CA's end of validity for the page.

func MachineName

func MachineName() string

MachineName is what the page and the profile call this computer: the macOS computer name ("Or's Mac mini") when available, else the hostname.

func MobileConfig

func MobileConfig(c Certificate, machine string) []byte

MobileConfig renders an Apple configuration profile that installs the root as a trusted certificate payload. iOS shows it as a "Profile Downloaded" the user installs in Settings, then enables full trust for under General → About → Certificate Trust Settings. The profile carries a description that says what it is for and how to remove it, and stable UUIDs derived from the certificate so re-downloading replaces rather than duplicates it. machine names the Mac in the description.

func PrivateOnly

func PrivateOnly(ln net.Listener) net.Listener

PrivateOnly wraps a listener so that only clients on private or link-local addresses get through; anything else is closed before a byte is read. The LAN listener is meant for the devices next to you, not for whoever can route to the machine.

Types

type Certificate

type Certificate struct {
	PEM     []byte
	DER     []byte
	Subject string
	SHA256  string // hex fingerprint of the DER
}

Certificate is pano's root in the forms devices want it in.

func ParseCertificate

func ParseCertificate(pemBytes []byte) (Certificate, error)

ParseCertificate reads the root from PEM.

func (Certificate) Fingerprint

func (c Certificate) Fingerprint() string

Fingerprint returns the SHA-256 in the colon form Settings apps display.

type LAN

type LAN struct {
	IP        string
	Interface string
	Network   string // Wi-Fi SSID when the OS will tell us; "" otherwise
}

LAN is the address other devices on the local network can reach this machine at.

func Detect

func Detect() (LAN, error)

Detect picks the interface phones are most likely to share with this machine: up, not loopback, not a tunnel/bridge, carrying a private IPv4 address; Wi-Fi first (en0 on a Mac, wl* on Linux), then wired.

func Interfaces

func Interfaces() []LAN

Interfaces lists every usable LAN address (for `--ip` hints).

type Site

type Site struct {
	// contains filtered or unexported fields
}

Site serves pano's own pages on the proxy port.

func NewSite

func NewSite(opts SiteOptions) *Site

NewSite builds the handler mounted as proxy.Options.Local.

func (*Site) ServeHTTP

func (s *Site) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements http.Handler.

type SiteOptions

type SiteOptions struct {
	Cert    Certificate
	Machine string            // the Mac's name, shown on the page and in the profile
	Version string            // pano version
	Mobile  func() api.Mobile // current LAN listener state (IP, port)
	Device  func(addr string) (api.Device, bool)
}

SiteOptions wire the setup site to the daemon.

Jump to

Keyboard shortcuts

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