|
|
|
@ -104,8 +104,8 @@ 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.")
|
|
|
|
|
flagTLSMinVersion := getopt.IntLong("tls-version", 0, 12,
|
|
|
|
|
flagTimeout := getopt.IntLong("timeout", 0, defaultTimeout, "Connection timeout in seconds.")
|
|
|
|
|
flagTLSMinVersion := getopt.IntLong("tls-version", 0, defaultTLSMinVersion,
|
|
|
|
|
"Minimal TLS version. 10 (TLSv1.0), 11 (TLSv1.1), 12 (TLSv1.2) or 13 (TLSv1.3).")
|
|
|
|
|
flagVersion := getopt.BoolLong("version", 0, "Show version information.")
|
|
|
|
|
flagMUCPassword := getopt.StringLong("muc-password", 0, "", "Password for password protected MUCs.")
|
|
|
|
@ -222,7 +222,7 @@ func main() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Timeout
|
|
|
|
|
timeout := time.Duration(*flagTimeout * 1000000000)
|
|
|
|
|
timeout := time.Duration(*flagTimeout) * time.Second
|
|
|
|
|
|
|
|
|
|
// Use ALPN
|
|
|
|
|
var tlsConfig tls.Config
|
|
|
|
@ -230,13 +230,13 @@ func main() {
|
|
|
|
|
tlsConfig.NextProtos = append(tlsConfig.NextProtos, "xmpp-client")
|
|
|
|
|
tlsConfig.InsecureSkipVerify = *flagSkipVerify
|
|
|
|
|
switch *flagTLSMinVersion {
|
|
|
|
|
case 10:
|
|
|
|
|
case defaultTLS10:
|
|
|
|
|
tlsConfig.MinVersion = tls.VersionTLS10
|
|
|
|
|
case 11:
|
|
|
|
|
case defaultTLS11:
|
|
|
|
|
tlsConfig.MinVersion = tls.VersionTLS11
|
|
|
|
|
case 12:
|
|
|
|
|
case defaultTLS12:
|
|
|
|
|
tlsConfig.MinVersion = tls.VersionTLS12
|
|
|
|
|
case 13:
|
|
|
|
|
case defaultTLS13:
|
|
|
|
|
tlsConfig.MinVersion = tls.VersionTLS13
|
|
|
|
|
default:
|
|
|
|
|
fmt.Println("Unknown TLS version.")
|
|
|
|
@ -307,8 +307,8 @@ func main() {
|
|
|
|
|
log.Fatal(err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
iqc := make(chan xmpp.IQ, 100)
|
|
|
|
|
msgc := make(chan xmpp.Chat, 100)
|
|
|
|
|
iqc := make(chan xmpp.IQ, defaultBufferSize)
|
|
|
|
|
msgc := make(chan xmpp.Chat, defaultBufferSize)
|
|
|
|
|
go rcvStanzas(client, iqc, msgc)
|
|
|
|
|
|
|
|
|
|
for _, r := range getopt.Args() {
|
|
|
|
@ -594,5 +594,5 @@ func main() {
|
|
|
|
|
|
|
|
|
|
// Wait for a short time as some messages are not delievered by the server
|
|
|
|
|
// if the connection is closed immediately after sending a message.
|
|
|
|
|
time.Sleep(100 * time.Millisecond)
|
|
|
|
|
time.Sleep(defaultSleepTime * time.Millisecond)
|
|
|
|
|
}
|
|
|
|
|