uplink

package
v1.2.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// WriterUplink tags packets received from an upstream uplink.
	WriterUplink = "uplink"
	// WriterPeerPrefix is prepended to a peer's id to tag packets received
	// from that core peer ("peer:<id>").
	WriterPeerPrefix = "peer:"
)

Writer-tag conventions for StreamData.Writer. The writer identifies the origin of a packet so consumers can apply loop-prevention rules (do not echo a packet back to its source, keep uplink and peer traffic separate).

  • A TCP/UDP/HTTP client's login callsign is used verbatim.
  • WriterUplink marks traffic received from an upstream uplink.
  • WriterPeerPrefix + "<id>" marks traffic received from a core peer.

Variables

View Source
var Stats = new(model.Counters)

Stats holds the uplink's cumulative counters and per-second rates. It uses the shared atomic Counters type so the receive/send handlers, the rate updater and the status HTTP handler can touch it concurrently without a data race.

Functions

func Clients

func Clients() map[string]*client.Client

Clients returns a snapshot of all currently-active uplink clients keyed by group name.

func GetClient

func GetClient() *client.Client

GetClient returns one active uplink client (any group), or nil if none is connected. Retained for the single-link status view.

func Init

func Init()

Init inits uplink daemon

func LastTime

func LastTime() time.Time

LastTime returns the time of the most recent packet received from the uplink (zero value if none yet).

func Reload

func Reload()

Reload restarts the uplink managers after a configuration change (e.g. SIGHUP), so new uplink targets take effect.

func SetLast

func SetLast(t time.Time)

SetLast records the time of the most recent packet received from the uplink.

func Stop

func Stop()

Stop terminates the uplink managers and closes every active client.

func SweepDupes

func SweepDupes()

SweepDupes prunes expired entries from the uplink duplicate checker. It is intended to be called periodically (e.g. from cron) and is a no-op before the uplink daemon has been initialised.

Types

type DataStream

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

DataStream provides a basic struct to build data Stream

var Stream *DataStream

func NewDataStream

func NewDataStream(bufferSize int) *DataStream

NewDataStream creates a new data Stream

func (*DataStream) Subscribe

func (ds *DataStream) Subscribe() (<-chan StreamData, func())

Subscribe a Stream

func (*DataStream) Write

func (ds *DataStream) Write(data parser.Parsed, writer string)

Write data to Stream.

This is the single choke point through which every accepted packet flows, so it is also where we record station positions for position-aware filters (m/, f/, ranged t/).

func (*DataStream) WriteDupe

func (ds *DataStream) WriteDupe(data parser.Parsed, writer string)

WriteDupe publishes a packet flagged as a duplicate. Only dupefeed ports consume it; it does not update position history or reach normal clients.

type StreamData

type StreamData struct {
	Data parser.Parsed
	// Writer identifies the packet's origin; see the Writer-tag constants.
	Writer string
	// Dupe marks a packet that was detected as a duplicate. Such packets are
	// only delivered to dupefeed ports; normal clients skip them.
	Dupe bool
}

StreamData is the basic struct for stream write

type ZapLogger

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

ZapLogger adapts the project's zap logger to the aprsutils.Logger interface expected by the APRS client (passed via client.WithLogger).

func (*ZapLogger) Debug

func (z *ZapLogger) Debug(ctx context.Context, args ...any)

Debug build Debug level log

func (*ZapLogger) Error

func (z *ZapLogger) Error(ctx context.Context, args ...any)

Error build Error level log

func (*ZapLogger) Info

func (z *ZapLogger) Info(ctx context.Context, args ...any)

Info build Info level log

func (*ZapLogger) Warn

func (z *ZapLogger) Warn(ctx context.Context, args ...any)

Warn build Warn level log

Jump to

Keyboard shortcuts

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