Skip to content

Commit

Permalink
cmd, common, node, rpc: rework naming convention to canonical one
Browse files Browse the repository at this point in the history
  • Loading branch information
karalabe committed Feb 9, 2016
1 parent 7486904 commit 900e124
Show file tree
Hide file tree
Showing 13 changed files with 115 additions and 115 deletions.
4 changes: 2 additions & 2 deletions cmd/geth/js_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func testREPL(t *testing.T, config func(*eth.Config)) (string, *testjethre, *nod
t.Fatal(err)
}
// Create a networkless protocol stack
stack, err := node.New(&node.Config{PrivateKey: testNodeKey, Name: "test", NoDiscovery: true, IpcPath: fmt.Sprintf("geth-test-%d.ipc", rand.Int63())})
stack, err := node.New(&node.Config{PrivateKey: testNodeKey, Name: "test", NoDiscovery: true, IPCPath: fmt.Sprintf("geth-test-%d.ipc", rand.Int63())})
if err != nil {
t.Fatalf("failed to create node: %v", err)
}
Expand Down Expand Up @@ -142,7 +142,7 @@ func testREPL(t *testing.T, config func(*eth.Config)) (string, *testjethre, *nod
stack.Service(&ethereum)

assetPath := filepath.Join(os.Getenv("GOPATH"), "src", "github.com", "ethereum", "go-ethereum", "cmd", "mist", "assets", "ext")
client, err := utils.NewRemoteRPCClientFromString("ipc:" + stack.IpcEndpoint())
client, err := utils.NewRemoteRPCClientFromString("ipc:" + stack.IPCEndpoint())
if err != nil {
t.Fatalf("failed to attach to node: %v", err)
}
Expand Down
6 changes: 3 additions & 3 deletions cmd/geth/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Conso
utils.WSListenAddrFlag,
utils.WSPortFlag,
utils.WSApiFlag,
utils.WSCORSDomainFlag,
utils.WSAllowedDomainsFlag,
utils.IPCDisabledFlag,
utils.IPCApiFlag,
utils.IPCPathFlag,
Expand Down Expand Up @@ -425,7 +425,7 @@ func console(ctx *cli.Context) {
startNode(ctx, node)

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

// Attach to the newly started node and execute the given scripts
client, err := utils.NewRemoteRPCClientFromString("ipc:" + node.IpcEndpoint())
client, err := utils.NewRemoteRPCClientFromString("ipc:" + node.IPCEndpoint())
if err != nil {
utils.Fatalf("Failed to attach to the inproc geth: %v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/geth/monitorcmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import (
var (
monitorCommandAttachFlag = cli.StringFlag{
Name: "attach",
Value: "ipc:" + node.DefaultIpcEndpoint(),
Value: "ipc:" + node.DefaultIPCEndpoint(),
Usage: "API endpoint to attach to",
}
monitorCommandRowsFlag = cli.IntFlag{
Expand Down
2 changes: 1 addition & 1 deletion cmd/geth/usage.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ var AppHelpFlagGroups = []flagGroup{
utils.WSListenAddrFlag,
utils.WSPortFlag,
utils.WSApiFlag,
utils.WSCORSDomainFlag,
utils.WSAllowedDomainsFlag,
utils.IPCDisabledFlag,
utils.IPCApiFlag,
utils.IPCPathFlag,
Expand Down
14 changes: 7 additions & 7 deletions cmd/gethrpctest/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,13 @@ func main() {
func MakeSystemNode(keydir string, privkey string, test *tests.BlockTest) (*node.Node, error) {
// Create a networkless protocol stack
stack, err := node.New(&node.Config{
IpcPath: node.DefaultIpcEndpoint(),
HttpHost: common.DefaultHttpHost,
HttpPort: common.DefaultHttpPort,
HttpModules: []string{"admin", "db", "eth", "debug", "miner", "net", "shh", "txpool", "personal", "web3"},
WsHost: common.DefaultWsHost,
WsPort: common.DefaultWsPort,
WsModules: []string{"admin", "db", "eth", "debug", "miner", "net", "shh", "txpool", "personal", "web3"},
IPCPath: node.DefaultIPCEndpoint(),
HTTPHost: common.DefaultHTTPHost,
HTTPPort: common.DefaultHTTPPort,
HTTPModules: []string{"admin", "db", "eth", "debug", "miner", "net", "shh", "txpool", "personal", "web3"},
WSHost: common.DefaultWSHost,
WSPort: common.DefaultWSPort,
WSModules: []string{"admin", "db", "eth", "debug", "miner", "net", "shh", "txpool", "personal", "web3"},
NoDiscovery: true,
})
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/utils/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func NewRemoteRPCClient(ctx *cli.Context) (rpc.Client, error) {
return NewRemoteRPCClientFromString(endpoint)
}
// use IPC by default
return rpc.NewIPCClient(node.DefaultIpcEndpoint())
return rpc.NewIPCClient(node.DefaultIPCEndpoint())
}

// NewRemoteRPCClientFromString returns a RPC client which connects to the given
Expand Down
52 changes: 26 additions & 26 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,12 +232,12 @@ var (
RPCListenAddrFlag = cli.StringFlag{
Name: "rpcaddr",
Usage: "HTTP-RPC server listening interface",
Value: common.DefaultHttpHost,
Value: common.DefaultHTTPHost,
}
RPCPortFlag = cli.IntFlag{
Name: "rpcport",
Usage: "HTTP-RPC server listening port",
Value: common.DefaultHttpPort,
Value: common.DefaultHTTPPort,
}
RPCCORSDomainFlag = cli.StringFlag{
Name: "rpccorsdomain",
Expand All @@ -247,7 +247,7 @@ var (
RPCApiFlag = cli.StringFlag{
Name: "rpcapi",
Usage: "API's offered over the HTTP-RPC interface",
Value: rpc.DefaultHttpRpcApis,
Value: rpc.DefaultHTTPApis,
}
IPCDisabledFlag = cli.BoolFlag{
Name: "ipcdisable",
Expand All @@ -256,12 +256,12 @@ var (
IPCApiFlag = cli.StringFlag{
Name: "ipcapi",
Usage: "API's offered over the IPC-RPC interface",
Value: rpc.DefaultIpcApis,
Value: rpc.DefaultIPCApis,
}
IPCPathFlag = DirectoryFlag{
Name: "ipcpath",
Usage: "Filename for IPC socket/pipe within the datadir (explicit paths escape it)",
Value: DirectoryString{common.DefaultIpcSocket},
Value: DirectoryString{common.DefaultIPCSocket},
}
WSEnabledFlag = cli.BoolFlag{
Name: "ws",
Expand All @@ -270,21 +270,21 @@ var (
WSListenAddrFlag = cli.StringFlag{
Name: "wsaddr",
Usage: "WS-RPC server listening interface",
Value: common.DefaultWsHost,
Value: common.DefaultWSHost,
}
WSPortFlag = cli.IntFlag{
Name: "wsport",
Usage: "WS-RPC server listening port",
Value: common.DefaultWsPort,
Value: common.DefaultWSPort,
}
WSApiFlag = cli.StringFlag{
Name: "wsapi",
Usage: "API's offered over the WS-RPC interface",
Value: rpc.DefaultHttpRpcApis,
Value: rpc.DefaultHTTPApis,
}
WSCORSDomainFlag = cli.StringFlag{
Name: "wscorsdomain",
Usage: "Domains from which to accept websockets requests",
WSAllowedDomainsFlag = cli.StringFlag{
Name: "wsdomains",
Usage: "Domains from which to accept websockets requests (can be spoofed)",
Value: "",
}
ExecFlag = cli.StringFlag{
Expand Down Expand Up @@ -393,9 +393,9 @@ func MustMakeDataDir(ctx *cli.Context) string {
return ""
}

// MakeIpcPath creates an IPC path configuration from the set command line flags,
// MakeIPCPath creates an IPC path configuration from the set command line flags,
// returning an empty string if IPC was explicitly disabled, or the set path.
func MakeIpcPath(ctx *cli.Context) string {
func MakeIPCPath(ctx *cli.Context) string {
if ctx.GlobalBool(IPCDisabledFlag.Name) {
return ""
}
Expand Down Expand Up @@ -481,18 +481,18 @@ func MakeNAT(ctx *cli.Context) nat.Interface {
return natif
}

// MakeHttpRpcHost creates the HTTP RPC listener interface string from the set
// MakeHTTPRpcHost creates the HTTP RPC listener interface string from the set
// command line flags, returning empty if the HTTP endpoint is disabled.
func MakeHttpRpcHost(ctx *cli.Context) string {
func MakeHTTPRpcHost(ctx *cli.Context) string {
if !ctx.GlobalBool(RPCEnabledFlag.Name) {
return ""
}
return ctx.GlobalString(RPCListenAddrFlag.Name)
}

// MakeWsRpcHost creates the WebSocket RPC listener interface string from the set
// MakeWSRpcHost creates the WebSocket RPC listener interface string from the set
// command line flags, returning empty if the HTTP endpoint is disabled.
func MakeWsRpcHost(ctx *cli.Context) string {
func MakeWSRpcHost(ctx *cli.Context) string {
if !ctx.GlobalBool(WSEnabledFlag.Name) {
return ""
}
Expand Down Expand Up @@ -616,15 +616,15 @@ func MakeSystemNode(name, version string, extra []byte, ctx *cli.Context) *node.
NAT: MakeNAT(ctx),
MaxPeers: ctx.GlobalInt(MaxPeersFlag.Name),
MaxPendingPeers: ctx.GlobalInt(MaxPendingPeersFlag.Name),
IpcPath: MakeIpcPath(ctx),
HttpHost: MakeHttpRpcHost(ctx),
HttpPort: ctx.GlobalInt(RPCPortFlag.Name),
HttpCors: ctx.GlobalString(RPCCORSDomainFlag.Name),
HttpModules: strings.Split(ctx.GlobalString(RPCApiFlag.Name), ","),
WsHost: MakeWsRpcHost(ctx),
WsPort: ctx.GlobalInt(WSPortFlag.Name),
WsCors: ctx.GlobalString(WSCORSDomainFlag.Name),
WsModules: strings.Split(ctx.GlobalString(WSApiFlag.Name), ","),
IPCPath: MakeIPCPath(ctx),
HTTPHost: MakeHTTPRpcHost(ctx),
HTTPPort: ctx.GlobalInt(RPCPortFlag.Name),
HTTPCors: ctx.GlobalString(RPCCORSDomainFlag.Name),
HTTPModules: strings.Split(ctx.GlobalString(RPCApiFlag.Name), ","),
WSHost: MakeWSRpcHost(ctx),
WSPort: ctx.GlobalInt(WSPortFlag.Name),
WSDomains: ctx.GlobalString(WSAllowedDomainsFlag.Name),
WSModules: strings.Split(ctx.GlobalString(WSApiFlag.Name), ","),
}
// Configure the Ethereum service
accman := MakeAccountManager(ctx)
Expand Down
10 changes: 5 additions & 5 deletions common/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ import (
)

const (
DefaultIpcSocket = "geth.ipc" // Default (relative) name of the IPC RPC socket
DefaultHttpHost = "localhost" // Default host interface for the HTTP RPC server
DefaultHttpPort = 8545 // Default TCP port for the HTTP RPC server
DefaultWsHost = "localhost" // Default host interface for the websocket RPC server
DefaultWsPort = 8546 // Default TCP port for the websocket RPC server
DefaultIPCSocket = "geth.ipc" // Default (relative) name of the IPC RPC socket
DefaultHTTPHost = "localhost" // Default host interface for the HTTP RPC server
DefaultHTTPPort = 8545 // Default TCP port for the HTTP RPC server
DefaultWSHost = "localhost" // Default host interface for the websocket RPC server
DefaultWSPort = 8546 // Default TCP port for the websocket RPC server
)

// DefaultDataDir is the default data directory to use for the databases and other
Expand Down
Loading

0 comments on commit 900e124

Please sign in to comment.