Documentation
¶
Index ¶
Constants ¶
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 ¶
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.
var StatsBytesRX *historydb.Series
var StatsBytesTX *historydb.Series
var StatsPacketRX *historydb.Series
var StatsPacketTX *historydb.Series
Functions ¶
func Clients ¶
Clients returns a snapshot of all currently-active uplink clients keyed by group name.
func GetClient ¶
GetClient returns one active uplink client (any group), or nil if none is connected. Retained for the single-link status view.
func LastTime ¶
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 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
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).