patcfg

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: MIT Imports: 9 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 patcfg creates and reads Pat (Winlink client) config files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HFPort

func HFPort(path string) (int, bool)

HFPort returns the port of the VARA HF modem a Pat config points at (varahf.addr), and whether it has one. Only that field is read.

func Locator

func Locator(path string) (string, bool)

Locator returns the locator set in a Pat config, and whether there is one. Only that field is read.

func Minimal

func Minimal(o Options) ([]byte, error)

Minimal returns a starter Pat config for a station that talks to Mercury through rigctld. Pat fills in every other setting with its own defaults. The Winlink password is NOT set: the user adds it in Pat (web UI settings or `pat configure`).

With modem=false (Mercury is not part of the setup) only the callsign and web UI address are written, which is enough for Winlink over the internet.

func PacketPort

func PacketPort(path string) (int, bool)

PacketPort returns the port of the AGWPE TNC (Direwolf) a Pat config uses for AX.25, and whether it is set up for AGWPE at all. Only those fields are read.

func SetLocator

func SetLocator(path, grid string) (backup string, err error)

SetLocator changes only the locator in a Pat config. Every other value is kept exactly as it is (passwords included, which are never looked at), but the file is rewritten with sorted keys, so the original is first copied to path+".hamstack-bak". It returns the backup's path.

func Wire

func Wire(path string, w Wiring) (backup string, changed []string, err error)

Wire updates a Pat config to match w and returns the top-level settings it changed. Only the locator, hamlib_rigs, varahf, ax25, agwpe and gpsd are touched, and inside them only the members named here; every other setting (passwords included) is kept. If anything changes, the original is first copied to path+".hamstack-bak" and the file is rewritten with sorted keys. Nothing is written if nothing differs.

Types

type Found

type Found struct {
	File     string
	ID       string // suggested station id
	Callsign string
	HTTPAddr string
	Default  bool   // config.json (Pat's default config) points at this file
	Grid     string // the locator in that file, if any (a suggestion for the operator's grid)
}

Found is a Pat config discovered on disk.

func Scan

func Scan(dir string) ([]Found, error)

Scan reads the top-level *.json files in dir and returns those that name a callsign. Only mycall, http_addr and locator are read; nothing else (passwords included) is looked at. Files that are symlinks to another file in the same scan are reported once.

type Options

type Options struct {
	Callsign, HTTPAddr string
	Grid               string   // locator; omitted when empty
	Rigs               []RigRef // every rig, so Pat can tune any of them
	HFRig              string   // the rig whose Mercury Pat's VARA HF connection uses; "" for none
	HFArqPort          int      // that Mercury's ARQ port
	Packet             bool     // Direwolf is part of the setup: use its AGWPE interface for AX.25
	PacketRig          string   // the rig Pat tunes for packet connections ("" if it has no CAT)
	AGWPort            int
}

Options says what a starter Pat config should contain.

type RigRef

type RigRef struct {
	Name string
	Port int
}

RigRef names a rig and the port its rigctld listens on.

type Wiring

type Wiring struct {
	Grid      string   // locator; "" leaves it alone
	Rigs      []RigRef // rigctld connections, by rig name; entries here are set, other entries are kept
	HFRig     string   // the rig whose Mercury Pat's VARA HF uses; "" leaves varahf alone
	HFArqPort int
	PacketRig string // the rig Pat tunes for packet ("" for a rig with no CAT)
	Packet    bool   // Pat's AX.25 should use Direwolf's AGWPE port
	AGWPort   int
	GPSAddr   string // gpsd's address ("host:port"); "" leaves Pat's gpsd settings alone
}

Wiring is what a station's Pat config should say about the radios at the current site.

Jump to

Keyboard shortcuts

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