stream

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2018 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type C2S added in v0.3.0

type C2S interface {
	InOutStream

	Context() Context

	Username() string
	Domain() string
	Resource() string

	JID() *jid.JID

	IsSecured() bool
	IsAuthenticated() bool
	IsCompressed() bool

	Presence() *xml.Presence
}

C2S represents a client-to-server XMPP stream.

type Context

type Context interface {
	// SetObject stores within the context an object reference.
	SetObject(object interface{}, key string)

	// Object retrieves from the context a previously stored object reference.
	Object(key string) interface{}

	// SetString stores within the context an string value.
	SetString(s string, key string)

	// String retrieves from the context a previously stored string value.
	String(key string) string

	// SetInt stores within the context an integer value.
	SetInt(integer int, key string)

	// Int retrieves from the context a previously stored integer value.
	Int(key string) int

	// SetFloat stores within the context a floating point value.
	SetFloat(float float64, key string)

	// Float retrieves from the context a previously stored floating point value.
	Float(key string) float64

	// SetBool stores within the context a boolean value.
	SetBool(boolean bool, key string)

	// Bool retrieves from the context a previously stored boolean value.
	Bool(key string) bool

	// Done returns a channel that is closed when the stream is terminated.
	Done() <-chan struct{}
}

Context carries stream related variables across stream and its associated modules. Its methods are safe for simultaneous use by multiple goroutines.

func NewContext

func NewContext() (Context, chan<- struct{})

NewContext returns an initialized stream context.

type InOutStream added in v0.3.0

type InOutStream interface {
	InStream
	SendElement(elem xml.XElement)
}

InOutStream represents a generic incoming/outgoing stream.

type InStream added in v0.3.0

type InStream interface {
	ID() string
	Disconnect(err error)
}

InStream represents a generic incoming stream.

type MockC2S added in v0.3.0

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

MockC2S represents a mocked c2s stream.

func NewMockC2S added in v0.3.0

func NewMockC2S(id string, jid *jid.JID) *MockC2S

NewMockC2S returns a new mocked stream instance.

func (*MockC2S) Context added in v0.3.0

func (m *MockC2S) Context() Context

Context returns mocked stream associated context.

func (*MockC2S) Disconnect added in v0.3.0

func (m *MockC2S) Disconnect(err error)

Disconnect disconnects mocked stream.

func (*MockC2S) Domain added in v0.3.0

func (m *MockC2S) Domain() string

Domain returns current mocked stream domain.

func (*MockC2S) FetchElement added in v0.3.0

func (m *MockC2S) FetchElement() xml.XElement

FetchElement waits until a new XML element is sent to the mocked stream and returns it.

func (*MockC2S) ID added in v0.3.0

func (m *MockC2S) ID() string

ID returns mocked stream identifier.

func (*MockC2S) IsAuthenticated added in v0.3.0

func (m *MockC2S) IsAuthenticated() bool

IsAuthenticated returns whether or not the mocked stream has successfully authenticated.

func (*MockC2S) IsCompressed added in v0.3.0

func (m *MockC2S) IsCompressed() bool

IsCompressed returns whether or not the mocked stream has enabled a compression method.

func (*MockC2S) IsDisconnected added in v0.3.0

func (m *MockC2S) IsDisconnected() bool

IsDisconnected returns whether or not the mocked stream has been disconnected.

func (*MockC2S) IsSecured added in v0.3.0

func (m *MockC2S) IsSecured() bool

IsSecured returns whether or not the mocked stream has been secured.

func (*MockC2S) JID added in v0.3.0

func (m *MockC2S) JID() *jid.JID

JID returns current user JID.

func (*MockC2S) Presence added in v0.3.0

func (m *MockC2S) Presence() *xml.Presence

Presence returns last sent presence element.

func (*MockC2S) Resource added in v0.3.0

func (m *MockC2S) Resource() string

Resource returns current mocked stream resource.

func (*MockC2S) SendElement added in v0.3.0

func (m *MockC2S) SendElement(elem xml.XElement)

SendElement sends the given XML element.

func (*MockC2S) SetAuthenticated added in v0.3.0

func (m *MockC2S) SetAuthenticated(authenticated bool)

SetAuthenticated sets whether or not the a mocked stream has been authenticated.

func (*MockC2S) SetCompressed added in v0.3.0

func (m *MockC2S) SetCompressed(compressed bool)

SetCompressed sets whether or not the a mocked stream has been compressed.

func (*MockC2S) SetDomain added in v0.3.0

func (m *MockC2S) SetDomain(domain string)

SetDomain sets the mocked stream domain value.

func (*MockC2S) SetJID added in v0.3.0

func (m *MockC2S) SetJID(jid *jid.JID)

SetJID sets the mocked stream JID value.

func (*MockC2S) SetPresence added in v0.3.0

func (m *MockC2S) SetPresence(presence *xml.Presence)

SetPresence sets the mocked stream last received presence element.

func (*MockC2S) SetResource added in v0.3.0

func (m *MockC2S) SetResource(resource string)

SetResource sets the mocked stream resource value.

func (*MockC2S) SetSecured added in v0.3.0

func (m *MockC2S) SetSecured(secured bool)

SetSecured sets whether or not the a mocked stream has been secured.

func (*MockC2S) SetUsername added in v0.3.0

func (m *MockC2S) SetUsername(username string)

SetUsername sets the mocked stream username value.

func (*MockC2S) Username added in v0.3.0

func (m *MockC2S) Username() string

Username returns current mocked stream username.

func (*MockC2S) WaitDisconnection added in v0.3.0

func (m *MockC2S) WaitDisconnection() error

WaitDisconnection waits until the mocked stream disconnects.

type S2SIn added in v0.3.0

type S2SIn interface {
	InStream
}

S2SIn represents an incoming server-to-server XMPP stream.

type S2SOut added in v0.3.0

type S2SOut interface {
	InOutStream
}

S2SOut represents an outgoing server-to-server XMPP stream.

Jump to

Keyboard shortcuts

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