Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
2a0d8883
Commit
2a0d8883
authored
Jun 08, 2015
by
Bas van Kervel
Committed by
Bas van Kervel
Jun 11, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added API/IPC commandline flags
parent
8ebf2d8f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
0 deletions
+50
-0
main.go
cmd/geth/main.go
+8
-0
flags.go
cmd/utils/flags.go
+33
-0
path.go
common/path.go
+4
-0
api.go
rpc/api/api.go
+5
-0
No files found.
cmd/geth/main.go
View file @
2a0d8883
...
@@ -239,6 +239,9 @@ JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Conso
...
@@ -239,6 +239,9 @@ JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Conso
utils
.
RPCEnabledFlag
,
utils
.
RPCEnabledFlag
,
utils
.
RPCListenAddrFlag
,
utils
.
RPCListenAddrFlag
,
utils
.
RPCPortFlag
,
utils
.
RPCPortFlag
,
utils
.
IPCDisabledFlag
,
utils
.
IPCApiFlag
,
utils
.
IPCPathFlag
,
utils
.
WhisperEnabledFlag
,
utils
.
WhisperEnabledFlag
,
utils
.
VMDebugFlag
,
utils
.
VMDebugFlag
,
utils
.
ProtocolVersionFlag
,
utils
.
ProtocolVersionFlag
,
...
@@ -382,6 +385,11 @@ func startEth(ctx *cli.Context, eth *eth.Ethereum) {
...
@@ -382,6 +385,11 @@ func startEth(ctx *cli.Context, eth *eth.Ethereum) {
}
}
}
}
// Start auxiliary services if enabled.
// Start auxiliary services if enabled.
if
!
ctx
.
GlobalBool
(
utils
.
IPCDisabledFlag
.
Name
)
{
if
err
:=
utils
.
StartIPC
(
eth
,
ctx
);
err
!=
nil
{
utils
.
Fatalf
(
"Error string IPC: %v"
,
err
)
}
}
if
ctx
.
GlobalBool
(
utils
.
RPCEnabledFlag
.
Name
)
{
if
ctx
.
GlobalBool
(
utils
.
RPCEnabledFlag
.
Name
)
{
if
err
:=
utils
.
StartRPC
(
eth
,
ctx
);
err
!=
nil
{
if
err
:=
utils
.
StartRPC
(
eth
,
ctx
);
err
!=
nil
{
utils
.
Fatalf
(
"Error starting RPC: %v"
,
err
)
utils
.
Fatalf
(
"Error starting RPC: %v"
,
err
)
...
...
cmd/utils/flags.go
View file @
2a0d8883
...
@@ -24,6 +24,9 @@ import (
...
@@ -24,6 +24,9 @@ import (
"github.com/ethereum/go-ethereum/p2p/nat"
"github.com/ethereum/go-ethereum/p2p/nat"
"github.com/ethereum/go-ethereum/rpc"
"github.com/ethereum/go-ethereum/rpc"
"github.com/ethereum/go-ethereum/xeth"
"github.com/ethereum/go-ethereum/xeth"
"github.com/ethereum/go-ethereum/rpc/api"
"github.com/ethereum/go-ethereum/rpc/comms"
"github.com/ethereum/go-ethereum/rpc/codec"
)
)
func
init
()
{
func
init
()
{
...
@@ -206,6 +209,20 @@ var (
...
@@ -206,6 +209,20 @@ var (
Usage
:
"Domain on which to send Access-Control-Allow-Origin header"
,
Usage
:
"Domain on which to send Access-Control-Allow-Origin header"
,
Value
:
""
,
Value
:
""
,
}
}
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"
,
Value
:
api
.
DefaultIpcApis
,
}
IPCPathFlag
=
DirectoryFlag
{
Name
:
"ipcpath"
,
Usage
:
"Filename for IPC socket/pipe"
,
Value
:
DirectoryString
{
common
.
DefaultIpcPath
()},
}
// Network Settings
// Network Settings
MaxPeersFlag
=
cli
.
IntFlag
{
MaxPeersFlag
=
cli
.
IntFlag
{
Name
:
"maxpeers"
,
Name
:
"maxpeers"
,
...
@@ -368,6 +385,22 @@ func MakeAccountManager(ctx *cli.Context) *accounts.Manager {
...
@@ -368,6 +385,22 @@ func MakeAccountManager(ctx *cli.Context) *accounts.Manager {
return
accounts
.
NewManager
(
ks
)
return
accounts
.
NewManager
(
ks
)
}
}
func
StartIPC
(
eth
*
eth
.
Ethereum
,
ctx
*
cli
.
Context
)
error
{
config
:=
comms
.
IpcConfig
{
Endpoint
:
ctx
.
GlobalString
(
IPCPathFlag
.
Name
),
}
xeth
:=
xeth
.
New
(
eth
,
nil
)
codec
:=
codec
.
JSON
apis
,
err
:=
api
.
ParseApiString
(
ctx
.
GlobalString
(
IPCApiFlag
.
Name
),
codec
,
xeth
,
eth
)
if
err
!=
nil
{
return
err
}
return
comms
.
StartIpc
(
config
,
codec
,
apis
...
)
}
func
StartRPC
(
eth
*
eth
.
Ethereum
,
ctx
*
cli
.
Context
)
error
{
func
StartRPC
(
eth
*
eth
.
Ethereum
,
ctx
*
cli
.
Context
)
error
{
config
:=
rpc
.
RpcConfig
{
config
:=
rpc
.
RpcConfig
{
ListenAddress
:
ctx
.
GlobalString
(
RPCListenAddrFlag
.
Name
),
ListenAddress
:
ctx
.
GlobalString
(
RPCListenAddrFlag
.
Name
),
...
...
common/path.go
View file @
2a0d8883
...
@@ -94,6 +94,10 @@ func DefaultDataDir() string {
...
@@ -94,6 +94,10 @@ func DefaultDataDir() string {
}
}
}
}
func
DefaultIpcPath
()
string
{
return
filepath
.
Join
(
DefaultDataDir
(),
"geth.ipc"
)
}
func
IsWindows
()
bool
{
func
IsWindows
()
bool
{
return
runtime
.
GOOS
==
"windows"
return
runtime
.
GOOS
==
"windows"
}
}
...
...
rpc/api/api.go
View file @
2a0d8883
...
@@ -2,6 +2,11 @@ package api
...
@@ -2,6 +2,11 @@ package api
import
"github.com/ethereum/go-ethereum/rpc/shared"
import
"github.com/ethereum/go-ethereum/rpc/shared"
const
(
// List with all API's which are offered over the IPC interface by default
DefaultIpcApis
=
"eth"
)
// Ethereum RPC API interface
// Ethereum RPC API interface
type
EthereumApi
interface
{
type
EthereumApi
interface
{
// Execute the given request and returns the response or an error
// Execute the given request and returns the response or an error
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment