georouting

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package georouting renders a geo-aware CoreDNS zone that answers one apex hostname with the nearest healthy node by client location. It is the pure-Go, deterministic core of Design 06 (Lattice-native GeoDNS): no network, no new dependency. The server feeds it participating nodes (with operator-owned NodeGeo coordinates + health) and ships the rendered config to the Design 02 CoreDNS node via the existing reviewed apply path. CoreDNS does the actual client geolocation at query time via its stock geoip+view plugins.

Index

Constants

View Source
const (
	// StrategyGeoIP routes by client continent (CoreDNS geoip+view; needs a
	// GeoLite2 DB on the node). StrategyAllHealthy is a zero-dependency degrade:
	// round-robin all healthy nodes (failover, but no geo).
	StrategyGeoIP      = "geoip"
	StrategyAllHealthy = "all-healthy"

	DefaultTTL = 60
)

Variables

This section is empty.

Functions

This section is empty.

Types

type GeoNode

type GeoNode struct {
	ID      string
	Name    string
	IPv4    string
	IPv6    string
	Lat     float64
	Lon     float64
	HasGeo  bool
	Healthy bool
}

GeoNode is one participating target as the renderer needs it.

type Input

type Input struct {
	Hostname    string
	TTL         int
	Strategy    string
	GeoIPDBPath string // path to the GeoLite2 DB on the node (geoip strategy)
	Nodes       []GeoNode
}

Input is the render request.

type Result

type Result struct {
	Config   string
	SHA256   string
	Warnings []string
	// Continent -> selected node ID (geoip strategy), for plan display/tests.
	ContinentChoice map[string]string
}

Result is the rendered CoreDNS config plus diagnostics.

func Render

func Render(in Input) (Result, error)

Render produces a deterministic CoreDNS server-block set for the apex.

Jump to

Keyboard shortcuts

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