Import btcrpcclient repo into rpcclient directory.

This commit contains the entire btcrpcclient repository along with
several changes needed to move all of the files into the rpcclient
directory in order to prepare it for merging.  This does NOT update btcd
or any of the other packages to use the new location as that will be
done separately.

- All import paths in the old btcrpcclient files have been changed to
  the new location
- All references to btcrpcclient as the package name have been changed to
  rpcclient
This commit is contained in:
Dave Collins 2017-07-21 21:53:54 -05:00
parent c72658166a
commit 074b2374b8
No known key found for this signature in database
GPG key ID: B8904D9D9C93D1F2
23 changed files with 62 additions and 178 deletions

28
.gitignore vendored
View file

@ -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

View file

@ -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

16
LICENSE
View file

@ -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.

View file

@ -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

View file

@ -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.

View file

@ -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"

View file

@ -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

View file

@ -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
```

View file

@ -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)
}

View file

@ -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
```

View file

@ -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)
}

View file

@ -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
```

View file

@ -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)
}

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"