Skip to content

Commit 900e124

Browse files
committed
cmd, common, node, rpc: rework naming convention to canonical one
1 parent 7486904 commit 900e124

File tree

13 files changed

+115
-115
lines changed

13 files changed

+115
-115
lines changed

cmd/geth/js_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ func testREPL(t *testing.T, config func(*eth.Config)) (string, *testjethre, *nod
9696
t.Fatal(err)
9797
}
9898
// Create a networkless protocol stack
99-
stack, err := node.New(&node.Config{PrivateKey: testNodeKey, Name: "test", NoDiscovery: true, IpcPath: fmt.Sprintf("geth-test-%d.ipc", rand.Int63())})
99+
stack, err := node.New(&node.Config{PrivateKey: testNodeKey, Name: "test", NoDiscovery: true, IPCPath: fmt.Sprintf("geth-test-%d.ipc", rand.Int63())})
100100
if err != nil {
101101
t.Fatalf("failed to create node: %v", err)
102102
}
@@ -142,7 +142,7 @@ func testREPL(t *testing.T, config func(*eth.Config)) (string, *testjethre, *nod
142142
stack.Service(&ethereum)
143143

144144
assetPath := filepath.Join(os.Getenv("GOPATH"), "src", "github.com", "ethereum", "go-ethereum", "cmd", "mist", "assets", "ext")
145-
client, err := utils.NewRemoteRPCClientFromString("ipc:" + stack.IpcEndpoint())
145+
client, err := utils.NewRemoteRPCClientFromString("ipc:" + stack.IPCEndpoint())
146146
if err != nil {
147147
t.Fatalf("failed to attach to node: %v", err)
148148
}

cmd/geth/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Conso
312312
utils.WSListenAddrFlag,
313313
utils.WSPortFlag,
314314
utils.WSApiFlag,
315-
utils.WSCORSDomainFlag,
315+
utils.WSAllowedDomainsFlag,
316316
utils.IPCDisabledFlag,
317317
utils.IPCApiFlag,
318318
utils.IPCPathFlag,
@@ -425,7 +425,7 @@ func console(ctx *cli.Context) {
425425
startNode(ctx, node)
426426

427427
// Attach to the newly started node, and either execute script or become interactive
428-
client, err := utils.NewRemoteRPCClientFromString("ipc:" + node.IpcEndpoint())
428+
client, err := utils.NewRemoteRPCClientFromString("ipc:" + node.IPCEndpoint())
429429
if err != nil {
430430
utils.Fatalf("Failed to attach to the inproc geth: %v", err)
431431
}
@@ -451,7 +451,7 @@ func execScripts(ctx *cli.Context) {
451451
startNode(ctx, node)
452452

453453
// Attach to the newly started node and execute the given scripts
454-
client, err := utils.NewRemoteRPCClientFromString("ipc:" + node.IpcEndpoint())
454+
client, err := utils.NewRemoteRPCClientFromString("ipc:" + node.IPCEndpoint())
455455
if err != nil {
456456
utils.Fatalf("Failed to attach to the inproc geth: %v", err)
457457
}

cmd/geth/monitorcmd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import (
3636
var (
3737
monitorCommandAttachFlag = cli.StringFlag{
3838
Name: "attach",
39-
Value: "ipc:" + node.DefaultIpcEndpoint(),
39+
Value: "ipc:" + node.DefaultIPCEndpoint(),
4040
Usage: "API endpoint to attach to",
4141
}
4242
monitorCommandRowsFlag = cli.IntFlag{

cmd/geth/usage.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ var AppHelpFlagGroups = []flagGroup{
9393
utils.WSListenAddrFlag,
9494
utils.WSPortFlag,
9595
utils.WSApiFlag,
96-
utils.WSCORSDomainFlag,
96+
utils.WSAllowedDomainsFlag,
9797
utils.IPCDisabledFlag,
9898
utils.IPCApiFlag,
9999
utils.IPCPathFlag,

cmd/gethrpctest/main.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,13 @@ func main() {
9393
func MakeSystemNode(keydir string, privkey string, test *tests.BlockTest) (*node.Node, error) {
9494
// Create a networkless protocol stack
9595
stack, err := node.New(&node.Config{
96-
IpcPath: node.DefaultIpcEndpoint(),
97-
HttpHost: common.DefaultHttpHost,
98-
HttpPort: common.DefaultHttpPort,
99-
HttpModules: []string{"admin", "db", "eth", "debug", "miner", "net", "shh", "txpool", "personal", "web3"},
100-
WsHost: common.DefaultWsHost,
101-
WsPort: common.DefaultWsPort,
102-
WsModules: []string{"admin", "db", "eth", "debug", "miner", "net", "shh", "txpool", "personal", "web3"},
96+
IPCPath: node.DefaultIPCEndpoint(),
97+
HTTPHost: common.DefaultHTTPHost,
98+
HTTPPort: common.DefaultHTTPPort,
99+
HTTPModules: []string{"admin", "db", "eth", "debug", "miner", "net", "shh", "txpool", "personal", "web3"},
100+
WSHost: common.DefaultWSHost,
101+
WSPort: common.DefaultWSPort,
102+
WSModules: []string{"admin", "db", "eth", "debug", "miner", "net", "shh", "txpool", "personal", "web3"},
103103
NoDiscovery: true,
104104
})
105105
if err != nil {

cmd/utils/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func NewRemoteRPCClient(ctx *cli.Context) (rpc.Client, error) {
3333
return NewRemoteRPCClientFromString(endpoint)
3434
}
3535
// use IPC by default
36-
return rpc.NewIPCClient(node.DefaultIpcEndpoint())
36+
return rpc.NewIPCClient(node.DefaultIPCEndpoint())
3737
}
3838

3939
// NewRemoteRPCClientFromString returns a RPC client which connects to the given

cmd/utils/flags.go

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -232,12 +232,12 @@ var (
232232
RPCListenAddrFlag = cli.StringFlag{
233233
Name: "rpcaddr",
234234
Usage: "HTTP-RPC server listening interface",
235-
Value: common.DefaultHttpHost,
235+
Value: common.DefaultHTTPHost,
236236
}
237237
RPCPortFlag = cli.IntFlag{
238238
Name: "rpcport",
239239
Usage: "HTTP-RPC server listening port",
240-
Value: common.DefaultHttpPort,
240+
Value: common.DefaultHTTPPort,
241241
}
242242
RPCCORSDomainFlag = cli.StringFlag{
243243
Name: "rpccorsdomain",
@@ -247,7 +247,7 @@ var (
247247
RPCApiFlag = cli.StringFlag{
248248
Name: "rpcapi",
249249
Usage: "API's offered over the HTTP-RPC interface",
250-
Value: rpc.DefaultHttpRpcApis,
250+
Value: rpc.DefaultHTTPApis,
251251
}
252252
IPCDisabledFlag = cli.BoolFlag{
253253
Name: "ipcdisable",
@@ -256,12 +256,12 @@ var (
256256
IPCApiFlag = cli.StringFlag{
257257
Name: "ipcapi",
258258
Usage: "API's offered over the IPC-RPC interface",
259-
Value: rpc.DefaultIpcApis,
259+
Value: rpc.DefaultIPCApis,
260260
}
261261
IPCPathFlag = DirectoryFlag{
262262
Name: "ipcpath",
263263
Usage: "Filename for IPC socket/pipe within the datadir (explicit paths escape it)",
264-
Value: DirectoryString{common.DefaultIpcSocket},
264+
Value: DirectoryString{common.DefaultIPCSocket},
265265
}
266266
WSEnabledFlag = cli.BoolFlag{
267267
Name: "ws",
@@ -270,21 +270,21 @@ var (
270270
WSListenAddrFlag = cli.StringFlag{
271271
Name: "wsaddr",
272272
Usage: "WS-RPC server listening interface",
273-
Value: common.DefaultWsHost,
273+
Value: common.DefaultWSHost,
274274
}
275275
WSPortFlag = cli.IntFlag{
276276
Name: "wsport",
277277
Usage: "WS-RPC server listening port",
278-
Value: common.DefaultWsPort,
278+
Value: common.DefaultWSPort,
279279
}
280280
WSApiFlag = cli.StringFlag{
281281
Name: "wsapi",
282282
Usage: "API's offered over the WS-RPC interface",
283-
Value: rpc.DefaultHttpRpcApis,
283+
Value: rpc.DefaultHTTPApis,
284284
}
285-
WSCORSDomainFlag = cli.StringFlag{
286-
Name: "wscorsdomain",
287-
Usage: "Domains from which to accept websockets requests",
285+
WSAllowedDomainsFlag = cli.StringFlag{
286+
Name: "wsdomains",
287+
Usage: "Domains from which to accept websockets requests (can be spoofed)",
288288
Value: "",
289289
}
290290
ExecFlag = cli.StringFlag{
@@ -393,9 +393,9 @@ func MustMakeDataDir(ctx *cli.Context) string {
393393
return ""
394394
}
395395

396-
// MakeIpcPath creates an IPC path configuration from the set command line flags,
396+
// MakeIPCPath creates an IPC path configuration from the set command line flags,
397397
// returning an empty string if IPC was explicitly disabled, or the set path.
398-
func MakeIpcPath(ctx *cli.Context) string {
398+
func MakeIPCPath(ctx *cli.Context) string {
399399
if ctx.GlobalBool(IPCDisabledFlag.Name) {
400400
return ""
401401
}
@@ -481,18 +481,18 @@ func MakeNAT(ctx *cli.Context) nat.Interface {
481481
return natif
482482
}
483483

484-
// MakeHttpRpcHost creates the HTTP RPC listener interface string from the set
484+
// MakeHTTPRpcHost creates the HTTP RPC listener interface string from the set
485485
// command line flags, returning empty if the HTTP endpoint is disabled.
486-
func MakeHttpRpcHost(ctx *cli.Context) string {
486+
func MakeHTTPRpcHost(ctx *cli.Context) string {
487487
if !ctx.GlobalBool(RPCEnabledFlag.Name) {
488488
return ""
489489
}
490490
return ctx.GlobalString(RPCListenAddrFlag.Name)
491491
}
492492

493-
// MakeWsRpcHost creates the WebSocket RPC listener interface string from the set
493+
// MakeWSRpcHost creates the WebSocket RPC listener interface string from the set
494494
// command line flags, returning empty if the HTTP endpoint is disabled.
495-
func MakeWsRpcHost(ctx *cli.Context) string {
495+
func MakeWSRpcHost(ctx *cli.Context) string {
496496
if !ctx.GlobalBool(WSEnabledFlag.Name) {
497497
return ""
498498
}
@@ -616,15 +616,15 @@ func MakeSystemNode(name, version string, extra []byte, ctx *cli.Context) *node.
616616
NAT: MakeNAT(ctx),
617617
MaxPeers: ctx.GlobalInt(MaxPeersFlag.Name),
618618
MaxPendingPeers: ctx.GlobalInt(MaxPendingPeersFlag.Name),
619-
IpcPath: MakeIpcPath(ctx),
620-
HttpHost: MakeHttpRpcHost(ctx),
621-
HttpPort: ctx.GlobalInt(RPCPortFlag.Name),
622-
HttpCors: ctx.GlobalString(RPCCORSDomainFlag.Name),
623-
HttpModules: strings.Split(ctx.GlobalString(RPCApiFlag.Name), ","),
624-
WsHost: MakeWsRpcHost(ctx),
625-
WsPort: ctx.GlobalInt(WSPortFlag.Name),
626-
WsCors: ctx.GlobalString(WSCORSDomainFlag.Name),
627-
WsModules: strings.Split(ctx.GlobalString(WSApiFlag.Name), ","),
619+
IPCPath: MakeIPCPath(ctx),
620+
HTTPHost: MakeHTTPRpcHost(ctx),
621+
HTTPPort: ctx.GlobalInt(RPCPortFlag.Name),
622+
HTTPCors: ctx.GlobalString(RPCCORSDomainFlag.Name),
623+
HTTPModules: strings.Split(ctx.GlobalString(RPCApiFlag.Name), ","),
624+
WSHost: MakeWSRpcHost(ctx),
625+
WSPort: ctx.GlobalInt(WSPortFlag.Name),
626+
WSDomains: ctx.GlobalString(WSAllowedDomainsFlag.Name),
627+
WSModules: strings.Split(ctx.GlobalString(WSApiFlag.Name), ","),
628628
}
629629
// Configure the Ethereum service
630630
accman := MakeAccountManager(ctx)

common/defaults.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ import (
2222
)
2323

2424
const (
25-
DefaultIpcSocket = "geth.ipc" // Default (relative) name of the IPC RPC socket
26-
DefaultHttpHost = "localhost" // Default host interface for the HTTP RPC server
27-
DefaultHttpPort = 8545 // Default TCP port for the HTTP RPC server
28-
DefaultWsHost = "localhost" // Default host interface for the websocket RPC server
29-
DefaultWsPort = 8546 // Default TCP port for the websocket RPC server
25+
DefaultIPCSocket = "geth.ipc" // Default (relative) name of the IPC RPC socket
26+
DefaultHTTPHost = "localhost" // Default host interface for the HTTP RPC server
27+
DefaultHTTPPort = 8545 // Default TCP port for the HTTP RPC server
28+
DefaultWSHost = "localhost" // Default host interface for the websocket RPC server
29+
DefaultWSPort = 8546 // Default TCP port for the websocket RPC server
3030
)
3131

3232
// DefaultDataDir is the default data directory to use for the databases and other

0 commit comments

Comments
 (0)