Like the go-xmpp package example that you use, it expects a port for tls as well.
Thus, without it, it will try to connect to the HTTP endpoint and give you this error. You will see such errors when the endpoint only supports HTTP or HTTPS with an unknown CA certificate.
Please note that the package you are using also supports No TLS double-checking DuckGo xmpp requirements and changing your code to match them.
Other posts like this
Example
https://github.com/mattn/go-xmpp/blob/master/_example/example.go
// Server has the port var server = flag.String("server", "talk.google.com:443", "server") var username = flag.String("username", "", "username") var password = flag.String("password", "", "password") var status = flag.String("status", "xa", "status") var statusMessage = flag.String("status-msg", "I for one welcome our new codebot overlords.", "status message") var notls = flag.Bool("notls", false, "No TLS") var debug = flag.Bool("debug", false, "debug output") var session = flag.Bool("session", false, "use server session") // Omitted code var talk *xmpp.Client var err error options := xmpp.Options{Host: *server, User: *username, Password: *password, NoTLS: *notls, Debug: *debug, Session: *session, Status: *status, StatusMessage: *statusMessage, } talk, err = options.NewClient()
source share