client

package
v1.2.7 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client provides a basic struct of Client object

func NewClient

func NewClient(
	callsign string, passcode string,
	mode Mode, protocol Protocol,
	host string, port int,
	options ...Option,
) *Client

NewClient creates a new APRS client

func (*Client) Callsign

func (c *Client) Callsign() string

func (*Client) Close

func (c *Client) Close()

Close a client

func (*Client) Connect

func (c *Client) Connect() error

Connect to an APRS server

func (*Client) Filter

func (c *Client) Filter() string

func (*Client) GetStats

func (c *Client) GetStats() Stats

GetStats returns the current statistics

func (*Client) Host

func (c *Client) Host() string

func (*Client) Mode

func (c *Client) Mode() Mode

func (*Client) Port

func (c *Client) Port() int

func (*Client) Protocol

func (c *Client) Protocol() Protocol

func (*Client) ResetStats

func (c *Client) ResetStats()

ResetStats resets all statistics to zero

func (*Client) SendPacket

func (c *Client) SendPacket(packet string) error

SendPacket sends an APRS packet

func (*Client) Server

func (c *Client) Server() string

func (*Client) Up

func (c *Client) Up() bool

func (*Client) Uptime

func (c *Client) Uptime() time.Time

func (*Client) Wait

func (c *Client) Wait()

Wait the client exit

type Mode

type Mode string

Mode is a ENUM type for client mode

const (
	Fullfeed Mode = "fullfeed"
	IGate    Mode = "igate"
)

type Option

type Option func(*Client)

Option provides a basic option type

func WithBufSize added in v1.2.4

func WithBufSize(bufSize int) Option

WithBufSize sets a custom buf size for reader

func WithFilter

func WithFilter(filter string) Option

WithFilter sets a filter to the client

func WithHandler

func WithHandler(handler func(packet string)) Option

WithHandler sets default packet handler to custom

func WithLogger

func WithLogger(logger aprsutils.Logger) Option

WithLogger sets default logger to custom

func WithRetryTimes

func WithRetryTimes(retryTimes int) Option

WithRetryTimes sets a retry times to custom

func WithSoftwareAndVersion

func WithSoftwareAndVersion(software string, version string) Option

WithSoftwareAndVersion sets default software name and version to custom

type Protocol

type Protocol string

Protocol is a ENUM type for client protocol

const (
	TCP Protocol = "tcp"
	UDP Protocol = "udp"
)

type Stats

type Stats struct {
	TotalSentBytes  uint64        `json:"totalSentBytes"`
	TotalRecvBytes  uint64        `json:"totalRecvBytes"`
	CurrentSentRate uint64        `json:"currentSentRate"`
	CurrentRecvRate uint64        `json:"currentRecvRate"`
	PacketsSent     uint64        `json:"packetsSent"`
	PacketsReceived uint64        `json:"packetsReceived"`
	ConnectionTime  time.Duration `json:"connectionTime"`
	LastActivity    time.Time     `json:"lastActivity"`
}

Stats contains statistics for the client

Jump to

Keyboard shortcuts

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