Help us shape the future of Go! Take the 2026 Go Developer Survey

static

package module
v0.3.0 Latest Latest
Warning

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

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

Documentation

Overview

Package static implements a config-driven ligand.GeoZoneResolver: it maps a principal's account attribute to an account-jurisdiction ligand.Zone and a client IP prefix to a present-location ligand.Zone, both from operator-supplied tables.

This is the reference implementation. It encodes NO legal defaults — the zone vocabulary and every input→zone mapping are operator configuration, because a built-in country→zone table would encode a stale or wrong legal map. Its job is to prove the residency plumbing end to end (resolution at the boundary, signing onto the origin link, propagation, and policy visibility) in a deployment with no jurisdiction directory. A production deployment swaps in a resolver backed by its KYC/registration directory and a geo-IP service over the same ligand.GeoZoneResolver interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Factory

Factory returns a ligand.GeoZoneResolverFactory for cfg, for use in ligand.Config.GeoZoneResolver.

Types

type CIDRZone

type CIDRZone struct {
	// Prefix is the source-IP range this entry matches.
	Prefix netip.Prefix
	// Zone is the present-location zone assigned to addresses in Prefix.
	Zone ligand.Zone
}

CIDRZone maps a client IP prefix to a present-location zone.

type Config

type Config struct {
	// AccountJurisdictions maps a principal's [ligand.Link.User] value to its
	// account-jurisdiction zone. The lookup is exact on the full User string. A
	// real deployment resolves this from its registration/KYC directory; the
	// static reference uses a fixed map. Empty disables account-jurisdiction
	// resolution.
	AccountJurisdictions map[string]ligand.Zone

	// PresentLocationCIDRs maps client IP prefixes to present-location zones,
	// evaluated in order — the first prefix that contains the source address
	// wins, so list more specific prefixes first. Empty (or a request with no
	// observed locator) leaves the present-location zone unset.
	PresentLocationCIDRs []CIDRZone
}

Config configures the static geo-zone resolver. Both tables are optional; an empty table disables that zone kind (the resolver withholds it, and the fail-closed default denies any control that requires it). A resolver with both tables empty is valid but inert — it resolves no zones.

type Provider

type Provider struct {
	ligand.UnimplementedGeoZoneResolver
	// contains filtered or unexported fields
}

Provider is the static ligand.GeoZoneResolver.

func New

func New(cfg Config) *Provider

New constructs a static geo-zone resolver from cfg. It never errors: an empty configuration yields an inert resolver that asserts no zones, which is a valid (if unusual) deployment.

func (*Provider) Resolve

Resolve maps the principal's account attribute to an account-jurisdiction zone and the boundary locator to a present-location zone. It returns only the kinds it can determine — a missing mapping leaves that field empty (the fail-closed deny trigger), never an error.

Jump to

Keyboard shortcuts

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