Add the possibility to disable certificat verification

This commit is contained in:
Chteufleur 2016-08-15 22:16:03 +02:00
parent 7e9fd69879
commit e2fbb6c8e3
4 changed files with 6 additions and 2 deletions

View File

@ -33,6 +33,7 @@ XMPP
* __xmpp_jid__ : Account JID
* __xmpp_secret__ : Account password
* xmpp_debug : Enable debug log at true (default: false)
* xmpp_verify_cert_validity : Enable certificate verification (default: true)
HTTP
* http_port : HTTP port to bind (default: 9090, desactive: -1)

View File

@ -4,6 +4,7 @@ xmpp_server_port=5347
xmpp_jid=xmppsteam.kingpenguin.tk
xmpp_secret=xmpp4steam_password
xmpp_debug=true
xmpp_verify_cert_validity=true
# HTTP informations
http_port=9090

View File

@ -63,6 +63,7 @@ func init() {
xmpp.JidStr = mapConfig["xmpp_jid"]
xmpp.Secret = mapConfig["xmpp_secret"]
xmpp.Debug = mapConfig["xmpp_debug"] == "true"
xmpp.VerifyCertValidity = mapConfig["xmpp_verify_cert_validity"] != "false" // Default TRUE
}
func main() {

View File

@ -36,6 +36,7 @@ var (
WaitIqMessages = make(map[string]*Confirmation)
Debug = true
VerifyCertValidity = true
)
func Run() {
@ -75,7 +76,7 @@ func Run() {
if isComponent {
comp = must(xmpp.NewComponentXMPP(stream, jid, Secret)).(*xmpp.XMPP)
} else {
comp = must(xmpp.NewClientXMPP(stream, jid, Secret, &xmpp.ClientConfig{InsecureSkipVerify: false})).(*xmpp.XMPP)
comp = must(xmpp.NewClientXMPP(stream, jid, Secret, &xmpp.ClientConfig{InsecureSkipVerify: !VerifyCertValidity})).(*xmpp.XMPP)
comp.Out <- xmpp.Presence{}
}