diff --git a/README.md b/README.md index 65936f8..502e2fb 100644 --- a/README.md +++ b/README.md @@ -53,8 +53,12 @@ Mores examples in example.go (in examples folder) Documentation ----- +Click on the button below to access the full documentation: + [![GoDoc](https://godoc.org/github.com/Toorop/go-bitcoind?status.png)](https://godoc.org/github.com/Toorop/go-bitcoind) + + Unit tests ---- [![Build Status](https://travis-ci.org/Toorop/go-bitcoind.svg)](https://travis-ci.org/Toorop/go-bitcoind) @@ -80,14 +84,20 @@ To run tests: Test Suite Passed + + Todo ----- -* https * GetBlockTemplate * sendrawtransaction * signrawtransaction * submitblock +#####Note on SSL support + +Note on ssl support : bitcoind library doesn't verify the server's certificate chain. That means that it accepts any certificate presented by the server and any host name in that certificate. In this mode, TLS is susceptible to man-in-the-middle attacks. + + Donation ------ diff --git a/rpcClient.go b/rpcClient.go index 145fa8a..2230df4 100644 --- a/rpcClient.go +++ b/rpcClient.go @@ -2,12 +2,12 @@ package bitcoind import ( "bytes" + "crypto/tls" "encoding/json" "errors" "fmt" "io/ioutil" "net/http" - //"strings" "time" ) @@ -45,12 +45,18 @@ func newClient(host string, port int, user, passwd string, useSSL bool) (c *rpcC return } var serverAddr string + var httpClient *http.Client if useSSL { serverAddr = "https://" + t := &http.Transport{ + TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, + } + httpClient = &http.Client{Transport: t} } else { serverAddr = "http://" + httpClient = &http.Client{} } - c = &rpcClient{serverAddr: fmt.Sprintf("%s%s:%d", serverAddr, host, port), user: user, passwd: passwd, httpClient: &http.Client{}} + c = &rpcClient{serverAddr: fmt.Sprintf("%s%s:%d", serverAddr, host, port), user: user, passwd: passwd, httpClient: httpClient} return }