registry

package
v0.0.0-...-c48bf83 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPNTimeout = 30 // s
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ContactInstance

type ContactInstance struct {
	Contact     *sip.ContactHeader
	RegExpires  uint32
	LastUpdated uint32
	Source      string
	UserAgent   string
	Transport   string
}

func NewContactInstanceForRequest

func NewContactInstanceForRequest(request sip.Request) *ContactInstance

func (*ContactInstance) GetPNParams

func (c *ContactInstance) GetPNParams() *PNParams

type ExpiredMap

type ExpiredMap struct {
	// contains filtered or unexported fields
}

func NewExpiredMap

func NewExpiredMap() *ExpiredMap

func (*ExpiredMap) Clear

func (e *ExpiredMap) Clear()

func (*ExpiredMap) Close

func (e *ExpiredMap) Close()

func (*ExpiredMap) Delete

func (e *ExpiredMap) Delete(key interface{})

func (*ExpiredMap) DoForEach

func (e *ExpiredMap) DoForEach(handler func(interface{}, interface{}))

func (*ExpiredMap) DoForEachWithBreak

func (e *ExpiredMap) DoForEachWithBreak(handler func(interface{}, interface{}) bool)

func (*ExpiredMap) Get

func (e *ExpiredMap) Get(key interface{}) (found bool, value interface{})

func (*ExpiredMap) Length

func (e *ExpiredMap) Length() int

func (*ExpiredMap) Remove

func (e *ExpiredMap) Remove(key interface{})

func (*ExpiredMap) Set

func (e *ExpiredMap) Set(key, value interface{}, expireSeconds int64)

func (*ExpiredMap) Size

func (e *ExpiredMap) Size() int

func (*ExpiredMap) Stop

func (e *ExpiredMap) Stop()

func (*ExpiredMap) TTL

func (e *ExpiredMap) TTL(key interface{}) int64

type MemoryRegistry

type MemoryRegistry struct {
	// contains filtered or unexported fields
}

MemoryRegistry Address-of-Record registry using memory.

func NewMemoryRegistry

func NewMemoryRegistry() *MemoryRegistry

func (*MemoryRegistry) AddAor

func (mr *MemoryRegistry) AddAor(aor sip.Uri, instance *ContactInstance) error

func (*MemoryRegistry) AorIsRegistered

func (mr *MemoryRegistry) AorIsRegistered(aor sip.Uri) bool

func (*MemoryRegistry) GetAllContacts

func (mr *MemoryRegistry) GetAllContacts() map[sip.Uri]map[string]*ContactInstance

func (*MemoryRegistry) GetContacts

func (mr *MemoryRegistry) GetContacts(aor sip.Uri) (*map[string]*ContactInstance, bool)

func (*MemoryRegistry) HandleConnectionError

func (mr *MemoryRegistry) HandleConnectionError(connError *transport.ConnectionError) bool

func (*MemoryRegistry) RemoveAor

func (mr *MemoryRegistry) RemoveAor(aor sip.Uri) error

func (*MemoryRegistry) RemoveContact

func (mr *MemoryRegistry) RemoveContact(aor sip.Uri, instance *ContactInstance) error

func (*MemoryRegistry) UpdateContact

func (mr *MemoryRegistry) UpdateContact(aor sip.Uri, instance *ContactInstance) error

type PNParams

type PNParams struct {
	Provider string // PNS Provider (apns|fcm|other)
	Param    string
	PRID     string
	PURR     string
	Expires  uint32 //TODO:
}

func (*PNParams) Disabled

func (p *PNParams) Disabled() bool

Disabled https://tools.ietf.org/html/rfc8599#section-4.1.2

func (*PNParams) Equals

func (p *PNParams) Equals(other *PNParams) bool

func (*PNParams) String

func (p *PNParams) String() string

type PushCallback

type PushCallback func(pn *PNParams, payload map[string]string) error

type Pusher

type Pusher struct {
	CH chan *ContactInstance
	// contains filtered or unexported fields
}

func NewPusher

func NewPusher() *Pusher

func (*Pusher) Abort

func (pn *Pusher) Abort()

Abort caller cancelled the call

func (*Pusher) WaitContactOnline

func (pn *Pusher) WaitContactOnline() (*ContactInstance, error)

type RFC8599

type RFC8599 struct {
	PushCallback PushCallback
	// contains filtered or unexported fields
}

func NewRFC8599

func NewRFC8599(callback PushCallback) *RFC8599

func (*RFC8599) HandleContactInstance

func (r *RFC8599) HandleContactInstance(aor sip.Uri, instance *ContactInstance)

func (*RFC8599) PNRecords

func (r *RFC8599) PNRecords() map[PNParams]sip.Uri

func (*RFC8599) TryPush

func (r *RFC8599) TryPush(aor sip.Uri, from *sip.FromHeader) (*Pusher, bool)

type Registry

type Registry interface {
	AddAor(aor sip.Uri, instance *ContactInstance) error
	RemoveAor(aor sip.Uri) error
	AorIsRegistered(aor sip.Uri) bool
	UpdateContact(aor sip.Uri, instance *ContactInstance) error
	RemoveContact(aor sip.Uri, instance *ContactInstance) error
	GetContacts(aor sip.Uri) (*map[string]*ContactInstance, bool)
	GetAllContacts() map[sip.Uri]map[string]*ContactInstance
	HandleConnectionError(connError *transport.ConnectionError) bool
}

Registry Address-of-Record registry

Jump to

Keyboard shortcuts

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