aftn

package
v0.1.55 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package aftn implements the Aeronautical Fixed Telecommunication Network message envelope: the network air traffic services talk over, and Type B's cousin -- the same telegraph heritage, a different address plan.

The format is specified, not inferred: ICAO Annex 10 Volume II chapter 4 is public. A message is a heading (the start-of-message signal ZCZC and a transmission identification), an address line (a two-letter priority indicator and up to twenty-one eight-letter addressee indicators), an origin line (a six-figure filing time and the eight-letter originator indicator), the text, and the end-of-message signal NNNN. Annex 10's own page-copy example is the fixture this package is tested against:

ZCZC LPA183
GG LGGGZRZX LGATKLMW
201838 EGLLKLMW
(text)
NNNN

An addressee indicator is an ICAO location indicator (four letters), a three-letter designator for the organisation or unit, and a filler or department letter. Priorities are SS distress, DD urgency, FF flight safety, GG meteorological, flight regularity and aeronautical information, KK administrative. A message may not exceed 2 100 characters from ZCZC to NNNN inclusive.

Index

Constants

View Source
const MaxAddressees = 21

MaxAddressees is the most addressee indicators one transmission carries.

View Source
const MaxLength = 2100

MaxLength is the character limit from ZCZC to NNNN inclusive.

Variables

This section is empty.

Functions

func Looks

func Looks(raw []byte) bool

Looks reports whether raw bytes carry an AFTN message: an address line in the AFTN form within the first lines, after an optional ZCZC heading.

func ValidIndicator

func ValidIndicator(s string) bool

ValidIndicator reports whether s is a well-formed addressee or originator indicator.

Types

type EncodeOptions

type EncodeOptions struct {
	// CRLF ends lines with carriage return and line feed, as a teleprinter
	// circuit expects; the default is a bare line feed.
	CRLF bool
}

EncodeOptions control rendering.

type Message

type Message struct {
	// TransmissionID is the circuit identification and channel sequence
	// number from the heading, e.g. LPA183. Empty when the heading carried
	// none, which a message handed straight to a terminal may.
	TransmissionID string
	Priority       Priority
	Addressees     []string
	// FilingTime is the six-figure date-time group DDHHMM.
	FilingTime string
	Originator string
	// Text is the message text with line endings normalised to "\n".
	Text string
}

Message is one AFTN message.

func Parse

func Parse(raw []byte) (*Message, error)

Parse reads a message. The heading is optional, because a message handed over by a terminal rather than a circuit may start at the address line.

func (*Message) Encode

func (m *Message) Encode(opts EncodeOptions) ([]byte, error)

Encode renders the message.

type Priority

type Priority string

Priority is the two-letter priority indicator.

const (
	PriorityDistress   Priority = "SS"
	PriorityUrgency    Priority = "DD"
	PrioritySafety     Priority = "FF"
	PriorityRegularity Priority = "GG"
	PriorityAdmin      Priority = "KK"
)

Jump to

Keyboard shortcuts

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