Skip to content
Snippets Groups Projects
Commit ea9f3b5d authored by Jonah Husson's avatar Jonah Husson
Browse files

use RequestTlsCert for isOnline

parent 33091dca
No related branches found
No related tags found
2 merge requests!61Hotfix/fix is online,!39Merge release into master
...@@ -4,6 +4,7 @@ import ( ...@@ -4,6 +4,7 @@ import (
"crypto/tls" "crypto/tls"
"crypto/x509" "crypto/x509"
"net/http" "net/http"
"net/http/httptrace"
"regexp" "regexp"
"strings" "strings"
"time" "time"
...@@ -203,29 +204,29 @@ func (wc *webConn) isOnlineHelper(addr string, pingTimeout time.Duration) (time. ...@@ -203,29 +204,29 @@ func (wc *webConn) isOnlineHelper(addr string, pingTimeout time.Duration) (time.
Transport: tr, Transport: tr,
Timeout: pingTimeout, Timeout: pingTimeout,
} }
target := "https://" + addr target := "https://" + addr + "/mixmessages.Gateway/RequestTlsCert"
req, err := http.NewRequest("GET", target, nil) req, err := http.NewRequest("GET", target, nil)
if err != nil { if err != nil {
jww.WARN.Printf("Failed to initiate request: %+v", err) jww.WARN.Printf("Failed to initiate request: %+v", err)
return time.Since(start), false return time.Since(start), false
} }
//trace := &httptrace.ClientTrace{ trace := &httptrace.ClientTrace{
// DNSDone: func(dnsInfo httptrace.DNSDoneInfo) { DNSDone: func(dnsInfo httptrace.DNSDoneInfo) {
// jww.TRACE.Printf("DNS Info: %+v\n", dnsInfo) jww.TRACE.Printf("DNS Info: %+v\n", dnsInfo)
// }, },
// GotConn: func(connInfo httptrace.GotConnInfo) { GotConn: func(connInfo httptrace.GotConnInfo) {
// jww.TRACE.Printf("Got Conn: %+v\n", connInfo) jww.TRACE.Printf("Got Conn: %+v\n", connInfo)
// }, },
// GotFirstResponseByte: func() { GotFirstResponseByte: func() {
// jww.TRACE.Print("Got first byte!") jww.TRACE.Print("Got first byte!")
// }, },
//} }
// IMPORTANT - enables better HTTP(S) discovery, because many browsers block CORS by default. // IMPORTANT - enables better HTTP(S) discovery, because many browsers block CORS by default.
req.Header = wc.addHeaders(req.Header) req.Header = wc.addHeaders(req.Header)
jww.TRACE.Printf("(GO request): %+v", req) jww.TRACE.Printf("(GO request): %+v", req)
//req = req.WithContext(httptrace.WithClientTrace(req.Context(), trace)) req = req.WithContext(httptrace.WithClientTrace(req.Context(), trace))
if _, err = client.Do(req); err != nil { if _, err = client.Do(req); err != nil {
jww.TRACE.Printf("(GO error): %s", err.Error()) jww.TRACE.Printf("(GO error): %s", err.Error())
if checkErrorExceptions(err) { if checkErrorExceptions(err) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment