Versions in this module Expand all Collapse all v0 v0.5.3 Sep 24, 2021 v0.5.2 Sep 24, 2021 Changes in this version + var ErrCanOnlySendGetOrSetIq = errors.New("SendIQ can only send get and set IQ stanzas") + var ErrTLSNotSupported = errors.New("transport does not support StartTLS") + var ErrTransportProtocolNotSupported = errors.New("transport protocol not supported") + var ServerDoesNotSupportXmppOverWebsocket = errors.New("the websocket server does not support the xmpp subprotocol") + func IsStreamResumable(c *Client) bool + func SendMissingStz(lastSent int, s Sender, uaq *stanza.UnAckQueue) error + type BiDirIterator interface + Next func(t int) (BiDirIteratorElt, error) + Previous func(t int) (BiDirIteratorElt, error) + type BiDirIteratorElt interface + NoOp func() + type Client struct + ErrorHandler func(error) + PostConnectHook func() error + PostResumeHook func() error + Session *Session + func NewClient(config *Config, r *Router, errorHandler func(error)) (c *Client, err error) + func (c *Client) Connect() error + func (c *Client) Disconnect() error + func (c *Client) Resume() error + func (c *Client) Send(packet stanza.Packet) error + func (c *Client) SendIQ(ctx context.Context, iq *stanza.IQ) (chan stanza.IQ, error) + func (c *Client) SendRaw(packet string) error + func (c *Client) SetHandler(handler EventHandler) + type ClientHandler func(t *testing.T, serverConn *ServerConn) + type Component struct + ErrorHandler func(error) + func NewComponent(opts ComponentOptions, r *Router, errorHandler func(error)) (*Component, error) + func (c *Component) Connect() error + func (c *Component) Disconnect() error + func (c *Component) Resume() error + func (c *Component) Send(packet stanza.Packet) error + func (c *Component) SendIQ(ctx context.Context, iq *stanza.IQ) (chan stanza.IQ, error) + func (c *Component) SendRaw(packet string) error + func (c *Component) SetHandler(handler EventHandler) + type ComponentOptions struct + Category string + Domain string + Name string + Secret string + Type string + type Config struct + ConnectTimeout int + Credential Credential + Insecure bool + Jid string + KeepaliveInterval time.Duration + Lang string + StreamLogger *os.File + StreamManagementEnable bool + type ConnError struct + Permanent bool + func NewConnError(err error, permanent bool) ConnError + func (e ConnError) Error() string + func (e ConnError) Format(s fmt.State, verb rune) + func (e ConnError) FormatError(p xerrors.Printer) error + func (e ConnError) Unwrap() error + type ConnState = uint8 + const InitialPresence + const StateDisconnected + const StatePermanentError + const StateResuming + const StateSessionEstablished + const StateStreamError + type Credential struct + func OAuthToken(token string) Credential + func Password(pwd string) Credential + type Event struct + Description string + SMState SMState + State SyncConnState + StreamError string + type EventHandler func(Event) error + type EventManager struct + CurrentState SyncConnState + Handler EventHandler + type Handler interface + HandlePacket func(s Sender, p stanza.Packet) + type HandlerFunc func(s Sender, p stanza.Packet) + func (f HandlerFunc) HandlePacket(s Sender, p stanza.Packet) + type IQResultHandler interface + HandleIQ func(ctx context.Context, s Sender, iq stanza.IQ) + type IQResultHandlerFunc func(ctx context.Context, s Sender, iq stanza.IQ) + func (f IQResultHandlerFunc) HandleIQ(ctx context.Context, s Sender, iq stanza.IQ) + type IQResultRoute struct + func NewIQResultRoute(ctx context.Context) *IQResultRoute + type Matcher interface + Match func(stanza.Packet, *RouteMatch) bool + type Metrics struct + LoginTime time.Duration + type PostConnect func(c Sender) + type Route struct + func (r *Route) AddMatcher(m Matcher) *Route + func (r *Route) Handler(handler Handler) *Route + func (r *Route) HandlerFunc(f HandlerFunc) *Route + func (r *Route) IQNamespaces(namespaces ...string) *Route + func (r *Route) Match(p stanza.Packet, match *RouteMatch) bool + func (r *Route) Packet(name string) *Route + func (r *Route) StanzaType(types ...string) *Route + type RouteMatch struct + Handler Handler + Route *Route + type Router struct + IQResultRouteLock sync.RWMutex + IQResultRoutes map[string]*IQResultRoute + func NewRouter() *Router + func (r *Router) Handle(name string, handler Handler) *Route + func (r *Router) HandleFunc(name string, f func(s Sender, p stanza.Packet)) *Route + func (r *Router) Match(p stanza.Packet, match *RouteMatch) bool + func (r *Router) NewIQResultRoute(ctx context.Context, id string) chan stanza.IQ + func (r *Router) NewRoute() *Route + type SMState struct + Id string + Inbound uint + StreamErrorGroup stanza.StanzaErrorGroup + type Sender interface + Send func(packet stanza.Packet) error + SendIQ func(ctx context.Context, iq *stanza.IQ) (chan stanza.IQ, error) + SendRaw func(packet string) error + type ServerCheck struct + func NewChecker(address, domain string) (*ServerCheck, error) + func (c *ServerCheck) Check() error + type ServerConn struct + type ServerMock struct + func (mock *ServerMock) Start(t *testing.T, addr string, handler ClientHandler) + func (mock *ServerMock) Stop() + type Session struct + BindJid string + Features stanza.StreamFeatures + SMState SMState + StreamId string + TlsEnabled bool + func NewSession(c *Client, state SMState) (*Session, error) + func (s *Session) EnableStreamManagement(o *Config) + func (s *Session) PacketId() string + type StreamClient interface + Connect func() error + Disconnect func() error + Resume func() error + Send func(packet stanza.Packet) error + SendIQ func(ctx context.Context, iq *stanza.IQ) (chan stanza.IQ, error) + SendRaw func(packet string) error + SetHandler func(handler EventHandler) + type StreamManager struct + Metrics *Metrics + PostConnect PostConnect + func NewStreamManager(client StreamClient, pc PostConnect) *StreamManager + func (sm *StreamManager) Run() error + func (sm *StreamManager) Stop() + type SyncConnState struct + type TimeoutHandlerFunc func(err error) + type Transport interface + Close func() error + Connect func() (string, error) + DoesStartTLS func() bool + GetDecoder func() *xml.Decoder + IsSecure func() bool + LogTraffic func(logFile io.Writer) + Ping func() error + Read func(p []byte) (n int, err error) + ReceivedStreamClose func() + StartStream func() (string, error) + StartTLS func() error + Write func(p []byte) (n int, err error) + func NewClientTransport(config TransportConfiguration) Transport + func NewComponentTransport(config TransportConfiguration) (Transport, error) + type TransportConfiguration struct + Address string + CharsetReader func(charset string, input io.Reader) (io.Reader, error) + ConnectTimeout int + Domain string + TLSConfig *tls.Config + type WebsocketTransport struct + Config TransportConfiguration + func (t *WebsocketTransport) Connect() (string, error) + func (t *WebsocketTransport) LogTraffic(logFile io.Writer) + func (t *WebsocketTransport) Read(p []byte) (int, error) + func (t *WebsocketTransport) ReceivedStreamClose() + func (t WebsocketTransport) Close() error + func (t WebsocketTransport) DoesStartTLS() bool + func (t WebsocketTransport) GetDecoder() *xml.Decoder + func (t WebsocketTransport) GetDomain() string + func (t WebsocketTransport) IsSecure() bool + func (t WebsocketTransport) Ping() error + func (t WebsocketTransport) StartStream() (string, error) + func (t WebsocketTransport) StartTLS() error + func (t WebsocketTransport) Write(p []byte) (int, error) + type XMPPTransport struct + Config TransportConfiguration + TLSConfig *tls.Config + func (t *XMPPTransport) Close() error + func (t *XMPPTransport) Connect() (string, error) + func (t *XMPPTransport) DoesStartTLS() bool + func (t *XMPPTransport) GetDecoder() *xml.Decoder + func (t *XMPPTransport) GetDomain() string + func (t *XMPPTransport) IsSecure() bool + func (t *XMPPTransport) LogTraffic(logFile io.Writer) + func (t *XMPPTransport) Ping() error + func (t *XMPPTransport) Read(p []byte) (n int, err error) + func (t *XMPPTransport) ReceivedStreamClose() + func (t *XMPPTransport) StartStream() (string, error) + func (t *XMPPTransport) StartTLS() error + func (t *XMPPTransport) Write(p []byte) (n int, err error)