listeners

package module
v0.0.0-...-7410e85 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2026 License: MIT Imports: 15 Imported by: 0

README

Station Manager: listeners package

This package contains the implementation of various listeners for the Station Manager application. Listeners are responsible for handling incoming network connections, events and triggering appropriate actions within the system – generally by logging a QSO.

Available Listeners

  • TCPListener: Listens for incoming TCP connections and processes QSO data.
  • UDPListener: Listens for incoming UDP packets and logs QSO information.
  • WebSocketListener: Handles WebSocket connections for real-time QSO updates.

Documentation

Index

Constants

View Source
const (
	ServiceName = types.ListenersServiceName
)

Variables

View Source
var (
	ErrServiceNotInitialized = "Service not initialized"
	ErrNilConfigService      = "ConfigService is nil"
	ErrNilLoggerService      = "LoggerService is nil"
)

Functions

This section is empty.

Types

type Service

type Service struct {
	ConfigService   *config.Service  `di.inject:"configservice"`
	Logger          *logging.Service `di.inject:"loggingservice"`
	ListenerConfigs []types.ListenerConfig
	// contains filtered or unexported fields
}

func (*Service) Initialize

func (s *Service) Initialize() error

func (*Service) Start

func (s *Service) Start(ctx context.Context) error

Start begins listening on all configured network listeners.

The method transitions through several phases:

  1. Normalize and validate configurations
  2. Resolve network addresses (may involve DNS lookups)
  3. Bind all listeners atomically (if any bind fails, all are rolled back)
  4. Launch listener goroutines

Context Cancellation: The provided context is passed to listener goroutines. If the context is cancelled, all listener goroutines will exit, but the service state remains stateRunning. This is intentional - the service does not automatically transition state on context cancellation. Callers MUST call Stop() to properly clean up and reset state before calling Start() again. A subsequent Start() call while in stateRunning will return nil with a log message "already running".

Thread Safety: Start() is safe to call concurrently with Stop(). If Stop() is called during startup (phases 1-3), Start() will detect this and abort without launching goroutines.

func (*Service) State

func (s *Service) State() string

State returns the current service state (for testing/debugging).

func (*Service) Stop

func (s *Service) Stop() error

Directories

Path Synopsis
Package handlers provides pluggable packet handler support for network listeners.
Package handlers provides pluggable packet handler support for network listeners.
wsjtx
Package wsjtx implements a packet handler for the WSJT-X and JTDX UDP protocol.
Package wsjtx implements a packet handler for the WSJT-X and JTDX UDP protocol.

Jump to

Keyboard shortcuts

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