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
cdb77f0e
Commit
cdb77f0e
authored
Feb 28, 2015
by
Jeffrey Wilcke
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #402 from tgerring/rpcupdates
Set RPC listening address via param
parents
43b57777
ea0517b5
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
72 additions
and
66 deletions
+72
-66
flags.go
cmd/ethereum/flags.go
+36
-34
main.go
cmd/ethereum/main.go
+1
-1
flags.go
cmd/mist/flags.go
+27
-25
main.go
cmd/mist/main.go
+1
-1
cmd.go
cmd/utils/cmd.go
+2
-2
server.go
rpc/http/server.go
+5
-3
No files found.
cmd/ethereum/flags.go
View file @
cdb77f0e
...
...
@@ -43,6 +43,7 @@ var (
KeyStore
string
StartRpc
bool
StartWebSockets
bool
RpcListenAddress
string
RpcPort
int
WsPort
int
OutboundPort
string
...
...
@@ -93,6 +94,7 @@ func Init() {
flag
.
StringVar
(
&
KeyRing
,
"keyring"
,
""
,
"identifier for keyring to use"
)
flag
.
StringVar
(
&
KeyStore
,
"keystore"
,
"db"
,
"system to store keyrings: db|file (db)"
)
flag
.
StringVar
(
&
RpcListenAddress
,
"rpcaddr"
,
"127.0.0.1"
,
"address for json-rpc server to listen on"
)
flag
.
IntVar
(
&
RpcPort
,
"rpcport"
,
8545
,
"port to start json-rpc server on"
)
flag
.
IntVar
(
&
WsPort
,
"wsport"
,
40404
,
"port to start websocket rpc server on"
)
flag
.
BoolVar
(
&
StartRpc
,
"rpc"
,
false
,
"start rpc server"
)
...
...
cmd/ethereum/main.go
View file @
cdb77f0e
...
...
@@ -128,7 +128,7 @@ func main() {
}
if
StartRpc
{
utils
.
StartRpc
(
ethereum
,
RpcPort
)
utils
.
StartRpc
(
ethereum
,
Rpc
ListenAddress
,
Rpc
Port
)
}
if
StartWebSockets
{
...
...
cmd/mist/flags.go
View file @
cdb77f0e
...
...
@@ -42,6 +42,7 @@ var (
KeyStore
string
StartRpc
bool
StartWebSockets
bool
RpcListenAddress
string
RpcPort
int
WsPort
int
OutboundPort
string
...
...
@@ -79,6 +80,7 @@ func Init() {
flag
.
StringVar
(
&
Identifier
,
"id"
,
""
,
"Custom client identifier"
)
flag
.
StringVar
(
&
KeyRing
,
"keyring"
,
""
,
"identifier for keyring to use"
)
flag
.
StringVar
(
&
KeyStore
,
"keystore"
,
"db"
,
"system to store keyrings: db|file (db)"
)
flag
.
StringVar
(
&
RpcListenAddress
,
"rpcaddr"
,
"127.0.0.1"
,
"address for json-rpc server to listen on"
)
flag
.
IntVar
(
&
RpcPort
,
"rpcport"
,
8545
,
"port to start json-rpc server on"
)
flag
.
IntVar
(
&
WsPort
,
"wsport"
,
40404
,
"port to start websocket rpc server on"
)
flag
.
BoolVar
(
&
StartRpc
,
"rpc"
,
true
,
"start rpc server"
)
...
...
cmd/mist/main.go
View file @
cdb77f0e
...
...
@@ -73,7 +73,7 @@ func run() error {
utils
.
KeyTasks
(
ethereum
.
KeyManager
(),
KeyRing
,
GenAddr
,
SecretFile
,
ExportDir
,
NonInteractive
)
if
StartRpc
{
utils
.
StartRpc
(
ethereum
,
RpcPort
)
utils
.
StartRpc
(
ethereum
,
Rpc
ListenAddress
,
Rpc
Port
)
}
if
StartWebSockets
{
...
...
cmd/utils/cmd.go
View file @
cdb77f0e
...
...
@@ -160,9 +160,9 @@ func KeyTasks(keyManager *crypto.KeyManager, KeyRing string, GenAddr bool, Secre
clilogger
.
Infof
(
"Main address %x
\n
"
,
keyManager
.
Address
())
}
func
StartRpc
(
ethereum
*
eth
.
Ethereum
,
RpcPort
int
)
{
func
StartRpc
(
ethereum
*
eth
.
Ethereum
,
Rpc
ListenAddress
string
,
Rpc
Port
int
)
{
var
err
error
ethereum
.
RpcServer
,
err
=
rpchttp
.
NewRpcHttpServer
(
xeth
.
New
(
ethereum
),
RpcPort
)
ethereum
.
RpcServer
,
err
=
rpchttp
.
NewRpcHttpServer
(
xeth
.
New
(
ethereum
),
Rpc
ListenAddress
,
Rpc
Port
)
if
err
!=
nil
{
clilogger
.
Errorf
(
"Could not start RPC interface (port %v): %v"
,
RpcPort
,
err
)
}
else
{
...
...
rpc/http/server.go
View file @
cdb77f0e
...
...
@@ -29,8 +29,8 @@ import (
var
rpchttplogger
=
logger
.
NewLogger
(
"RPC-HTTP"
)
var
JSON
rpc
.
JsonWrapper
func
NewRpcHttpServer
(
pipe
*
xeth
.
XEth
,
port
int
)
(
*
RpcHttpServer
,
error
)
{
sport
:=
fmt
.
Sprintf
(
"
127.0.0.1:%d"
,
port
)
func
NewRpcHttpServer
(
pipe
*
xeth
.
XEth
,
address
string
,
port
int
)
(
*
RpcHttpServer
,
error
)
{
sport
:=
fmt
.
Sprintf
(
"
%s:%d"
,
address
,
port
)
l
,
err
:=
net
.
Listen
(
"tcp"
,
sport
)
if
err
!=
nil
{
return
nil
,
err
...
...
@@ -41,6 +41,7 @@ func NewRpcHttpServer(pipe *xeth.XEth, port int) (*RpcHttpServer, error) {
quit
:
make
(
chan
bool
),
pipe
:
pipe
,
port
:
port
,
addr
:
address
,
},
nil
}
...
...
@@ -49,6 +50,7 @@ type RpcHttpServer struct {
listener
net
.
Listener
pipe
*
xeth
.
XEth
port
int
addr
string
}
func
(
s
*
RpcHttpServer
)
exitHandler
()
{
...
...
@@ -69,7 +71,7 @@ func (s *RpcHttpServer) Stop() {
}
func
(
s
*
RpcHttpServer
)
Start
()
{
rpchttplogger
.
Infof
(
"Starting RPC-HTTP server on
port %d"
,
s
.
port
)
rpchttplogger
.
Infof
(
"Starting RPC-HTTP server on
%s:%d"
,
s
.
addr
,
s
.
port
)
go
s
.
exitHandler
()
api
:=
rpc
.
NewEthereumApi
(
s
.
pipe
)
...
...
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