Documentation
¶
Index ¶
Constants ¶
View Source
const ( DefaultWebPort = 8192 DefaultMaxCache = 100 DefaultDXCPort = "7300" DefaultPOTAPollInterval = 120 * time.Second MinPOTAPollInterval = 30 * time.Second DefaultDXCCUpdateInterval = 7 * 24 * time.Hour // Weekly DefaultLoTWUpdateInterval = 7 * 24 * time.Hour // Weekly DefaultDataDir = "/data" // Inside the container // Hard-coded Club Log API details (per-application, not per-user) // These values are based on the original Node.js project's use. ClubLogAPIKey = "608df94896cb9c5421ae748235492b43815610c9" )
Default values and hard-coded URLs for various configurations.
Variables ¶
View Source
var ( // These are baked-in, not user-configurable. Keep them package-level so they can be // changed by developers in code if necessary. ClubLogAPIURL = "https://cdn.clublog.org/cty.php?api=608df94896cb9c5421ae748235492b43815610c9" FallbackGitHubURL = "https://github.com/wavelog/dxcc_data/raw/refs/heads/master/cty.xml.gz" // Default LoTW URL - can be overridden via environment variable LoTWActivityURL = "https://lotw.arrl.org/lotw-user-activity.csv" POTAAPIEndpoint = "https://api.pota.app/spot/activator" )
Functions ¶
This section is empty.
Types ¶
type ClusterConfig ¶
type ClusterConfig struct {
Host string `json:"host"` // Required: hostname or IP
Port FlexiblePort `json:"port"` // Required: port number (string or int)
Callsign string `json:"call"` // Optional: callsign (uses global CALLSIGN if not set)
LoginPrompt string `json:"loginPrompt"` // Optional: login prompt to expect (default "login:")
SOTA bool `json:"sota"` // Optional: is this a SOTA cluster? (default false)
ChannelBuffer int `json:"channelBuffer"` // Optional: channel buffer size (default 32)
}
ClusterConfig holds connection details for a single DX cluster.
type Config ¶
type Config struct {
WebPort int `env:"WEBPORT" envDefault:"8192"`
BaseURL string `env:"WEBURL" envDefault:"/"`
MaxCache int `env:"MAXCACHE" envDefault:"100"`
DataDir string `env:"DATA_DIR" envDefault:"/data"` // Directory for SQLite files
// DX Cluster(s) Configuration
// CLUSTERS env var contains JSON array of cluster configs
// Example: CLUSTERS='[{"host":"dx.n9jr.com","port":"7300","call":"MYCALL"},{"host":"cluster.sota.org.uk","port":7300,"sota":true}]'
// Note: Port can be either string ("7300") or integer (7300)
RawClustersJSON string `env:"CLUSTERS"`
Clusters []ClusterConfig `env:"-"` // Will be populated from RawClustersJSON
// Global CALLSIGN - used for all clusters that don't specify their own
Callsign string `env:"CALLSIGN"`
// POTA Integration
EnablePOTA bool `env:"POTA_INTEGRATION" envDefault:"false"`
POTAPollInterval time.Duration `env:"POTA_POLLING_INTERVAL" envDefault:"120s"`
// DXCC Lookup Configuration
DXCCUpdateInterval time.Duration `env:"DXCC_UPDATE_INTERVAL" envDefault:"168h"` // Weekly
// LoTW Configuration
LoTWUpdateInterval time.Duration `env:"LOTW_UPDATE_INTERVAL" envDefault:"168h"` // Weekly
Redis RedisConfig
// ClubLog API key (allows overriding via env)
ClubLogAPIKey string `env:"CLUBLOG_API_KEY" envDefault:"608df94896cb9c5421ae748235492b43815610c9"`
// Optional (test) overrides for DXCC source URLs. These are usually the package-level
// defaults in production, but tests create Config literals expecting to override them.
ClubLogAPIURL string
FallbackGitHubURL string
// Default channel buffer for DX cluster clients (overridable per-cluster config)
DXCChannelBuffer int `env:"DXC_CHANNEL_BUFFER" envDefault:"32"`
// Proxy Configuration for X-Forwarded-For header handling
// TRUSTED_PROXIES: comma-separated list of trusted proxy IPs or CIDR ranges (e.g., "192.168.1.0/24,10.0.0.5")
// If not set, X-Forwarded-For header is ignored
TrustedProxies string `env:"TRUSTED_PROXIES" envDefault:""`
// REMOTE_IP_HEADER: the header name to use for remote IP extraction (default: X-Forwarded-For)
RemoteIPHeader string `env:"REMOTE_IP_HEADER" envDefault:"X-Forwarded-For"`
// REMOTE_IP_INVERT: if false (default), picks the LAST IP in the header; if true, picks the FIRST IP
RemoteIPInvert bool `env:"REMOTE_IP_INVERT" envDefault:"false"`
}
Config holds all application configuration.
func LoadConfig ¶
LoadConfig loads configuration from environment variables.
type FlexiblePort ¶
type FlexiblePort string
FlexiblePort is a type that can unmarshal both string and integer port values from JSON
func (FlexiblePort) String ¶
func (fp FlexiblePort) String() string
String returns the port as a string
func (*FlexiblePort) UnmarshalJSON ¶
func (fp *FlexiblePort) UnmarshalJSON(data []byte) error
UnmarshalJSON implements custom JSON unmarshaling for FlexiblePort
type RedisConfig ¶
type RedisConfig struct {
Enabled bool `env:"REDIS_ENABLED" envDefault:"false"`
Host string `env:"REDIS_HOST"`
Port string `env:"REDIS_PORT" envDefault:"6379"`
User string `env:"REDIS_USER"`
Password string `env:"REDIS_PASSWORD"`
DB int `env:"REDIS_DB" envDefault:"0"`
UseTLS bool `env:"REDIS_USE_TLS" envDefault:"false"`
InsecureSkipVerify bool `env:"REDIS_INSECURE_SKIP_VERIFY" envDefault:"false"`
SpotExpiry time.Duration `env:"REDIS_SPOT_EXPIRY" envDefault:"600s"` // Default 10 minutes (TTL for inactive spots; cache is updated on each re-spot)
}
RedisConfig holds configuration for the optional Redis cache.
Click to show internal directories.
Click to hide internal directories.