all: remove concept of public/private API definitions (#25053)

* internal/ethapi: rename PublicEthereumAPI to EthereumAPI

* eth: rename PublicEthereumAPI to EthereumAPI

* internal/ethapi: rename PublicTxPoolAPI to TxPoolAPI

* internal/ethapi: rename PublicAccountAPI to EthereumAccountAPI

* internal/ethapi: rename PrivateAccountAPI to PersonalAccountAPI

* internal/ethapi: rename PublicBlockChainAPI to BlockChainAPI

* internal/ethapi: rename PublicTransactionPoolAPI to TransactionAPI

* internal/ethapi: rename PublicDebugAPI to DebugAPI

* internal/ethapi: move PrivateDebugAPI methods to DebugAPI

* internal/ethapi: rename PublicNetAPI to NetAPI

* les: rename PrivateLightServerAPI to LightServerAPI

* les: rename PrivateLightAPI to LightAPI

* les: rename PrivateDebugAPI to DebugAPI

* les: rename PublicDownloaderAPI to DownloaderAPI

* eth,les: rename PublicFilterAPI to FilterAPI

* eth: rename PublicMinerAPI to MinerAPI

* eth: rename PublicDownloaderAPI to DownloaderAPI

* eth: move PrivateMinerAPI methods to MinerAPI

* eth: rename PrivateAdminAPI to AdminAPI

* eth: rename PublicDebugAPI to DebugAPI

* eth: move PrivateDebugAPI methods to DebugAPI

* node: rename publicAdminAPI to adminAPI

* node: move privateAdminAPI methods to adminAPI

* node: rename publicWeb3API to web3API

* eth,internal/ethapi: sync comments with previous renamings
This commit is contained in:
lightclient
2022-06-21 12:05:43 +03:00
committed by GitHub
parent 241dd27300
commit 10dc5dce08
14 changed files with 305 additions and 370 deletions
+15 -15
View File
@@ -35,7 +35,7 @@ func TestStartRPC(t *testing.T) {
type test struct {
name string
cfg Config
fn func(*testing.T, *Node, *privateAdminAPI)
fn func(*testing.T, *Node, *adminAPI)
// Checks. These run after the node is configured and all API calls have been made.
wantReachable bool // whether the HTTP server should be reachable at all
@@ -48,7 +48,7 @@ func TestStartRPC(t *testing.T) {
{
name: "all off",
cfg: Config{},
fn: func(t *testing.T, n *Node, api *privateAdminAPI) {
fn: func(t *testing.T, n *Node, api *adminAPI) {
},
wantReachable: false,
wantHandlers: false,
@@ -58,7 +58,7 @@ func TestStartRPC(t *testing.T) {
{
name: "rpc enabled through config",
cfg: Config{HTTPHost: "127.0.0.1"},
fn: func(t *testing.T, n *Node, api *privateAdminAPI) {
fn: func(t *testing.T, n *Node, api *adminAPI) {
},
wantReachable: true,
wantHandlers: true,
@@ -68,7 +68,7 @@ func TestStartRPC(t *testing.T) {
{
name: "rpc enabled through API",
cfg: Config{},
fn: func(t *testing.T, n *Node, api *privateAdminAPI) {
fn: func(t *testing.T, n *Node, api *adminAPI) {
_, err := api.StartHTTP(sp("127.0.0.1"), ip(0), nil, nil, nil)
assert.NoError(t, err)
},
@@ -80,7 +80,7 @@ func TestStartRPC(t *testing.T) {
{
name: "rpc start again after failure",
cfg: Config{},
fn: func(t *testing.T, n *Node, api *privateAdminAPI) {
fn: func(t *testing.T, n *Node, api *adminAPI) {
// Listen on a random port.
listener, err := net.Listen("tcp", "127.0.0.1:0")
if err != nil {
@@ -108,7 +108,7 @@ func TestStartRPC(t *testing.T) {
{
name: "rpc stopped through API",
cfg: Config{HTTPHost: "127.0.0.1"},
fn: func(t *testing.T, n *Node, api *privateAdminAPI) {
fn: func(t *testing.T, n *Node, api *adminAPI) {
_, err := api.StopHTTP()
assert.NoError(t, err)
},
@@ -120,7 +120,7 @@ func TestStartRPC(t *testing.T) {
{
name: "rpc stopped twice",
cfg: Config{HTTPHost: "127.0.0.1"},
fn: func(t *testing.T, n *Node, api *privateAdminAPI) {
fn: func(t *testing.T, n *Node, api *adminAPI) {
_, err := api.StopHTTP()
assert.NoError(t, err)
@@ -143,7 +143,7 @@ func TestStartRPC(t *testing.T) {
{
name: "ws enabled through API",
cfg: Config{},
fn: func(t *testing.T, n *Node, api *privateAdminAPI) {
fn: func(t *testing.T, n *Node, api *adminAPI) {
_, err := api.StartWS(sp("127.0.0.1"), ip(0), nil, nil)
assert.NoError(t, err)
},
@@ -155,7 +155,7 @@ func TestStartRPC(t *testing.T) {
{
name: "ws stopped through API",
cfg: Config{WSHost: "127.0.0.1"},
fn: func(t *testing.T, n *Node, api *privateAdminAPI) {
fn: func(t *testing.T, n *Node, api *adminAPI) {
_, err := api.StopWS()
assert.NoError(t, err)
},
@@ -167,7 +167,7 @@ func TestStartRPC(t *testing.T) {
{
name: "ws stopped twice",
cfg: Config{WSHost: "127.0.0.1"},
fn: func(t *testing.T, n *Node, api *privateAdminAPI) {
fn: func(t *testing.T, n *Node, api *adminAPI) {
_, err := api.StopWS()
assert.NoError(t, err)
@@ -182,7 +182,7 @@ func TestStartRPC(t *testing.T) {
{
name: "ws enabled after RPC",
cfg: Config{HTTPHost: "127.0.0.1"},
fn: func(t *testing.T, n *Node, api *privateAdminAPI) {
fn: func(t *testing.T, n *Node, api *adminAPI) {
wsport := n.http.port
_, err := api.StartWS(sp("127.0.0.1"), ip(wsport), nil, nil)
assert.NoError(t, err)
@@ -195,7 +195,7 @@ func TestStartRPC(t *testing.T) {
{
name: "ws enabled after RPC then stopped",
cfg: Config{HTTPHost: "127.0.0.1"},
fn: func(t *testing.T, n *Node, api *privateAdminAPI) {
fn: func(t *testing.T, n *Node, api *adminAPI) {
wsport := n.http.port
_, err := api.StartWS(sp("127.0.0.1"), ip(wsport), nil, nil)
assert.NoError(t, err)
@@ -210,7 +210,7 @@ func TestStartRPC(t *testing.T) {
},
{
name: "rpc stopped with ws enabled",
fn: func(t *testing.T, n *Node, api *privateAdminAPI) {
fn: func(t *testing.T, n *Node, api *adminAPI) {
_, err := api.StartHTTP(sp("127.0.0.1"), ip(0), nil, nil, nil)
assert.NoError(t, err)
@@ -228,7 +228,7 @@ func TestStartRPC(t *testing.T) {
},
{
name: "rpc enabled after ws",
fn: func(t *testing.T, n *Node, api *privateAdminAPI) {
fn: func(t *testing.T, n *Node, api *adminAPI) {
_, err := api.StartWS(sp("127.0.0.1"), ip(0), nil, nil)
assert.NoError(t, err)
@@ -271,7 +271,7 @@ func TestStartRPC(t *testing.T) {
// Run the API call hook.
if test.fn != nil {
test.fn(t, stack, &privateAdminAPI{stack})
test.fn(t, stack, &adminAPI{stack})
}
// Check if the HTTP endpoints are available.