Documentation
¶
Index ¶
- Constants
- type ADIFBand
- type ADIFDate
- type ADIFFreq
- type ADIFTime
- type ApiKey
- type AppConfig
- type CatCommand
- type CatConfig
- type CatState
- type CatStatus
- type ContactedStation
- type Country
- type DatastoreConfig
- type Logbook
- type LogbookList
- type LoggingConfig
- type LoggingStation
- type Marker
- type PostRequest
- type Qso
- type QsoDetails
- type ReconnectConfig
- type RequestAction
- type RequiredConfigs
- type RigConfig
- type SerialConfig
- type ServerConfig
- type StateValues
- type User
- type ValueMapping
Constants ¶
const ( PostgresServiceName = "postgres" SqliteServiceName = "sqlite" )
const ( ConfigServiceName = "configservice" DatabaseServiceName = "databaseservice" LoggingServiceName = "loggingservice" CatServiceName = "catservice" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppConfig ¶
type AppConfig struct {
DatastoreConfig DatastoreConfig `json:"datastore_config"`
LoggingConfig LoggingConfig `json:"logging_config"`
RequiredConfigs RequiredConfigs `json:"required_configs"`
ServerConfig ServerConfig `json:"server_config"`
RigConfigs []RigConfig `json:"rig_configs"`
}
type CatCommand ¶ added in v0.0.21
type CatConfig ¶ added in v0.0.21
type CatConfig struct {
RateLimiterInterval time.Duration `koanf:"rate_limiter_interval" validate:"min=1000000,max=10000000000"` // 1ms to 10s in nanoseconds
ReadBufferSize int64 `koanf:"read_buffer_size" validate:"min=64,max=65536"`
CmdChannelSize int64 `koanf:"cmd_channel_size" validate:"min=1,max=1000"`
ReplyChannelSize int64 `koanf:"reply_channel_size" validate:"min=1,max=1000"`
StatusChannelSize int64 `koanf:"status_channel_size" validate:"min=1,max=100"`
CommandTimeout time.Duration `koanf:"command_timeout" validate:"min=0,max=30000000000"` // 0 to 30s in nanoseconds (0 = no timeout)
RateLimiterCmdsPerSecond int `koanf:"rate_limiter_cmds_per_second" validate:"min=1,max=20"`
Reconnection ReconnectConfig `koanf:"reconnection"`
}
type CatStatus ¶ added in v0.0.21
CatStatus is a map of CAT status values keyed by state tag. These are related to CAT commands; a particular command when issued will return a status value linked to that command. The status value is a string that represents the status of the CAT command in a format usable by the frontend.
See the cat.StatusChannel in the cat/service.go file for more details.
type ContactedStation ¶ added in v0.0.6
type ContactedStation struct {
Address string `json:"address"`
Age string `json:"age"`
Altitude string `json:"altitude"`
Call string `json:"call"`
Cont string `json:"cont"` // the contacted station's Continent
ContactedOp string `json:"contacted_op"`
Country string `json:"country"`
CQZ string `json:"cqz"`
DXCC string `json:"dxcc"`
Email string `json:"email"`
EqCall string `json:"eq_call"` // the contacted station's owner's callsign
Gridsquare string `json:"gridsquare"`
Iota string `json:"iota"`
IotaIslandId string `json:"iota_island_id"`
ITUZ string `json:"ituz"`
Lat string `json:"lat"`
Lon string `json:"lon"`
Name string `json:"name"`
QTH string `json:"qth"`
Rig string `json:"rig"`
Web string `json:"web"`
WwffRef string `json:"wwff_ref"`
}
ContactedStation represents details of the station contacted during a QSO, and is compatible with the ADI format.
type Country ¶ added in v0.0.6
type Country struct {
Name string `json:"name" hamnut:"countryName"`
Prefix string `json:"prefix" hamnut:"prefix"`
Ccode string `json:"ccode" hamnut:"countryCode"`
Continent string `json:"continent" hamnut:"continent"`
CQZone string `json:"cq_zone" hamnut:"cqZone"`
ITUZone string `json:"itu_zone" hamnut:"ituZone"`
DXCC string `json:"dxcc" hamnut:"primaryDXCCPrefix"`
TimeOffset string `json:"time_offset" hamnut:"timeOffset"`
ShortPathDistance string `json:"short_path_distance"`
LongPathDistance string `json:"long_path_distance"`
ShortPathBearing string `json:"short_path_bearing"`
LongPathBearing string `json:"long_path_bearing"`
IsNewEntity bool `json:"is_new_entity"` // Indicates if this QSO is a new country for the logging station
RequiresUpdate bool `json:"requires_update"`
}
type DatastoreConfig ¶
type DatastoreConfig struct {
Driver string `json:"driver" validate:"oneof=postgres sqlite"`
Path string `json:"path" validate:"required_if=Driver sqlite,omitempty"` // Used for sqlite only
Options map[string]string `json:"options" validate:"required_if=Driver sqlite,omitempty"` // Used for sqlite only
Host string `json:"host" validate:"required_if=Driver postgres,omitempty,hostname|ip"`
Port int `json:"port" validate:"required_if=Driver postgres,omitempty,min=1,max=65535"`
User string `json:"user" validate:"required_if=Driver postgres,omitempty,min=1,max=63,alphanum|contains=_|contains=-"`
Password string `json:"pass" validate:"required_if=Driver postgres,omitempty,min=1"`
Database string `json:"database" validate:"required_if=Driver postgres,omitempty,min=1,max=63,alphanum|contains=_|contains=-"`
SSLMode string `json:"ssl_mode" validate:"required_if=Driver postgres,omitempty,oneof=disable require verify-ca verify-full"`
MaxOpenConns int `json:"max_open_conns" validate:"min=1"` // For Postgres, minimum is 5 (enforced in database validation)
MaxIdleConns int `json:"max_idle_conns" validate:"min=1"`
ConnMaxLifetime int `json:"conn_max_lifetime" validate:"min=0"` // Number of minutes
ConnMaxIdleTime int `json:"conn_max_idle_time" validate:"min=0"` // Number of minutes
ContextTimeout int `json:"context_timeout" validate:"min=5"` // Seconds
TransactionContextTimeout int `json:"transaction_context_timeout" validate:"min=5"` // Seconds
Debug bool // Enable SQLBoiler query logging
Params map[string]string `json:"params" validate:"omitempty"`
}
type LogbookList ¶ added in v0.0.7
type LogbookList []Logbook
type LoggingConfig ¶ added in v0.0.2
type LoggingConfig struct {
Level string `json:"level" validate:"oneof=trace debug info warn error fatal panic"`
SkipFrameCount int `json:"skip_frame_count" validate:"min=0"`
WithTimestamp bool `json:"with_timestamp"`
ConsoleLogging bool `json:"console_logging"`
FileLogging bool `json:"file_logging"`
RelLogFileDir string `json:"rel_log_file_dir" validate:"required"`
LogFileMaxBackups int `json:"log_file_max_backups" validate:"min=0"`
LogFileMaxAgeDays int `json:"log_file_max_age_days" validate:"min=0"`
LogFileMaxSizeMB int `json:"log_file_max_size_mb" validate:"omitempty,min=1"`
ShutdownTimeoutMS int `json:"shutdown_timeout_ms" validate:"omitempty,min=10,max=10000"` // Timeout for graceful shutdown (10ms-10s, 0=use default)
ShutdownTimeoutWarning bool `json:"shutdown_timeout_warning"` // Log warning if the shutdown timeout is exceeded
// Optional polish fields
ConsoleNoColor bool `json:"console_no_color"`
ConsoleTimeFormat string `json:"console_time_format"`
LogFileCompress bool `json:"log_file_compress"`
}
type LoggingStation ¶ added in v0.0.6
type LoggingStation struct {
AntennaAzimuth string `json:"ant_az"` // the bearing from the logging station to the contacted station
MyAltitude string `json:"my_altitude"`
MyAntenna string `json:"my_antenna"`
MyCity string `json:"my_city"`
MyCountry string `json:"my_country"`
MyCqZone string `json:"my_cq_zone"`
MyDXCC string `json:"my_dxcc"`
MyGridsquare string `json:"my_gridsquare"`
MyIota string `json:"my_iota"`
MyIotaIslandID string `json:"my_iota_island_id"`
MyITUZone string `json:"my_itu_zone"`
MyLat string `json:"my_lat"`
MyLon string `json:"my_lon"`
MyMorseKeyInfo string `json:"my_morse_key_info"`
MyMorseKeyType string `json:"my_morse_key_type"`
MyName string `json:"my_name"`
MyPostalCode string `json:"my_postal_code"`
MyRig string `json:"my_rig"`
MyStreet string `json:"my_street"`
MyWwffRef string `json:"my_wwff_ref"`
Operator string `json:"operator"` // the logging operator's callsign if STATION_CALLSIGN is absent, OPERATOR shall be treated as both the logging station's callsign and the logging operator's callsign
OwnerCallsign string `json:"owner_callsign"`
StationCallsign string `json:"station_callsign" validate:"required,min=3,max=30,alphanum"`
}
LoggingStation represents the details of the station logging the QSO, including location, equipment, and operator info. It is compatible with the ADI format.
type Marker ¶ added in v0.0.21
type Marker struct {
Tag string
Index int
Length int
ValueMappings []ValueMapping
}
type PostRequest ¶ added in v0.0.17
type PostRequest struct {
Callsign string `json:"callsign"` // The callsign associated with the user account *NOT THE LOGBOOK CALLSIGN*. The logbook callsign is associated with Key.
Key string `json:"key"` // Logbook's API Key, or if registering, the Bootstrap Key
// For RegisterLogbookAction, a Logbook must be provided.
Logbook *Logbook `json:"logbook,omitempty"`
// For InsertQsoAction, Qso must be provided.
Qso *Qso `json:"qso,omitempty"`
}
type Qso ¶ added in v0.0.6
type Qso struct {
ID int64 `json:"id"`
// LogbookID represents the foreign key to the logbook associated with a QSO entry.
// Every QSO entry MUST have a logbook associated with it.
LogbookID int64 `json:"logbook_id" validate:"required"`
/*
All the below fields are compatible with the ADI format and are populated by the adapter.
The only exception to this is the ID field, which is required by database functions.
*/
QsoDetails
ContactedStation
LoggingStation
}
type QsoDetails ¶ added in v0.0.6
type QsoDetails struct {
AIndex string `json:"a_index"`
AntPath string `json:"ant_path"` // ADIF, section II.B.1 - currently, we only use S and L
Band string `json:"band"`
BandRx string `json:"band_rx"` //in a split frequency QSO, the logging station's receiving band
Comment string `json:"comment"`
ContestId string `json:"contest_id"`
Distance string `json:"distance"` // km
Freq string `json:"freq" validate:"required"`
FreqRx string `json:"freq_rx"`
Mode string `json:"mode" validate:"required"`
Submode string `json:"submode"`
MySig string `json:"my_sig"`
MySigInfo string `json:"my_sig_info"`
Notes string `json:"notes"` // information of interest to the logging station's operator
QsoDate string `json:"qso_date" validate:"required"`
QsoDateOff string `json:"qso_date_off"`
QsoRandom string `json:"qso_random"`
QsoComplete string `json:"qso_complete"`
RstRcvd string `json:"rst_rcvd"`
RstSent string `json:"rst_sent"`
RxPwr string `json:"rx_pwr"` // the contacted station's transmitter power in Watts with a value greater than or equal to 0
Sig string `json:"sig"` // the name of the contacted station's special activity or interest group
SigInfo string `json:"sig_info"` // information associated with the contacted station's activity or interest group
SRX string `json:"srx"` // contest QSO received serial number with a value greater than or equal to 0
STX string `json:"stx"` // contest QSO transmitted serial number with a value greater than or equal to 0
TimeOff string `json:"time_off"`
TimeOn string `json:"time_on"`
TxPwr string `json:"tx_pwr"` // the logging station's power in Watts with a value greater than or equal to 0
}
QsoDetails represents the details of a QSO, and is compatible with the ADI format.
type ReconnectConfig ¶ added in v0.0.21
type ReconnectConfig struct {
Enabled bool `koanf:"enabled"` // Enable automatic reconnection
MaxRetries int `koanf:"max_retries" validate:"min=0,max=100"` // 0 = infinite retries
InitialBackoff time.Duration `koanf:"initial_backoff" validate:"min=100000000,max=30000000000"` // 100ms to 30s
MaxBackoff time.Duration `koanf:"max_backoff" validate:"min=1000000000,max=300000000000"` // 1s to 5min
BackoffMultiplier float64 `koanf:"backoff_multiplier" validate:"min=1.0,max=10.0"` // Exponential backoff factor
HealthCheckInterval time.Duration `koanf:"health_check_interval" validate:"min=1000000000,max=60000000000"` // 1s to 60s
FailureThreshold int `koanf:"failure_threshold" validate:"min=1,max=20"` // Consecutive failures before disconnect
RecoveryThreshold int `koanf:"recovery_threshold" validate:"min=1,max=10"` // Consecutive successes before considering healthy
}
type RequestAction ¶ added in v0.0.17
type RequestAction string
const ( // RegisterLogbookAction registers a new logbook with the server. RegisterLogbookAction RequestAction = "register_logbook" InsertQsoAction = "insert_qso" )
func (RequestAction) String ¶ added in v0.0.17
func (s RequestAction) String() string
type RequiredConfigs ¶ added in v0.0.4
type RequiredConfigs struct {
DefaultRigID int64
}
type RigConfig ¶ added in v0.0.21
type RigConfig struct {
ID int64 `koanf:"id"`
Name string `koanf:"name"`
Model string `koanf:"model"`
Terminator string `koanf:"terminator"` // Terminator defines the character used to signal the end of a command.
CatCommands []CatCommand `koanf:"commands"`
CatStates []CatState `koanf:"states"`
SerialConfig SerialConfig `koanf:"serial_port"`
CatConfig CatConfig `koanf:"cat"`
}
type SerialConfig ¶ added in v0.0.21
type ServerConfig ¶ added in v0.0.19
type ServerConfig struct {
Name string `json:"name"` // AppName for goFiber
Host string `json:"host" validate:"required,hostname"`
Port int `json:"port" validate:"required,min=3000,max=65535"`
TLSEnabled bool `json:"tls_enabled"`
TLSCertFile string `json:"tls_cert_file" validate:"required_if=TLSEnabled true"`
TLSKeyFile string `json:"tls_key_file" validate:"required_if=TLSEnabled true"`
ReadTimeout int `json:"read_timeout" validate:"required"` // Seconds
WriteTimeout int `json:"write_timeout" validate:"required"` // Seconds
IdleTimeout int `json:"idle_timeout" validate:"required"` // Seconds
BodyLimit int `json:"body_limit" validate:"required"`
}
type StateValues ¶ added in v0.0.21
StateValues is a map of state values keyed by state tag. These are related to CAT commands; a particular command when issued will return a state value linked to that command. The state value is a string that represents the state of the CAT command in user-readable format.
See the cat.StateValues() method in the cat/service.go file for more details.
type User ¶ added in v0.0.13
type User struct {
ID int64 `json:"id"`
Callsign string `json:"callsign" validate:"min=3,max=30,alphanum"`
PassHash string `json:"pass_hash" validate:"required"`
Issuer string `json:"issuer,omitempty"`
Subject string `json:"subject,omitempty"`
Email string `json:"email,required"`
EmailConfirmed bool `json:"email_confirmed"`
}