|
|
|
@ -237,6 +237,7 @@ func main() {
|
|
|
|
|
"Skip verification of TLS certificates (not recommended).")
|
|
|
|
|
flagRaw := getopt.BoolLong("raw", 0, "Send raw XML.")
|
|
|
|
|
flagListen := getopt.BoolLong("listen", 'l', "Listen for messages and print them to stdout.")
|
|
|
|
|
flagTimeout := getopt.IntLong("timeout", 0, 10, "Connection timeout in seconds.")
|
|
|
|
|
|
|
|
|
|
// Parse command line flags.
|
|
|
|
|
getopt.Parse()
|
|
|
|
@ -316,6 +317,9 @@ func main() {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Timeout
|
|
|
|
|
timeout := time.Duration(*flagTimeout * 1000000000)
|
|
|
|
|
|
|
|
|
|
// Use ALPN
|
|
|
|
|
var tlsConfig tls.Config
|
|
|
|
|
tlsConfig.ServerName = user[strings.Index(user, "@")+1:]
|
|
|
|
@ -324,11 +328,9 @@ func main() {
|
|
|
|
|
|
|
|
|
|
// Set XMPP connection options.
|
|
|
|
|
options := xmpp.Options{
|
|
|
|
|
Host: server,
|
|
|
|
|
User: user,
|
|
|
|
|
// TODO: Check whether the timeout is reasonable or maybe make
|
|
|
|
|
// it configurable
|
|
|
|
|
DialTimeout: 1 * time.Second,
|
|
|
|
|
Host: server,
|
|
|
|
|
User: user,
|
|
|
|
|
DialTimeout: timeout,
|
|
|
|
|
Resource: resource,
|
|
|
|
|
Password: password,
|
|
|
|
|
// NoTLS doesn't mean that no TLS is used at all but that instead
|
|
|
|
|