summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2023-05-03 20:33:09 +0200
committerxengineering <me@xengineering.eu>2023-05-03 20:33:09 +0200
commit3f5b78f173d500b84aac0032d5c5e47873a17843 (patch)
tree9cd38ed65f020c618b95f3277326072452164d05
parent4d4d3f00ddee089de5b29bfe322022173c239aff (diff)
downloadlimox-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.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/xmpp.go b/xmpp.go
index 8078c1a..abc098d 100644
--- a/xmpp.go
+++ b/xmpp.go
@@ -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