// SASL negotiation. RFC 6120, section 6 func (d *dialer) negotiateSASL(c interfaces.Conn) error { user := d.getJIDLocalpart() password := d.password if err := c.Authenticate(user, password); err != nil { return xe.ErrAuthenticationFailed } // RFC 6120, section 6.3.2. Restart the stream err := c.SendInitialStreamHeader() if err != nil { return err } return c.BindResource() }