diff options
author | xengineering <me@xengineering.eu> | 2023-05-03 20:33:09 +0200 |
---|---|---|
committer | xengineering <me@xengineering.eu> | 2023-05-03 20:33:09 +0200 |
commit | 3f5b78f173d500b84aac0032d5c5e47873a17843 (patch) | |
tree | 9cd38ed65f020c618b95f3277326072452164d05 | |
parent | 4d4d3f00ddee089de5b29bfe322022173c239aff (diff) | |
download | limox-3f5b78f173d500b84aac0032d5c5e47873a17843.tar limox-3f5b78f173d500b84aac0032d5c5e47873a17843.tar.zst limox-3f5b78f173d500b84aac0032d5c5e47873a17843.zip |
Switch to direct TLS with hard-coded port
This is not compliant with the XMPP specification but allows to develop
quite fast with production servers.
-rw-r--r-- | xmpp.go | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -2,7 +2,8 @@ package main import ( "log" - "net" + "crypto/tls" + "crypto/x509" ) type XmppEvent uint8 @@ -18,14 +19,13 @@ func (l *Limox) xmpp(jid string, pwd string) { domain := domainpart(jid) log.Printf("Domain: '%s'\n", domain) - tcpServer, err := net.ResolveTCPAddr("tcp", domain+":"+"5222") + roots, err := x509.SystemCertPool() if err != nil { l.XmppEvents <- err return } - log.Printf("Server: %s\n", tcpServer) - conn, err := net.DialTCP("tcp", nil, tcpServer) + conn, err := tls.Dial("tcp", domain+":"+"5223", &tls.Config{RootCAs: roots}) if err != nil { l.XmppEvents <- err return |