xmpp/component d---------
internal/integration/prosody: support MUC

Signed-off-by: Sam Whited <sam@samwhited.com>
all: update build tags for Go 1.17

See: https://golang.org/issues/41184

Signed-off-by: Sam Whited <sam@samwhited.com>
component: remove unused type

Signed-off-by: Sam Whited <sam@samwhited.com>
all: update negotiator API to handle stream info

Previously we were special casing this in our negotiator implementation,
meaning you couldn't actually implement the negotiator in another
package. This fixes the API so that it could in theory be moved to its
own package (if we could do so and avoid import loops somehow).
This also moves us a step closer to supporting virtual hosts by making
sure the input/output stream info is set before the negotiate call is

See #61

Signed-off-by: Sam Whited <sam@samwhited.com>
all: update negotiator docs

This reflects the changes to the session negotiation functions.

Signed-off-by: Sam Whited <sam@samwhited.com>
all: allow setting session state up front

Previously we could only mark a session as secure or as a
server-to-server connection in the negotiator. However, this left us in
a weird spot where we had two different sources of information and where
the first run of a feature in the default negotiator wouldn't know about
the initial session bits without hacks that made it impossible to
implement the same negotiator outside of the xmpp package.
This provides us with a way to set the session bits before creating the
session or using the negotiator meaning that we can mark a connection as
secure when we pass the connection in and not at some later time. This
also gives us the ability to do partial negotiation and then resume
negotiating later with a different negotiator for some stream
initialization protocols.

Fixes #100

Signed-off-by: Sam Whited <sam@samwhited.com>
component: mirror main package session functions

Signed-off-by: Sam Whited <sam@samwhited.com>
all: rework session negotiation functions

Signed-off-by: Sam Whited <sam@samwhited.com>
component: rename NewClientSession to NewSession

Signed-off-by: Sam Whited <sam@samwhited.com>
component: correctly mark session as received

Previously this would try to negotiate an initiated client connection
even if the connection was received (where it should panic because this
package doesn't support the server side of component connections yet).

Signed-off-by: Sam Whited <sam@samwhited.com>
xmpp: split up NegotiateSession into two functions

Signed-off-by: Sam Whited <sam@samwhited.com>
component: add integration tests

Signed-off-by: Sam Whited <sam@samwhited.com>
component: unmarshal stream errors

Instead of returning a generic error that looks like it might have been
sent over the stream, causing confusion, actually unmarshal the error.

Signed-off-by: Sam Whited <sam@samwhited.com>
component: only check stream ID if not an error

This fixes an error where the stream ID wasn't set on Prosody unless the
stream would be used. While I think Prosody is in the wrong here, their
behavior likely won't cause any problems so it doesn't hurt us to mimic
it for compatibility as long as we still maintain the check on streams
that will be used.

Signed-off-by: Sam Whited <sam@samwhited.com>
component: fix error convention

Fix errors to use messages that follow the convention used in other
packages in this module.

Signed-off-by: Sam Whited <sam@samwhited.com>
component: further simplify tests

Signed-off-by: Sam Whited <sam@samwhited.com>
component: use a net.Pipe in tests

This simplifies the code over using two io.Pipe's as we were doing

Signed-off-by: Sam Whited <sam@samwhited.com>
component: remove unstable API warning from docs

While it's still possible that this API could change before version 1.0,
it is not very likely and has been stable for a while.
all: move stream namespaces into stream package
all: allow negotiating received sessions