桃花长相依
就像您正在使用的 go-xmpp 包的示例一样,它也需要 tls 的端口。因此,如果没有它,它将尝试连接到 HTTP 端点并给你这个错误。当端点仅支持带有未知 CA 证书的 HTTP 或 HTTPS 时,您将看到类似的错误。请注意,您使用的包还支持 No TLS 双重检查 DuckGo xmpp 要求并更改您的代码以匹配它们。例子https://github.com/mattn/go-xmpp/blob/master/_example/example.go// Server has the portvar 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 codevar talk *xmpp.Clientvar err erroroptions := xmpp.Options{Host: *server, User: *username, Password: *password, NoTLS: *notls, Debug: *debug, Session: *session, Status: *status, StatusMessage: *statusMessage,}talk, err = options.NewClient()