a7ee4181d58d22d5b3f17337fb66aca1afbb6849 — Sam Whited 2 years ago fca5c14
xmpp: minor documentation fixes and tweaks

[ci skip]
2 files changed, 6 insertions(+), 6 deletions(-)

M features.go
M starttls.go
M features.go => features.go +6 -4
@@ 17,8 17,10 @@ import (

// A StreamFeature represents a feature that may be selected during stream
// negotiation, eg. STARTTLS, compression, and SASL authentication are all
// stream features. Features should be stateless as they may be reused between
// connection attempts.
// stream features.
// Features should be stateless as they may be reused between
// connection attempts, however, a method for passing state between features
// exists on the Parse and Negotiate functions.
type StreamFeature struct {
	// The XML name of the feature in the <stream:feature/> list. If a start
	// element with this name is seen while the connection is reading the features

@@ 48,7 50,7 @@ type StreamFeature struct {
	// (which should have a Name that matches this stream feature's Name).
	// Returns whether or not the feature is required, and any data that will be
	// needed if the feature is selected for negotiation (eg. the list of
	// mechanisms if the feature was SASL).
	// mechanisms if the feature was SASL authentication).
	Parse func(ctx context.Context, r xml.TokenReader, start *xml.StartElement) (req bool, data interface{}, err error)

	// A function that will take over the session temporarily while negotiating

@@ 84,7 86,7 @@ func negotiateFeatures(ctx context.Context, s *Session, features []StreamFeature
	var ok bool

	if !server {
		// Read a new startstream:features token.
		// Read a new start stream:features token.
		t, err = s.Token()
		if err != nil {
			return mask, nil, err

M starttls.go => starttls.go +0 -2
@@ 19,8 19,6 @@ import (
// BUG(ssw): STARTTLS feature does not have security layer byte precision.

// StartTLS returns a new stream feature that can be used for negotiating TLS.
// For StartTLS to work, the underlying connection must support TLS (it must
// implement net.Conn).
func StartTLS(required bool, cfg *tls.Config) StreamFeature {
	return StreamFeature{
		Name:       xml.Name{Local: "starttls", Space: ns.StartTLS},