~samwhited/xmpp

20078796f15c3da8e62ea91bb3cedb4d53188183 — Sam Whited 4 years ago 3e4150a
Make session addr functions return JID
3 files changed, 4 insertions(+), 6 deletions(-)

M sasl.go
M session.go
M starttls.go
M sasl.go => sasl.go +1 -2
@@ 14,7 14,6 @@ import (

	"mellium.im/sasl"
	"mellium.im/xmpp/internal/saslerr"
	"mellium.im/xmpp/jid"
	"mellium.im/xmpp/ns"
	"mellium.im/xmpp/streamerror"
)


@@ 93,7 92,7 @@ func SASL(mechanisms ...sasl.Mechanism) StreamFeature {
			c := session.Config()
			opts := []sasl.Option{
				sasl.Authz(c.Identity),
				sasl.Credentials(session.LocalAddr().(*jid.JID).Localpart(), c.Password),
				sasl.Credentials(session.LocalAddr().Localpart(), c.Password),
				sasl.RemoteMechanisms(data.([]string)...),
			}
			if tlsconn, ok := conn.(*tls.Conn); ok {

M session.go => session.go +2 -2
@@ 168,7 168,7 @@ func (s *Session) State() SessionState {

// LocalAddr returns the Origin address for initiated connections, or the
// Location for received connections.
func (s *Session) LocalAddr() net.Addr {
func (s *Session) LocalAddr() *jid.JID {
	if (s.state & Received) == Received {
		return s.config.Location
	}


@@ 180,7 180,7 @@ func (s *Session) LocalAddr() net.Addr {

// RemoteAddr returns the Location address for initiated connections, or the
// Origin address for received connections.
func (s *Session) RemoteAddr() net.Addr {
func (s *Session) RemoteAddr() *jid.JID {
	if (s.state & Received) == Received {
		return s.config.Origin
	}

M starttls.go => starttls.go +1 -2
@@ 12,7 12,6 @@ import (
	"fmt"
	"io"

	"mellium.im/xmpp/jid"
	"mellium.im/xmpp/ns"
	"mellium.im/xmpp/streamerror"
)


@@ 66,7 65,7 @@ func StartTLS(required bool) StreamFeature {
			var tlsconf *tls.Config
			if session.config.TLSConfig == nil {
				tlsconf = &tls.Config{
					ServerName: session.LocalAddr().(*jid.JID).Domain().String(),
					ServerName: session.LocalAddr().Domain().String(),
				}
			} else {
				tlsconf = session.config.TLSConfig