Documentation
¶
Overview ¶
The cache implementation is mostly a verbatim copy of the following: https://www.alexedwards.net/blog/implementing-an-in-memory-cache-in-go
Index ¶
- Constants
- func GenerateCallID(host string) string
- func GenerateFromTag() string
- type ByCallsign
- type ByName
- type Entry
- type GenericEntry
- type GenericPhoneBook
- type Host
- type NodeDetails
- type RecordStats
- type Records
- type RouteEntry
- type Runtime
- type RuntimeInfo
- type SIPAddress
- type SIPClient
- type SIPHeader
- type SIPMessage
- func (m *SIPMessage) AddHeader(name, value string)
- func (m *SIPMessage) Contact() *SIPAddress
- func (m *SIPMessage) ContentLength(update bool) (int, error)
- func (m *SIPMessage) FindHeaders(name string) []*SIPHeader
- func (m *SIPMessage) From() *SIPAddress
- func (m *SIPMessage) RemoveHeaders(name string)
- func (m *SIPMessage) To() *SIPAddress
- type SIPRequest
- type SIPResponse
- type SIPURI
- type SysInfo
- type System
- type TTLCache
- type Update
- type Updates
- type Version
- type WebDefault
- type WebIndex
- type WebInfo
- type WebMessage
- type WebReload
- type WebShowConfig
- type WebUpdateConfig
Constants ¶
View Source
const ( SIPSeparator = "@" AREDNDomain = "local.mesh" AREDNLocalNode = "localnode.local.mesh" // AREDN default for local node )
View Source
const ( DefaultSIPVersion = "SIP/2.0" DefaultMaxForwards = "30" SIPNewline = "\r\n" )
Variables ¶
This section is empty.
Functions ¶
func GenerateCallID ¶
func GenerateFromTag ¶
func GenerateFromTag() string
Types ¶
type ByCallsign ¶
type ByCallsign []*Entry
func (ByCallsign) Len ¶
func (e ByCallsign) Len() int
func (ByCallsign) Less ¶
func (e ByCallsign) Less(i, j int) bool
func (ByCallsign) Swap ¶
func (e ByCallsign) Swap(i, j int)
type Entry ¶
type Entry struct {
FirstName string
LastName string
Callsign string
PhoneNumber string
// Metadata
Route *RouteEntry // if present, the participant seems to be active
}
func NewEntryFromRoute ¶
func NewEntryFromRoute(o *RouteEntry) *Entry
func (*Entry) DirectCallAddress ¶
func (*Entry) DisplayName ¶
type GenericEntry ¶
type GenericPhoneBook ¶
type GenericPhoneBook struct {
Entry []*GenericEntry `xml:"DirectoryEntry"`
}
type NodeDetails ¶
type RecordStats ¶
type RouteEntry ¶
type Runtime ¶
type Runtime struct {
Node string `json:"node,omitempty"`
Uptime string `json:"uptime,omitempty"`
Details NodeDetails `json:"details,omitempty"`
Updated time.Time `json:"updated"`
}
type SIPAddress ¶
func (*SIPAddress) Clone ¶
func (a *SIPAddress) Clone() *SIPAddress
func (*SIPAddress) Parse ¶
func (a *SIPAddress) Parse(line string) error
func (*SIPAddress) String ¶
func (a *SIPAddress) String() string
type SIPClient ¶
type SIPClient struct {
Address *SIPAddress
UA string
}
func NewSIPClientFromRegister ¶
func NewSIPClientFromRegister(req *SIPRequest) *SIPClient
type SIPHeader ¶
type SIPHeader struct {
Name string
Value string
// Optionally set when header has an address.
// Note: This is parsed but not used during serialization!
Address *SIPAddress
}
type SIPMessage ¶
type SIPMessage struct {
SIPVersion string // Set to 2.0 version by default
Headers []*SIPHeader
Body []byte
}
func (*SIPMessage) AddHeader ¶
func (m *SIPMessage) AddHeader(name, value string)
func (*SIPMessage) Contact ¶
func (m *SIPMessage) Contact() *SIPAddress
func (*SIPMessage) ContentLength ¶
func (m *SIPMessage) ContentLength(update bool) (int, error)
func (*SIPMessage) FindHeaders ¶
func (m *SIPMessage) FindHeaders(name string) []*SIPHeader
func (*SIPMessage) From ¶
func (m *SIPMessage) From() *SIPAddress
func (*SIPMessage) RemoveHeaders ¶
func (m *SIPMessage) RemoveHeaders(name string)
func (*SIPMessage) To ¶
func (m *SIPMessage) To() *SIPAddress
type SIPRequest ¶
type SIPRequest struct {
SIPMessage
Method string
URI string
}
func NewSIPRequest ¶
func NewSIPRequest(method string, from, to *SIPAddress, seq int, hdrs []*SIPHeader, body []byte) *SIPRequest
func (*SIPRequest) Parse ¶
func (r *SIPRequest) Parse(data []byte) error
func (*SIPRequest) Serialize ¶
func (r *SIPRequest) Serialize(withBody bool) []byte
type SIPResponse ¶
type SIPResponse struct {
SIPMessage
StatusCode int
StatusMessage string
}
func NewSIPResponseFromRequest ¶
func NewSIPResponseFromRequest(req *SIPRequest, statusCode int, statusMsg string) *SIPResponse
func (*SIPResponse) Parse ¶
func (r *SIPResponse) Parse(data []byte) error
func (*SIPResponse) Serialize ¶
func (r *SIPResponse) Serialize(withBody bool) []byte
type SIPURI ¶
type SIPURI struct {
User string // The user part of the URI. The 'joe' in sip:joe@example.com
Host string // The host part of the URI. This can be a domain, or a string representation of an IP address.
Port int // The port part of the URI. This is optional, and can be empty.
Params map[string]string
}
type TTLCache ¶
type TTLCache[K comparable, V any] struct { // contains filtered or unexported fields }
TTLCache is a generic cache implementation with support for time-to-live (TTL) expiration.
func NewTTL ¶
func NewTTL[K comparable, V any]() *TTLCache[K, V]
NewTTL creates a new TTLCache instance and starts a goroutine to periodically remove expired items every 5 seconds.
func (*TTLCache[K, V]) Pop ¶
Pop removes and returns the item with the specified key from the cache.
type Update ¶
type Update struct {
// Type defines what color the message is rendered in. Supported are:
// - "info": Light background.
// - "warn": Yellow background.
// - "danger": Red background.
// - "success": Green background.
// - every other value will be rendered with a grey background.
// For more details, see https://getbootstrap.com/docs/5.3/components/alerts/
Type string `json:"info_type"`
Message string `json:"message"`
}
type WebDefault ¶
type WebInfo ¶
type WebInfo struct {
WebDefault
Registered map[string]string `json:"registered_phones,omitempty"`
RecordStats RecordStats `json:"records_stats,omitempty"`
Runtime Runtime `json:"runtime,omitempty"`
}
type WebMessage ¶
type WebMessage struct {
WebDefault
Success bool
From string
To string
Message string
}
type WebReload ¶
type WebReload struct {
WebDefault
Source string
Success bool
}
type WebShowConfig ¶
type WebShowConfig struct {
WebDefault
Messages []string
Content string
Diff bool
Success bool
}
type WebUpdateConfig ¶
type WebUpdateConfig struct {
WebDefault
Messages []string
Success bool
}
Click to show internal directories.
Click to hide internal directories.