From 3f5b78f173d500b84aac0032d5c5e47873a17843 Mon Sep 17 00:00:00 2001 From: xengineering Date: Wed, 3 May 2023 20:33:09 +0200 Subject: 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. --- xmpp.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'xmpp.go') 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 -- cgit v1.2.3-70-g09d2