Compare commits
No commits in common. "30ec9e14fb788c4a918aca189c4bbc7a80d28ecc" and "3f618b50f558dea6daf13c71a7def3a4371a40ea" have entirely different histories.
30ec9e14fb
...
3f618b50f5
|
|
@ -115,7 +115,7 @@ func startTLS(stream *Stream, config *ClientConfig) error {
|
|||
return err
|
||||
}
|
||||
|
||||
tlsConfig := tls.Config{InsecureSkipVerify: config.InsecureSkipVerify, ServerName: stream.connDomain}
|
||||
tlsConfig := tls.Config{InsecureSkipVerify: config.InsecureSkipVerify}
|
||||
return stream.UpgradeTLS(&tlsConfig)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,18 +27,7 @@ func HomeServerAddrs(jid JID) (addr []string, err error) {
|
|||
|
||||
// Build list of "host:port" strings.
|
||||
for _, a := range addrs {
|
||||
target := parseTargetDomainName(a.Target)
|
||||
addr = append(addr, fmt.Sprintf("%s:%d", target, a.Port))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Remove the last dot in the domain name if exist
|
||||
func parseTargetDomainName(domainName string) (ret string) {
|
||||
if domainName[len(domainName)-1] == '.' {
|
||||
ret = parseTargetDomainName(domainName[:len(domainName)-1])
|
||||
} else {
|
||||
ret = domainName
|
||||
addr = append(addr, fmt.Sprintf("%s:%d", a.Target, a.Port))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -172,5 +172,4 @@ var (
|
|||
FeatureNotImplemented = ErrorCondition{nsErrorStanzas, "feature-not-implemented"}
|
||||
RemoteServerNotFound = ErrorCondition{nsErrorStanzas, "remote-server-not-found"}
|
||||
ServiceUnavailable = ErrorCondition{nsErrorStanzas, "service-unavailable"}
|
||||
NotAuthorized = ErrorCondition{nsErrorStanzas, "not-authorized"}
|
||||
)
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import (
|
|||
"io"
|
||||
"log"
|
||||
"net"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Stream configuration.
|
||||
|
|
@ -25,7 +24,6 @@ type Stream struct {
|
|||
config *StreamConfig
|
||||
stanzaBuf string
|
||||
incomingNamespace nsMap
|
||||
connDomain string
|
||||
}
|
||||
|
||||
// Create a XML stream connection. A Steam is used by an XMPP instance to
|
||||
|
|
@ -43,7 +41,7 @@ func NewStream(addr string, config *StreamConfig) (*Stream, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
stream := &Stream{conn: conn, dec: xml.NewDecoder(conn), config: config, connDomain: strings.SplitN(addr, ":", 2)[0]}
|
||||
stream := &Stream{conn: conn, dec: xml.NewDecoder(conn), config: config}
|
||||
|
||||
if err := stream.send([]byte("<?xml version='1.0' encoding='utf-8'?>")); err != nil {
|
||||
return nil, err
|
||||
|
|
|
|||
Loading…
Reference in New Issue