Disable TLS connection, Return Error: starttls handshake: x509: certificate signed by unknown authority
chandler1142 opened this issue · 1 comments
chandler1142 commented
I set notls=true, but I got error as title when I start the example.go.
The root cause is you set InsecureSkipVerify=false when enable tls, but not set InsecureSkipVerify=true when disable tls. Unfortunately, the InsecureSkipVerify default value is false.
To fix this just add a fragment in example.go:
if !*notls {
xmpp.DefaultConfig = tls.Config{
ServerName: serverName(*server),
InsecureSkipVerify: false,
}
} else {
xmpp.DefaultConfig = tls.Config{
ServerName: serverName(*server),
InsecureSkipVerify:true,
}
}