diff options
author | Bas van Kervel <bas@ethdev.com> | 2015-06-16 19:30:53 +0800 |
---|---|---|
committer | Bas van Kervel <bas@ethdev.com> | 2015-06-22 14:54:21 +0800 |
commit | 5c25403b13a698267230f859e822a7f714082198 (patch) | |
tree | e1c06257da1f318a331990165723c1f05447c117 | |
parent | fd764d4ff7bd7e75dfdd7f733f50dd3805d4b3f2 (diff) | |
download | go-tangerine-5c25403b13a698267230f859e822a7f714082198.tar go-tangerine-5c25403b13a698267230f859e822a7f714082198.tar.gz go-tangerine-5c25403b13a698267230f859e822a7f714082198.tar.bz2 go-tangerine-5c25403b13a698267230f859e822a7f714082198.tar.lz go-tangerine-5c25403b13a698267230f859e822a7f714082198.tar.xz go-tangerine-5c25403b13a698267230f859e822a7f714082198.tar.zst go-tangerine-5c25403b13a698267230f859e822a7f714082198.zip |
refactored old rpc structure to new
-rw-r--r-- | cmd/geth/main.go | 1 | ||||
-rw-r--r-- | cmd/utils/flags.go | 19 | ||||
-rw-r--r-- | rpc/api/api.go | 4 |
3 files changed, 20 insertions, 4 deletions
diff --git a/cmd/geth/main.go b/cmd/geth/main.go index 89aae43e5..43e45f6cc 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -239,6 +239,7 @@ JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Conso utils.RPCEnabledFlag, utils.RPCListenAddrFlag, utils.RPCPortFlag, + utils.RpcApiFlag, utils.IPCDisabledFlag, utils.IPCApiFlag, utils.IPCPathFlag, diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 696dbd142..e0eefb3e3 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -22,7 +22,6 @@ import ( "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/logger/glog" "github.com/ethereum/go-ethereum/p2p/nat" - "github.com/ethereum/go-ethereum/rpc" "github.com/ethereum/go-ethereum/rpc/api" "github.com/ethereum/go-ethereum/rpc/codec" "github.com/ethereum/go-ethereum/rpc/comms" @@ -209,13 +208,18 @@ var ( Usage: "Domain on which to send Access-Control-Allow-Origin header", Value: "", } + RpcApiFlag = cli.StringFlag{ + Name: "rpcapi", + Usage: "Specify the API's which are offered over the HTTP RPC interface", + Value: api.DefaultHttpRpcApis, + } IPCDisabledFlag = cli.BoolFlag{ Name: "ipcdisable", Usage: "Disable the IPC-RPC server", } IPCApiFlag = cli.StringFlag{ Name: "ipcapi", - Usage: "Specify the API's which are offered over this interface", + Usage: "Specify the API's which are offered over the IPC interface", Value: api.DefaultIpcApis, } IPCPathFlag = DirectoryFlag{ @@ -457,14 +461,21 @@ func StartIPC(eth *eth.Ethereum, ctx *cli.Context) error { } func StartRPC(eth *eth.Ethereum, ctx *cli.Context) error { - config := rpc.RpcConfig{ + config := comms.HttpConfig{ ListenAddress: ctx.GlobalString(RPCListenAddrFlag.Name), ListenPort: uint(ctx.GlobalInt(RPCPortFlag.Name)), CorsDomain: ctx.GlobalString(RPCCORSDomainFlag.Name), } xeth := xeth.New(eth, nil) - return rpc.Start(xeth, config) + codec := codec.JSON + + apis, err := api.ParseApiString(ctx.GlobalString(RpcApiFlag.Name), codec, xeth, eth) + if err != nil { + return err + } + + return comms.StartHttp(config, codec, apis...) } func StartPProf(ctx *cli.Context) { diff --git a/rpc/api/api.go b/rpc/api/api.go index e431e5c1e..dec67fed1 100644 --- a/rpc/api/api.go +++ b/rpc/api/api.go @@ -20,6 +20,10 @@ const ( ) var ( + DefaultHttpRpcApis = strings.Join([]string{ + EthApiName, NetApiName, Web3ApiName, + }, ",") + // List with all API's which are offered over the IPC interface by default DefaultIpcApis = strings.Join([]string{ AdminApiName, EthApiName, DebugApiName, MinerApiName, NetApiName, |