transport

package
v0.11.8 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2023 License: MIT Imports: 8 Imported by: 10

Documentation

Overview

Package transport provides access to various connected modes common in amateur radio.

The modes is made available through common interfaces and idioms from the net package.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidTarget     = errors.New("Invalid or missing target callsign")
	ErrDigisUnsupported  = errors.New("Digipeater path is not supported by this scheme")
	ErrMissingDialer     = errors.New("No dialer has been registered for this scheme")
	ErrUnsupportedScheme = errors.New("Unsupported URL scheme")
)

Functions

func DialURL added in v0.7.0

func DialURL(url *URL) (net.Conn, error)

DialURL calls the url.Scheme's Dialer.

If the URL's scheme is not registered, ErrMissingDialer is returned.

func DialURLContext added in v0.10.0

func DialURLContext(ctx context.Context, url *URL) (net.Conn, error)

DialURLContext calls the url.Scheme's ContextDialer.

If the URL's scheme is not registered, ErrMissingDialer is returned.

func RegisterContextDialer added in v0.10.0

func RegisterContextDialer(scheme string, dialer ContextDialer)

RegisterContextDialer registers a new scheme and it's ContextDialer.

The list of registered dialers is used by DialURL and DialURLContext.

func RegisterDialer added in v0.7.0

func RegisterDialer(scheme string, dialer Dialer)

RigisterDialer registers a new scheme and it's Dialer.

The list of registered dialers is used by DialURL and DialURLContext.

func UnregisterDialer added in v0.7.0

func UnregisterDialer(scheme string)

UnregisterDialer removes the given scheme's dialer from the list of dialers.

Types

type BusyChannelChecker

type BusyChannelChecker interface {
	// Returns true if the channel is not clear
	Busy() bool
}

A BusyChannelChecker is a generic busy detector for a physical transmission medium.

type ContextDialer added in v0.10.0

type ContextDialer interface {
	// DiaulURLContext dials a connection.
	//
	// If the given context is cancelled before the connection is made, the operation is aborted and an error returned.
	// Once successfully connected, any expiration of the context will not affect the connection.
	DialURLContext(ctx context.Context, url *URL) (net.Conn, error)
}

ContextDialer is implemented by transports that supports dialing with cancellation.

type Dialer added in v0.7.0

type Dialer interface {
	DialURL(url *URL) (net.Conn, error)
}

Dialer is implemented by transports that supports dialing a transport.URL.

type Flusher

type Flusher interface {
	// Flush flushes the transmit buffers of the underlying modem.
	Flush() error
}

type PTTController

type PTTController interface {
	SetPTT(on bool) error
}

type Robust

type Robust interface {
	// Enables/disables robust mode.
	SetRobust(r bool) error
}

type TxBuffer

type TxBuffer interface {
	// TransmitBufferLen returns the number of bytes in the out buffer queue.
	TxBufferLen() int
}

type URL added in v0.7.0

type URL struct {
	// TNC/modem/interface/network type.
	Scheme string

	// The host interface address.
	Host string

	// Host username (typically the local stations callsign) and password information.
	User *url.Userinfo

	// Target callsign.
	Target string

	// List of digipeaters ("path" between origin and target).
	Digis []string

	// List of query parameters.
	Params url.Values
}

URL contains all information needed to dial a remote node.

func ParseURL added in v0.7.0

func ParseURL(rawurl string) (*URL, error)

ParseURL parses a raw urlstring into an URL.

scheme://(mycall(:password)@)(host)(/digi1/...)/targetcall Examples:

  • ardop:///LA1B (Addresses LA1B on ARDOP).
  • ax25://mycall@myaxport/LD5SK/LA1B-10 (Addresses LA1B-10 via LD5SK using AX.25-port "myaxport" and "MYCALL" as source callsign).

The special query parameter host will override the host part of the path. (E.g. ax25:///LA1B?host=ax0 == ax25://ax0/LA1B).

func (*URL) SetUser added in v0.7.0

func (u *URL) SetUser(call string)

Set the URL.User's username (usually the source callsign).

Directories

Path Synopsis
Package ardop provides means of establishing a connection to a remote node using ARDOP TNC
Package ardop provides means of establishing a connection to a remote node using ARDOP TNC
Package ax25 provides a net.Conn and net.Listener interfaces for AX.25.
Package ax25 provides a net.Conn and net.Listener interfaces for AX.25.
Package telnet provides a method of connecting to Winlink CMS over tcp ("telnet-mode")
Package telnet provides a method of connecting to Winlink CMS over tcp ("telnet-mode")

Jump to

Keyboard shortcuts

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