rpc: refactor lib folder (#4836)

Closes https://github.com/tendermint/tendermint/issues/3857

Moves `lib/` folder to `jsonrpc/`.

Renames:

**packages**

`rpc` package -> `jsonrpc` package
`rpcclient` package -> `client` package
`rpcserver` package -> `server` package

**structs and interfaces**

```
JSONRPCClient to Client
JSONRPCRequestBatch to RequestBatch
JSONRPCCaller to Caller
```

**functions**

```
StartHTTPServer to Serve
StartHTTPAndTLSServer to ServeTLS

rpc/jsonrpc/client: rename NewURIClient to NewURI

NewJSONRPCClient to New
NewJSONRPCClientWithHTTPClient to NewWithHTTPClient
NewWSClient to NewWS
```

**misc**

- unexpose `ResponseWriterWrapper`
- remove unused http_params.go
This commit is contained in:
Anton Kaliaev
2020-05-13 16:40:57 +04:00
committed by GitHub
parent e20105e658
commit a14ff5cb30
57 changed files with 191 additions and 248 deletions

View File

@@ -11,8 +11,8 @@ import (
"github.com/tendermint/tendermint/rpc/client"
rpcclient "github.com/tendermint/tendermint/rpc/client"
ctypes "github.com/tendermint/tendermint/rpc/core/types"
rpcserver "github.com/tendermint/tendermint/rpc/lib/server"
rpctypes "github.com/tendermint/tendermint/rpc/lib/types"
rpcserver "github.com/tendermint/tendermint/rpc/jsonrpc/server"
rpctypes "github.com/tendermint/tendermint/rpc/jsonrpc/types"
"github.com/tendermint/tendermint/types"
)
@@ -54,7 +54,7 @@ func StartProxy(c rpcclient.Client, listenAddr string, logger log.Logger, maxOpe
if err != nil {
return err
}
return rpcserver.StartHTTPServer(l, mux, logger, config)
return rpcserver.Serve(l, mux, logger, config)
}
// RPCRoutes just routes everything to the given client, as if it were

View File

@@ -8,7 +8,7 @@ import (
"github.com/tendermint/tendermint/lite"
rpcclient "github.com/tendermint/tendermint/rpc/client"
ctypes "github.com/tendermint/tendermint/rpc/core/types"
rpctypes "github.com/tendermint/tendermint/rpc/lib/types"
rpctypes "github.com/tendermint/tendermint/rpc/jsonrpc/types"
)
var _ rpcclient.Client = Wrapper{}