agw

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: MIT Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package agw is a small client for the AGWPE protocol that Direwolf serves (TCP, default port 8000).

It gives hamstack a way to watch packet traffic and make a connected-mode call without the Linux kernel's AX.25 stack, which needs root, extra packages and a kernel that still has the module (recent kernels do not). Direwolf allows several AGW clients at once, so this works while Pat is connected.

Index

Constants

This section is empty.

Variables

View Source
var ErrClosed = errors.New("the packet TNC closed the connection")

ErrClosed is returned when the server closes the connection.

Functions

This section is empty.

Types

type Conn

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

Conn is a connection to an AGW server.

func Dial

func Dial(ctx context.Context, addr string) (*Conn, error)

Dial connects to an AGW server such as Direwolf's. The connection is closed when ctx ends, which unblocks a Next that is waiting for a frame; a caller that wants to say goodbye first (send a disconnect) should give Dial a context that outlives that, and call Close itself.

func (*Conn) Close

func (c *Conn) Close() error

Close closes the connection.

func (*Conn) Connect

func (c *Conn) Connect(port byte, from, to string, via []string) error

Connect asks for a connection to a station, optionally through digipeaters.

func (*Conn) Disconnect

func (c *Conn) Disconnect(port byte, from, to string) error

Disconnect ends a connection.

func (*Conn) Monitor

func (c *Conn) Monitor() error

Monitor asks the server to send every frame it hears.

func (*Conn) Next

func (c *Conn) Next() (Frame, error)

Next reads the next frame.

func (*Conn) Register

func (c *Conn) Register(call string) error

Register tells the server a callsign this client answers to (needed to make or accept a connection).

func (*Conn) Send

func (c *Conn) Send(f Frame) error

Send writes a frame.

func (*Conn) SendData

func (c *Conn) SendData(port byte, from, to string, data []byte) error

SendData sends text on an established connection.

func (*Conn) Version

func (c *Conn) Version() error

Version asks the server to identify itself; it is a cheap check that something speaks AGW.

type Frame

type Frame struct {
	Port     byte
	Kind     byte // 'R' version, 'X' register callsign, 'm' monitor, 'C' connect, 'v' connect via, 'D' data, 'd' disconnect, ...
	PID      byte
	CallFrom string
	CallTo   string
	Data     []byte
}

Frame is one AGW frame.

func ReadFrame

func ReadFrame(r io.Reader) (Frame, error)

ReadFrame reads one frame.

func (Frame) Encode

func (f Frame) Encode() []byte

Encode returns the frame as bytes on the wire.

func (Frame) IsMonitor

func (f Frame) IsMonitor() bool

IsMonitor reports whether a frame is a monitored packet (heard on the air, or one we sent).

func (Frame) Text

func (f Frame) Text() string

Text returns the frame's data as printable text: a carriage return (packet's line ending), a line feed, or the pair, becomes one newline, and escape and other control characters are dropped, so a packet from the air cannot move the cursor or change the terminal. Text in UTF-8 is kept whole.

Jump to

Keyboard shortcuts

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