satcom

package module
v0.0.0-...-32b1a53 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

README

go-satcom

This repository contains golang libraries supporting satellite communication protocols:

Additionally, the Socket and Adapter abstractions here help work with full communications channels. Take a look at the examples in socket_test.go and the test/ directory.

Feel free to open a Github issue with feedback/questions, or open a PR!

This project is licensed under APACHE 2.0 by Antaris, Inc.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFrameReader

func NewFrameReader(src io.Reader, syncMarker []byte, frameBufferSize int) *frameReader

Types

type Adapter

type Adapter interface {
	// Given a payload, wrap it in the appropriate envelope
	Wrap([]byte) ([]byte, error)
	// Given a complete message, strip and verify expected envelope
	Unwrap([]byte) ([]byte, error)
	// Given a sample payload size, calculate the expected length of the wrapped message
	MessageSize(int) (int, error)
}

Objects that implement this interface are used as middleware while sending and receiving messages. Typically this is used in support of symmetric capabilities such as CRC checksums or Reed Solomon parity bytes.

type FrameConfig

type FrameConfig struct {
	// Byte sequence that designates the start of a
	// message frame.
	FrameSyncMarker []byte

	// Size of fully encoded messages to be transmitted or
	// received. It is assumed that either a consant message
	// size will be used, or some sort of padding will be
	// applied by an included Adapter. This value does NOT
	// include the length of the sync marker.
	FrameSize int

	// Adapters apply basic encoding/decoding capabilities
	// to as messages are converted to and from frames.
	Adapters []Adapter
}

func (*FrameConfig) Err

func (cfg *FrameConfig) Err() error

type FrameReceiver

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

func NewFrameReceiver

func NewFrameReceiver(cfg FrameConfig, src io.Reader) (*FrameReceiver, error)

func (*FrameReceiver) Receive

func (r *FrameReceiver) Receive(ctx context.Context, msgC chan<- []byte, errC chan<- error)

Forward received frames to provided channel. This function is designed to be called within a goroutine. A caller must use Receive to actually start reading from the source.

A call to Receive will continue until the upstream source is depleted, indicated by an io.EOF error. A user may also cancel the Receive operation prematurely by closing the provided Context.

If a caller provides a non-nil error channel, any errors encountered within the frame processor will be sent to it. This channel is used synchronously, so a caller MUST read from it to unblock frame reception following an error.

type FrameSender

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

func NewFrameSender

func NewFrameSender(cfg FrameConfig, dst io.Writer) (*FrameSender, error)

func (*FrameSender) Send

func (s *FrameSender) Send(msg []byte) error

Directories

Path Synopsis
csp
v1
v2

Jump to

Keyboard shortcuts

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