multiplexer

package
v0.0.0-...-5b71f87 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProtocolVersion1 uint8 = 0x01
	ProtocolVersion2 uint8 = 0x02
)

Protocol versions

Variables

This section is empty.

Functions

func GetGatewayID

func GetGatewayID(data []byte) (string, error)

GetGatewayID returns the gateway ID for the given packet data.

func GetToken

func GetToken(data []byte) (string, error)

GetToken returns the random Token for the given packet data.

func SetGatewayID

func SetGatewayID(data []byte, newGatewayID string) ([]byte, error)

SetGatewayID sets a new gateway ID in the packet data.

Types

type BackendConfig

type BackendConfig struct {
	Host       string   `mapstructure:"host"`
	UplinkOnly bool     `mapstructure:"uplink_only"`
	GatewayIDs []string `mapstructure:"gateway_ids"`
}

BackendConfig holds the config for a single backend.

type Config

type Config struct {
	Bind            string          `mapstructure:"bind"`
	Backends        []BackendConfig `mapstructure:"backend"`
	PacketThreshold int             `mapstructure:"concentrators"`
	MainGatewayID   string          `mapstructure:"maingatewayid"`
}

Config holds the multiplexer config.

type Multiplexer

type Multiplexer struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

MIMO-Packet-Forwarder forwards UDP data from multiple gateways to multiple backends.

func New

func New(c Config) (*Multiplexer, error)

New creates a new multiplexer.

func (*Multiplexer) Close

func (m *Multiplexer) Close() error

Close closes the multiplexer.

type PacketType

type PacketType byte

PacketType defines the packet type.

const (
	PushData PacketType = iota
	PushACK
	PullData
	PullResp
	PullACK
	TXACK
)

Available packet types

func GetPacketType

func GetPacketType(data []byte) (PacketType, error)

GetPacketType returns the packet type for the given packet data.

func (PacketType) String

func (i PacketType) String() string

Jump to

Keyboard shortcuts

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