hamnut

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2026 License: MIT, MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServiceName = types.HamNutLookupServiceName
)

Variables

This section is empty.

Functions

func IsNetworkError

func IsNetworkError(err error) bool

IsNetworkError checks if the error is network-related

Types

type PrefixLookupResponse

type PrefixLookupResponse struct {
	Status            string `json:"status"`
	Found             bool   `json:"found"`
	Timestamp         string `json:"_t"`
	Continent         string `json:"continent"`
	CountryName       string `json:"countryName"`
	CQZone            int    `json:"cqZone"`
	ITUZone           int    `json:"ituZone"`
	Prefix            string `json:"prefix"`
	PrimaryDXCCPrefix string `json:"primaryDXCCPrefix"`

	// Optional/forward-compatible fields.
	CountryCode string `json:"countryCode,omitempty"`
	TimeOffset  string `json:"timeOffset,omitempty"`
	LocalTime   string `json:"localTime,omitempty"`
}

PrefixLookupResponse models the successful JSON response from the Hamnut /v1/call-signs/prefixes endpoint.

type Service

type Service struct {
	ConfigService *config.Service  `di.inject:"configservice"`
	LoggerService *logging.Service `di.inject:"loggingservice"`
	Config        *types.LookupConfig
	// contains filtered or unexported fields
}

func NewService

func NewService(logger *logging.Service, cfgSvc *config.Service, cfg *types.LookupConfig, client *http.Client) *Service

NewService returns a Hamnut lookup service with the provided dependencies. The lookup.ConfigService is optional if you supply Config directly. The client can be overridden for testing; otherwise it will be created during Initialize.

func (*Service) Initialize

func (s *Service) Initialize() error

Initialize initializes the Service instance by setting up required dependencies and configurations.

func (*Service) Lookup

func (s *Service) Lookup(callsign string) (types.Country, error)

Lookup performs a country lookup using a callsign and returns the corresponding country information or an error.

func (*Service) LookupWithContext

func (s *Service) LookupWithContext(ctx context.Context, callsign string) (types.Country, error)

LookupWithContext performs a country lookup using the supplied context so callers can enforce cancellation and deadlines.

Jump to

Keyboard shortcuts

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