Documentation
¶
Index ¶
- func Initialize(cfg *config.C2S)
- func Shutdown()
- type Manager
- func (m *Manager) AuthenticateStream(strm Stream) error
- func (m *Manager) AvailableStreams(username string) []Stream
- func (m *Manager) DefaultLocalDomain() string
- func (m *Manager) IsLocalDomain(domain string) bool
- func (m *Manager) RegisterStream(strm Stream) error
- func (m *Manager) UnregisterStream(strm Stream) error
- type MockStream
- func (m *MockStream) Disconnect(err error)
- func (m *MockStream) Domain() string
- func (m *MockStream) FetchElement() xml.Element
- func (m *MockStream) ID() string
- func (m *MockStream) IsAuthenticated() bool
- func (m *MockStream) IsCompressed() bool
- func (m *MockStream) IsDisconnected() bool
- func (m *MockStream) IsRosterRequested() bool
- func (m *MockStream) IsSecured() bool
- func (m *MockStream) JID() *xml.JID
- func (m *MockStream) PresenceElements() []xml.Element
- func (m *MockStream) Priority() int8
- func (m *MockStream) Resource() string
- func (m *MockStream) SendElement(element xml.Element)
- func (m *MockStream) SetAuthenticated(authenticated bool)
- func (m *MockStream) SetCompressed(compressed bool)
- func (m *MockStream) SetDomain(domain string)
- func (m *MockStream) SetID(id string)
- func (m *MockStream) SetJID(jid *xml.JID)
- func (m *MockStream) SetPresenceElements(presenceElements []xml.Element)
- func (m *MockStream) SetPriority(priority int8)
- func (m *MockStream) SetResource(resource string)
- func (m *MockStream) SetRosterRequested(rosterRequested bool)
- func (m *MockStream) SetSecured(secured bool)
- func (m *MockStream) SetUsername(username string)
- func (m *MockStream) Username() string
- func (m *MockStream) WaitDisconnection() error
- type Stream
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages the sessions associated with an account.
func (*Manager) AuthenticateStream ¶
AuthenticateStream sets a previously registered stream as authenticated. An error will be returned in case no assigned resource is found.
func (*Manager) AvailableStreams ¶
AvailableStreams returns every authenticated stream associated with an account.
func (*Manager) DefaultLocalDomain ¶
DefaultLocalDomain returns default local domain.
func (*Manager) IsLocalDomain ¶
IsLocalDomain returns true if domain is a local server domain.
func (*Manager) RegisterStream ¶
RegisterStream registers the specified client stream. An error will be returned in case the stream has been previously registered.
func (*Manager) UnregisterStream ¶
UnregisterStream unregisters the specified client stream removing associated resource from the manager. An error will be returned in case the stream has not been previously registered.
type MockStream ¶
type MockStream struct {
// contains filtered or unexported fields
}
MockStream represents a mocked c2s stream.
func NewMockStream ¶
func NewMockStream(id string, jid *xml.JID) *MockStream
NewMockStream returns a new mocked stream instance.
func (*MockStream) Disconnect ¶
func (m *MockStream) Disconnect(err error)
Disconnect disconnects mocked stream.
func (*MockStream) Domain ¶
func (m *MockStream) Domain() string
Domain returns current mocked stream domain.
func (*MockStream) FetchElement ¶
func (m *MockStream) FetchElement() xml.Element
FetchElement waits until a new XML element is sent to the mocked stream and returns it.
func (*MockStream) IsAuthenticated ¶
func (m *MockStream) IsAuthenticated() bool
IsAuthenticated returns whether or not the mocked stream has successfully authenticated.
func (*MockStream) IsCompressed ¶
func (m *MockStream) IsCompressed() bool
IsCompressed returns whether or not the mocked stream has enabled a compression method.
func (*MockStream) IsDisconnected ¶
func (m *MockStream) IsDisconnected() bool
IsDisconnected returns whether or not the mocked stream has been disconnected.
func (*MockStream) IsRosterRequested ¶
func (m *MockStream) IsRosterRequested() bool
IsRosterRequested returns whether or not user's roster has been requested.
func (*MockStream) IsSecured ¶
func (m *MockStream) IsSecured() bool
IsSecured returns whether or not the mocked stream has been secured.
func (*MockStream) PresenceElements ¶
func (m *MockStream) PresenceElements() []xml.Element
PresenceElements returns last available sent presence sub elements.
func (*MockStream) Priority ¶
func (m *MockStream) Priority() int8
Priority returns current presence priority.
func (*MockStream) Resource ¶
func (m *MockStream) Resource() string
Resource returns current mocked stream resource.
func (*MockStream) SendElement ¶
func (m *MockStream) SendElement(element xml.Element)
SendElement sends the given XML element.
func (*MockStream) SetAuthenticated ¶
func (m *MockStream) SetAuthenticated(authenticated bool)
SetAuthenticated sets whether or not the a mocked stream has been authenticated.
func (*MockStream) SetCompressed ¶
func (m *MockStream) SetCompressed(compressed bool)
SetCompressed sets whether or not the a mocked stream has been compressed.
func (*MockStream) SetDomain ¶
func (m *MockStream) SetDomain(domain string)
SetDomain sets the mocked stream domain value.
func (*MockStream) SetID ¶
func (m *MockStream) SetID(id string)
SetID sets mocked stream identifier.
func (*MockStream) SetJID ¶
func (m *MockStream) SetJID(jid *xml.JID)
SetJID sets the mocked stream JID value.
func (*MockStream) SetPresenceElements ¶
func (m *MockStream) SetPresenceElements(presenceElements []xml.Element)
SetPresenceElements sets the mocked stream last received presence elements.
func (*MockStream) SetPriority ¶
func (m *MockStream) SetPriority(priority int8)
SetPriority sets mocked stream priority.
func (*MockStream) SetResource ¶
func (m *MockStream) SetResource(resource string)
SetResource sets the mocked stream resource value.
func (*MockStream) SetRosterRequested ¶
func (m *MockStream) SetRosterRequested(rosterRequested bool)
SetRosterRequested sets whether or not the a mocked stream roster has been requested.
func (*MockStream) SetSecured ¶
func (m *MockStream) SetSecured(secured bool)
SetSecured sets whether or not the a mocked stream has been secured.
func (*MockStream) SetUsername ¶
func (m *MockStream) SetUsername(username string)
SetUsername sets the mocked stream username value.
func (*MockStream) Username ¶
func (m *MockStream) Username() string
Username returns current mocked stream username.
func (*MockStream) WaitDisconnection ¶
func (m *MockStream) WaitDisconnection() error
WaitDisconnection waits until the mocked stream disconnects.
type Stream ¶
type Stream interface {
ID() string
Username() string
Domain() string
Resource() string
JID() *xml.JID
Priority() int8
SendElement(element xml.Element)
Disconnect(err error)
IsSecured() bool
IsAuthenticated() bool
IsCompressed() bool
PresenceElements() []xml.Element
IsRosterRequested() bool
}
Stream represents a client-to-server XMPP stream.