dmr

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CallTracker

type CallTracker struct {
	DB            *gorm.DB
	Redis         *redis.Client
	CallEndTimers map[uint]*time.Timer
	InFlightCalls map[uint]*models.Call
}

CallTracker is a struct that holds the state of the calls that are currently in progress

func NewCallTracker

func NewCallTracker(db *gorm.DB, redis *redis.Client) *CallTracker

NewCallTracker creates a new CallTracker

func (*CallTracker) EndCall

func (c *CallTracker) EndCall(ctx context.Context, packet models.Packet)

EndCall ends a call

func (*CallTracker) IsCallActive

func (c *CallTracker) IsCallActive(packet models.Packet) bool

IsCallActive checks if a call is active

func (*CallTracker) ProcessCallPacket

func (c *CallTracker) ProcessCallPacket(ctx context.Context, packet models.Packet)

ProcessCallPacket processes a packet and updates the call

func (*CallTracker) StartCall

func (c *CallTracker) StartCall(ctx context.Context, packet models.Packet)

StartCall starts tracking a new call

type Parrot

type Parrot struct {
	Redis redisParrotStorage
}

Parrot is a struct that stores packets and repeats them back to the repeater

func NewParrot

func NewParrot(redis *redis.Client) *Parrot

NewParrot creates a new parrot instance

func (*Parrot) GetStream

func (p *Parrot) GetStream(ctx context.Context, streamID uint) []models.Packet

GetStream returns the stream

func (*Parrot) IsStarted

func (p *Parrot) IsStarted(ctx context.Context, streamID uint) bool

IsStarted returns true if the stream is already started

func (*Parrot) RecordPacket

func (p *Parrot) RecordPacket(ctx context.Context, streamID uint, packet models.Packet)

RecordPacket records a packet from the stream

func (*Parrot) StartStream

func (p *Parrot) StartStream(ctx context.Context, streamID uint, repeaterID uint) bool

StartStream starts a new stream

func (*Parrot) StopStream

func (p *Parrot) StopStream(ctx context.Context, streamID uint)

StopStream stops a stream

type Server added in v1.0.8

type Server struct {
	Buffer        []byte
	SocketAddress net.UDPAddr
	Server        *net.UDPConn
	Started       bool
	Parrot        *Parrot
	DB            *gorm.DB
	Redis         redisRepeaterStorage
	CallTracker   *CallTracker
}

Server is the DMR server

func MakeServer

func MakeServer(db *gorm.DB, redis *redis.Client) Server

MakeServer creates a new DMR server

func (*Server) Listen added in v1.0.8

func (s *Server) Listen(ctx context.Context)

Listen starts the DMR server

func (*Server) Stop added in v1.0.8

func (s *Server) Stop(ctx context.Context)

Stop stops the DMR server

Jump to

Keyboard shortcuts

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