diff --git a/api.go b/api.go index ef52078..bf4ccb0 100644 --- a/api.go +++ b/api.go @@ -13,13 +13,15 @@ package gorqlite */ -import "bytes" -import "encoding/json" -import "errors" -import "fmt" -import "io/ioutil" -import "net/http" -import "time" +import ( + "bytes" + "encoding/json" + "errors" + "fmt" + "io/ioutil" + "net/http" + "time" +) /* ***************************************************************** diff --git a/gorqlite.go b/gorqlite.go index 89aece3..b529793 100644 --- a/gorqlite.go +++ b/gorqlite.go @@ -19,11 +19,15 @@ package gorqlite Open, TraceOn(), TraceOff() */ -import "crypto/rand" -import "fmt" -import "io" -import "io/ioutil" -import "strings" +import ( + "crypto/rand" + "crypto/tls" + "fmt" + "io" + "io/ioutil" + "net/http" + "strings" +) /* ***************************************************************** @@ -51,6 +55,8 @@ const ( api_WRITE ) +var InsecureSkipVerify bool + /* ***************************************************************** init() @@ -112,6 +118,11 @@ func Open(connURL string) (Connection, error) { return conn, err } + if conn.wantsHTTPS { + // allow using self signed certificates + http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: InsecureSkipVerify} + } + // call updateClusterInfo() to populate the cluster // also tests the user's default