patty

package module
v0.0.0-...-68fb754 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2022 License: MIT Imports: 6 Imported by: 0

README

k3xec.com/patty

AX.25 is a tough protocol to use on UNIX systems. A lot of the support in Linux, specifically, is pretty hard to use, and tends to be built into the reptilian brain of the kernel. xan built a userland AX.25 stack called patty, for which I have now built some Go bindings on top of.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Addr

type Addr struct {
	// Callsign is the raw AX.25 callsign as a series of bytes. This is not
	// ASCII encoded. If you require a string version of the callsign,
	// please call Addr.String().
	Callsign [C.PATTY_AX25_CALLSTRLEN]byte

	// Callsign is the raw AX.25 SSID as a byte. This is already encoded.
	// If you require a string version of the callsign, please call
	// Addr.String(), and do not rely on fmt.Sprintf("%d").
	SSID uint8
}

Addr is an AX.25 callsign.

func ParseAddr

func ParseAddr(addr string) (*Addr, error)

ParseAddr will parse a callsign and SSID (like N0CALL-1) into a patty.Addr.

func (Addr) Network

func (a Addr) Network() string

Network will return the Network type of this Address. This will always return "ax25".

func (Addr) String

func (a Addr) String() string

String will turn the Addr (Callsign and SSID) into a String version. The Callsign and SSID are seperated by dashes. For instance, an Addr for the Callsign N0CALL with the SSID of 6 will be encoded as N0CALL-6.

type Client

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

Client holds an open connection to a running pattyd process, to enable communication with remote AX.25 hosts.

func Open

func Open(path string) (*Client, error)

Open will create a new patty client, which communicates with a running pattyd process, via the passed UNIX Socket.

func (Client) Close

func (c Client) Close() error

Close will free any underlying resources held by the provided connection to the pattyd process.

func (*Client) Dial

func (c *Client) Dial(network, address string) (net.Conn, error)

Dial will initiate an AX.25 socket connection to a remote station denoted by a callsign and SSID (such as K3XEC-1).

The only network param supported is currently 'ax25'.

func (*Client) Listen

func (c *Client) Listen(network, address string) (net.Listener, error)

Listen will listen for incoming requests to our station, handshake with them, and return the connection back to our consuming Go code.

'network' must be "ax25", and 'address' is your callsign (e.g., K3XEC-10)

This returns a net.Listener, which can be used in the Go stdlib to make connections using AX.25.

type Conn

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

Conn is an active patty AX.25 Connection.

This type implements the net.Conn interface, and will be returned by the Listener type.

func (Conn) Close

func (c Conn) Close() error

Close releases all resources held by this connection to a remote AX.25 station.

func (Conn) LocalAddr

func (c Conn) LocalAddr() net.Addr

LocalAddr is part of the net.Conn Interface.

LocalAddr return the local station callsign. For instance, if my station is K3XEC-1, and the remote callsign is N0CALL-9, the LocalAddr is K3XEC-1.

func (Conn) Read

func (c Conn) Read(b []byte) (int, error)

Read is part of the io.Reader Interface.

func (Conn) RemoteAddr

func (c Conn) RemoteAddr() net.Addr

RemoteAddr is part of the net.Conn Interface.

LocalAddr return the local station callsign. For instance, if my station is K3XEC-1, and the remote callsign is N0CALL-9, the RemoteAddr is N0CALL-9

func (Conn) SetDeadline

func (c Conn) SetDeadline(t time.Time) error

SetDeadline is part of the net.Conn Interface.

This is not currently implemented, and will return an error if called.

func (Conn) SetReadDeadline

func (c Conn) SetReadDeadline(t time.Time) error

SetReadDeadline is part of the net.Conn Interface.

This is not currently implemented, and will return an error if called.

func (Conn) SetWriteDeadline

func (c Conn) SetWriteDeadline(t time.Time) error

SetWriteDeadline is part of the net.Conn Interface.

This is not currently implemented, and will return an error if called.

func (Conn) Write

func (c Conn) Write(b []byte) (int, error)

Write is part of the io.Writer Interface.

type Listener

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

Listener is the type returned by Client.Listen; and implements the net.Listener interface.

func (Listener) Accept

func (l Listener) Accept() (net.Conn, error)

Accept will accept the next connection, and return the active net.Conn.

func (Listener) Addr

func (l Listener) Addr() net.Addr

Addr will return the AX.25 callsign and SSID that we are listening to requests to.

func (Listener) Close

func (l Listener) Close() error

Close will release all resources held by this Listener

Jump to

Keyboard shortcuts

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