diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 612e2e96..00000000 --- a/.gitignore +++ /dev/null @@ -1,28 +0,0 @@ -# Temp files -*~ - -# Log files -*.log - -# Compiled Object files, Static and Dynamic libs (Shared Objects) -*.o -*.a -*.so - -# Folders -_obj -_test - -# Architecture specific extensions/prefixes -*.[568vq] -[568vq].out - -*.cgo1.go -*.cgo2.c -_cgo_defun.c -_cgo_gotypes.go -_cgo_export.* - -_testmain.go - -*.exe diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 65aa0a9d..00000000 --- a/.travis.yml +++ /dev/null @@ -1,12 +0,0 @@ -language: go -go: - - 1.6.x - - 1.7.x -sudo: false -install: - - go get -d -t -v ./... - - go get -v github.com/alecthomas/gometalinter - - gometalinter --install -script: - - export PATH=$PATH:$HOME/gopath/bin - - ./goclean.sh diff --git a/LICENSE b/LICENSE deleted file mode 100644 index f627807e..00000000 --- a/LICENSE +++ /dev/null @@ -1,16 +0,0 @@ -ISC License - -Copyright (c) 2014-2016 The btcsuite developers -Copyright (c) 2015-2016 The Decred developers - -Permission to use, copy, modify, and distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/goclean.sh b/goclean.sh deleted file mode 100755 index 3c1f084f..00000000 --- a/goclean.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash -# The script does automatic checking on a Go package and its sub-packages, including: -# 1. gofmt (http://golang.org/cmd/gofmt/) -# 2. goimports (https://github.com/bradfitz/goimports) -# 3. golint (https://github.com/golang/lint) -# 4. go vet (http://golang.org/cmd/vet) -# 5. gosimple (https://github.com/dominikh/go-simple) -# 6. unconvert (https://github.com/mdempsky/unconvert) -# 7. race detector (http://blog.golang.org/race-detector) -# 8. test coverage (http://blog.golang.org/cover) -# -# gometalinter (github.com/alecthomas/gometalinter) is used to run each static -# checker. - -set -ex - -# Make sure gometalinter is installed and $GOPATH/bin is in your path. -# $ go get -v github.com/alecthomas/gometalinter" -# $ gometalinter --install" -if [ ! -x "$(type -p gometalinter)" ]; then - exit 1 -fi - -# Automatic checks -test -z "$(gometalinter --disable-all \ ---enable=gofmt \ ---enable=goimports \ ---enable=golint \ ---enable=vet \ ---enable=gosimple \ ---enable=unconvert \ ---deadline=45s ./... | tee /dev/stderr)" -env GORACE="halt_on_error=1" go test -race ./... - -# Run test coverage on each subdirectories and merge the coverage profile. - -set +x -echo "mode: count" > profile.cov - -# Standard go tooling behavior is to ignore dirs with leading underscores. -for dir in $(find . -maxdepth 10 -not -path '.' -not -path './.git*' \ - -not -path '*/_*' -type d); -do -if ls $dir/*.go &> /dev/null; then - go test -covermode=count -coverprofile=$dir/profile.tmp $dir - if [ -f $dir/profile.tmp ]; then - cat $dir/profile.tmp | tail -n +2 >> profile.cov - rm $dir/profile.tmp - fi -fi -done - -go tool cover -func profile.cov - -# To submit the test coverage result to coveralls.io, -# use goveralls (https://github.com/mattn/goveralls) -# goveralls -coverprofile=profile.cov -service=travis-ci diff --git a/CONTRIBUTORS b/rpcclient/CONTRIBUTORS similarity index 100% rename from CONTRIBUTORS rename to rpcclient/CONTRIBUTORS diff --git a/README.md b/rpcclient/README.md similarity index 65% rename from README.md rename to rpcclient/README.md index 9c3b329e..9c3ef18f 100644 --- a/README.md +++ b/rpcclient/README.md @@ -1,14 +1,14 @@ -btcrpcclient -============ +rpcclient +========= -[![Build Status](http://img.shields.io/travis/btcsuite/btcrpcclient.svg)](https://travis-ci.org/btcsuite/btcrpcclient) +[![Build Status](http://img.shields.io/travis/btcsuite/btcd.svg)](https://travis-ci.org/btcsuite/btcd) [![ISC License](http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org) -[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](http://godoc.org/github.com/btcsuite/btcrpcclient) +[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](http://godoc.org/github.com/btcsuite/btcd/rpcclient) -btcrpcclient implements a Websocket-enabled Bitcoin JSON-RPC client package -written in [Go](http://golang.org/). It provides a robust and easy to use -client for interfacing with a Bitcoin RPC server that uses a btcd/bitcoin core -compatible Bitcoin JSON-RPC API. +rpcclient implements a Websocket-enabled Bitcoin JSON-RPC client package written +in [Go](http://golang.org/). It provides a robust and easy to use client for +interfacing with a Bitcoin RPC server that uses a btcd/bitcoin core compatible +Bitcoin JSON-RPC API. ## Status @@ -18,16 +18,16 @@ implement and the API is not stable yet. ## Documentation -* [API Reference](http://godoc.org/github.com/btcsuite/btcrpcclient) -* [btcd Websockets Example](https://github.com/btcsuite/btcrpcclient/blob/master/examples/btcdwebsockets) +* [API Reference](http://godoc.org/github.com/btcsuite/rpcclient) +* [btcd Websockets Example](https://github.com/btcsuite/btcd/rpcclient/blob/master/examples/btcdwebsockets) Connects to a btcd RPC server using TLS-secured websockets, registers for block connected and block disconnected notifications, and gets the current block count -* [btcwallet Websockets Example](https://github.com/btcsuite/btcrpcclient/blob/master/examples/btcwalletwebsockets) +* [btcwallet Websockets Example](https://github.com/btcsuite/btcd/rpcclient/blob/master/examples/btcwalletwebsockets) Connects to a btcwallet RPC server using TLS-secured websockets, registers for notifications about changes to account balances, and gets a list of unspent transaction outputs (utxos) the wallet can sign -* [Bitcoin Core HTTP POST Example](https://github.com/btcsuite/btcrpcclient/blob/master/examples/bitcoincorehttp) +* [Bitcoin Core HTTP POST Example](https://github.com/btcsuite/btcd/rpcclient/blob/master/examples/bitcoincorehttp) Connects to a bitcoin core RPC server using HTTP POST mode with TLS disabled and gets the current block count @@ -47,10 +47,10 @@ implement and the API is not stable yet. ## Installation ```bash -$ go get -u github.com/btcsuite/btcrpcclient +$ go get -u github.com/btcsuite/btcd/rpcclient ``` ## License -Package btcrpcclient is licensed under the [copyfree](http://copyfree.org) ISC +Package rpcclient is licensed under the [copyfree](http://copyfree.org) ISC License. diff --git a/chain.go b/rpcclient/chain.go similarity index 99% rename from chain.go rename to rpcclient/chain.go index 592e1887..2539bc80 100644 --- a/chain.go +++ b/rpcclient/chain.go @@ -3,7 +3,7 @@ // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. -package btcrpcclient +package rpcclient import ( "bytes" diff --git a/doc.go b/rpcclient/doc.go similarity index 98% rename from doc.go rename to rpcclient/doc.go index 43882e01..d4bbb64d 100644 --- a/doc.go +++ b/rpcclient/doc.go @@ -1,9 +1,9 @@ -// Copyright (c) 2014 The btcsuite developers +// Copyright (c) 2014-2017 The btcsuite developers // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. /* -Package btcrpcclient implements a websocket-enabled Bitcoin JSON-RPC client. +Package rpcclient implements a websocket-enabled Bitcoin JSON-RPC client. Overview @@ -175,4 +175,4 @@ The following full-blown client examples are in the examples directory: for notifications about changes to account balances, and gets a list of unspent transaction outputs (utxos) the wallet can sign */ -package btcrpcclient +package rpcclient diff --git a/examples/bitcoincorehttp/README.md b/rpcclient/examples/bitcoincorehttp/README.md similarity index 65% rename from examples/bitcoincorehttp/README.md rename to rpcclient/examples/bitcoincorehttp/README.md index cc1dfa30..4d1f0adf 100644 --- a/examples/bitcoincorehttp/README.md +++ b/rpcclient/examples/bitcoincorehttp/README.md @@ -1,17 +1,16 @@ Bitcoin Core HTTP POST Example ============================== -This example shows how to use the btcrpcclient package to connect to a Bitcoin +This example shows how to use the rpcclient package to connect to a Bitcoin Core RPC server using HTTP POST mode with TLS disabled and gets the current block count. ## Running the Example -The first step is to use `go get` to download and install the btcrpcclient -package: +The first step is to use `go get` to download and install the rpcclient package: ```bash -$ go get github.com/btcsuite/btcrpcclient +$ go get github.com/btcsuite/btcd/rpcclient ``` Next, modify the `main.go` source to specify the correct RPC username and @@ -25,7 +24,7 @@ password for the RPC server: Finally, navigate to the example's directory and run it with: ```bash -$ cd $GOPATH/src/github.com/btcsuite/btcrpcclient/examples/bitcoincorehttp +$ cd $GOPATH/src/github.com/btcsuite/btcd/rpcclient/examples/bitcoincorehttp $ go run *.go ``` diff --git a/examples/bitcoincorehttp/main.go b/rpcclient/examples/bitcoincorehttp/main.go similarity index 81% rename from examples/bitcoincorehttp/main.go rename to rpcclient/examples/bitcoincorehttp/main.go index 1f5f8b35..489770a2 100644 --- a/examples/bitcoincorehttp/main.go +++ b/rpcclient/examples/bitcoincorehttp/main.go @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2015 The btcsuite developers +// Copyright (c) 2014-2017 The btcsuite developers // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. @@ -7,12 +7,12 @@ package main import ( "log" - "github.com/btcsuite/btcrpcclient" + "github.com/btcsuite/btcd/rpcclient" ) func main() { // Connect to local bitcoin core RPC server using HTTP POST mode. - connCfg := &btcrpcclient.ConnConfig{ + connCfg := &rpcclient.ConnConfig{ Host: "localhost:8332", User: "yourrpcuser", Pass: "yourrpcpass", @@ -21,7 +21,7 @@ func main() { } // Notice the notification parameter is nil since notifications are // not supported in HTTP POST mode. - client, err := btcrpcclient.New(connCfg, nil) + client, err := rpcclient.New(connCfg, nil) if err != nil { log.Fatal(err) } diff --git a/examples/btcdwebsockets/README.md b/rpcclient/examples/btcdwebsockets/README.md similarity index 62% rename from examples/btcdwebsockets/README.md rename to rpcclient/examples/btcdwebsockets/README.md index b6050fef..a1686484 100644 --- a/examples/btcdwebsockets/README.md +++ b/rpcclient/examples/btcdwebsockets/README.md @@ -1,8 +1,8 @@ btcd Websockets Example ======================= -This example shows how to use the btcrpcclient package to connect to a btcd -RPC server using TLS-secured websockets, register for block connected and block +This example shows how to use the rpcclient package to connect to a btcd RPC +server using TLS-secured websockets, register for block connected and block disconnected notifications, and get the current block count. This example also sets a timer to shutdown the client after 10 seconds to @@ -10,11 +10,10 @@ demonstrate clean shutdown. ## Running the Example -The first step is to use `go get` to download and install the btcrpcclient -package: +The first step is to use `go get` to download and install the rpcclient package: ```bash -$ go get github.com/btcsuite/btcrpcclient +$ go get github.com/btcsuite/btcd/rpcclient ``` Next, modify the `main.go` source to specify the correct RPC username and @@ -28,7 +27,7 @@ password for the RPC server: Finally, navigate to the example's directory and run it with: ```bash -$ cd $GOPATH/src/github.com/btcsuite/btcrpcclient/examples/btcdwebsockets +$ cd $GOPATH/src/github.com/btcsuite/btcd/rpcclient/examples/btcdwebsockets $ go run *.go ``` diff --git a/examples/btcdwebsockets/main.go b/rpcclient/examples/btcdwebsockets/main.go similarity index 89% rename from examples/btcdwebsockets/main.go rename to rpcclient/examples/btcdwebsockets/main.go index 96c50a19..56d12d82 100644 --- a/examples/btcdwebsockets/main.go +++ b/rpcclient/examples/btcdwebsockets/main.go @@ -10,17 +10,17 @@ import ( "path/filepath" "time" + "github.com/btcsuite/btcd/rpcclient" "github.com/btcsuite/btcd/wire" - "github.com/btcsuite/btcrpcclient" "github.com/btcsuite/btcutil" ) func main() { // Only override the handlers for notifications you care about. // Also note most of these handlers will only be called if you register - // for notifications. See the documentation of the btcrpcclient + // for notifications. See the documentation of the rpcclient // NotificationHandlers type for more details about each handler. - ntfnHandlers := btcrpcclient.NotificationHandlers{ + ntfnHandlers := rpcclient.NotificationHandlers{ OnFilteredBlockConnected: func(height int32, header *wire.BlockHeader, txns []*btcutil.Tx) { log.Printf("Block connected: %v (%d) %v", header.BlockHash(), height, header.Timestamp) @@ -37,14 +37,14 @@ func main() { if err != nil { log.Fatal(err) } - connCfg := &btcrpcclient.ConnConfig{ + connCfg := &rpcclient.ConnConfig{ Host: "localhost:8334", Endpoint: "ws", User: "yourrpcuser", Pass: "yourrpcpass", Certificates: certs, } - client, err := btcrpcclient.New(connCfg, &ntfnHandlers) + client, err := rpcclient.New(connCfg, &ntfnHandlers) if err != nil { log.Fatal(err) } diff --git a/examples/btcwalletwebsockets/README.md b/rpcclient/examples/btcwalletwebsockets/README.md similarity index 71% rename from examples/btcwalletwebsockets/README.md rename to rpcclient/examples/btcwalletwebsockets/README.md index 3d41e944..e495dff8 100644 --- a/examples/btcwalletwebsockets/README.md +++ b/rpcclient/examples/btcwalletwebsockets/README.md @@ -1,7 +1,7 @@ btcwallet Websockets Example ============================ -This example shows how to use the btcrpcclient package to connect to a btcwallet +This example shows how to use the rpcclient package to connect to a btcwallet RPC server using TLS-secured websockets, register for notifications about changes to account balances, and get a list of unspent transaction outputs (utxos) the wallet can sign. @@ -11,11 +11,10 @@ demonstrate clean shutdown. ## Running the Example -The first step is to use `go get` to download and install the btcrpcclient -package: +The first step is to use `go get` to download and install the rpcclient package: ```bash -$ go get github.com/btcsuite/btcrpcclient +$ go get github.com/btcsuite/btcd/rpcclient ``` Next, modify the `main.go` source to specify the correct RPC username and @@ -29,7 +28,7 @@ password for the RPC server: Finally, navigate to the example's directory and run it with: ```bash -$ cd $GOPATH/src/github.com/btcsuite/btcrpcclient/examples/btcwalletwebsockets +$ cd $GOPATH/src/github.com/btcsuite/btcd/rpcclient/examples/btcwalletwebsockets $ go run *.go ``` diff --git a/examples/btcwalletwebsockets/main.go b/rpcclient/examples/btcwalletwebsockets/main.go similarity index 86% rename from examples/btcwalletwebsockets/main.go rename to rpcclient/examples/btcwalletwebsockets/main.go index 545fe7bb..e803138d 100644 --- a/examples/btcwalletwebsockets/main.go +++ b/rpcclient/examples/btcwalletwebsockets/main.go @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2015 The btcsuite developers +// Copyright (c) 2014-2017 The btcsuite developers // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. @@ -10,7 +10,7 @@ import ( "path/filepath" "time" - "github.com/btcsuite/btcrpcclient" + "github.com/btcsuite/btcd/rpcclient" "github.com/btcsuite/btcutil" "github.com/davecgh/go-spew/spew" ) @@ -18,9 +18,9 @@ import ( func main() { // Only override the handlers for notifications you care about. // Also note most of the handlers will only be called if you register - // for notifications. See the documentation of the btcrpcclient + // for notifications. See the documentation of the rpcclient // NotificationHandlers type for more details about each handler. - ntfnHandlers := btcrpcclient.NotificationHandlers{ + ntfnHandlers := rpcclient.NotificationHandlers{ OnAccountBalance: func(account string, balance btcutil.Amount, confirmed bool) { log.Printf("New balance for account %s: %v", account, balance) @@ -33,14 +33,14 @@ func main() { if err != nil { log.Fatal(err) } - connCfg := &btcrpcclient.ConnConfig{ + connCfg := &rpcclient.ConnConfig{ Host: "localhost:18332", Endpoint: "ws", User: "yourrpcuser", Pass: "yourrpcpass", Certificates: certs, } - client, err := btcrpcclient.New(connCfg, &ntfnHandlers) + client, err := rpcclient.New(connCfg, &ntfnHandlers) if err != nil { log.Fatal(err) } diff --git a/extensions.go b/rpcclient/extensions.go similarity index 99% rename from extensions.go rename to rpcclient/extensions.go index e5315b9a..916ddb5f 100644 --- a/extensions.go +++ b/rpcclient/extensions.go @@ -3,7 +3,7 @@ // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. -package btcrpcclient +package rpcclient import ( "bytes" diff --git a/infrastructure.go b/rpcclient/infrastructure.go similarity index 99% rename from infrastructure.go rename to rpcclient/infrastructure.go index 8f6e2423..24f0ae99 100644 --- a/infrastructure.go +++ b/rpcclient/infrastructure.go @@ -1,8 +1,8 @@ -// Copyright (c) 2014-2016 The btcsuite developers +// Copyright (c) 2014-2017 The btcsuite developers // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. -package btcrpcclient +package rpcclient import ( "bytes" diff --git a/log.go b/rpcclient/log.go similarity index 94% rename from log.go rename to rpcclient/log.go index 1886a189..30226187 100644 --- a/log.go +++ b/rpcclient/log.go @@ -1,8 +1,8 @@ -// Copyright (c) 2014-2015 The btcsuite developers +// Copyright (c) 2014-2017 The btcsuite developers // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. -package btcrpcclient +package rpcclient import ( "github.com/btcsuite/btclog" diff --git a/mining.go b/rpcclient/mining.go similarity index 99% rename from mining.go rename to rpcclient/mining.go index aaf4b7f3..76a9d305 100644 --- a/mining.go +++ b/rpcclient/mining.go @@ -1,8 +1,8 @@ -// Copyright (c) 2014-2016 The btcsuite developers +// Copyright (c) 2014-2017 The btcsuite developers // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. -package btcrpcclient +package rpcclient import ( "encoding/hex" diff --git a/net.go b/rpcclient/net.go similarity index 99% rename from net.go rename to rpcclient/net.go index d4e91a81..aeda8b3c 100644 --- a/net.go +++ b/rpcclient/net.go @@ -1,8 +1,8 @@ -// Copyright (c) 2014-2015 The btcsuite developers +// Copyright (c) 2014-2017 The btcsuite developers // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. -package btcrpcclient +package rpcclient import ( "encoding/json" diff --git a/notify.go b/rpcclient/notify.go similarity index 99% rename from notify.go rename to rpcclient/notify.go index 600ae14c..9a0a3568 100644 --- a/notify.go +++ b/rpcclient/notify.go @@ -3,7 +3,7 @@ // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. -package btcrpcclient +package rpcclient import ( "bytes" diff --git a/rawrequest.go b/rpcclient/rawrequest.go similarity index 97% rename from rawrequest.go rename to rpcclient/rawrequest.go index b4df97d0..dd16fd04 100644 --- a/rawrequest.go +++ b/rpcclient/rawrequest.go @@ -1,8 +1,8 @@ -// Copyright (c) 2014-2015 The btcsuite developers +// Copyright (c) 2014-2017 The btcsuite developers // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. -package btcrpcclient +package rpcclient import ( "encoding/json" diff --git a/rawtransactions.go b/rpcclient/rawtransactions.go similarity index 99% rename from rawtransactions.go rename to rpcclient/rawtransactions.go index 0c934554..3bd6e5d3 100644 --- a/rawtransactions.go +++ b/rpcclient/rawtransactions.go @@ -1,8 +1,8 @@ -// Copyright (c) 2014-2016 The btcsuite developers +// Copyright (c) 2014-2017 The btcsuite developers // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. -package btcrpcclient +package rpcclient import ( "bytes" diff --git a/wallet.go b/rpcclient/wallet.go similarity index 99% rename from wallet.go rename to rpcclient/wallet.go index 3459d012..caea70b8 100644 --- a/wallet.go +++ b/rpcclient/wallet.go @@ -1,8 +1,8 @@ -// Copyright (c) 2014-2016 The btcsuite developers +// Copyright (c) 2014-2017 The btcsuite developers // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. -package btcrpcclient +package rpcclient import ( "encoding/json"