Listen on all interfaces for JSONRPC by default.

This commit is contained in:
Gav Wood 2016-03-20 10:19:21 +01:00
parent 387d0743e6
commit c611566a3e

View File

@ -105,8 +105,9 @@ Networking Options:
API and Console Options: API and Console Options:
-j --jsonrpc Enable the JSON-RPC API sever. -j --jsonrpc Enable the JSON-RPC API sever.
--jsonrpc-addr HOST Specify the hostname portion of the JSONRPC API --jsonrpc-interface IP Specify the hostname portion of the JSONRPC API
server [default: 127.0.0.1]. server, IP should be an interface's IP address, or
all (all interfaces) or local [default: all].
--jsonrpc-port PORT Specify the port portion of the JSONRPC API server --jsonrpc-port PORT Specify the port portion of the JSONRPC API server
[default: 8545]. [default: 8545].
--jsonrpc-cors URL Specify CORS header for JSON-RPC API responses --jsonrpc-cors URL Specify CORS header for JSON-RPC API responses
@ -149,7 +150,7 @@ Geth-compatibility Options:
--nodekey KEY Equivalent to --node-key KEY. --nodekey KEY Equivalent to --node-key KEY.
--nodiscover Equivalent to --no-discovery. --nodiscover Equivalent to --no-discovery.
--rpc Equivalent to --jsonrpc. --rpc Equivalent to --jsonrpc.
--rpcaddr HOST Equivalent to --jsonrpc-addr HOST. --rpcaddr IP Equivalent to --jsonrpc-interface IP.
--rpcport PORT Equivalent to --jsonrpc-port PORT. --rpcport PORT Equivalent to --jsonrpc-port PORT.
--rpcapi APIS Equivalent to --jsonrpc-apis APIS. --rpcapi APIS Equivalent to --jsonrpc-apis APIS.
--rpccorsdomain URL Equivalent to --jsonrpc-cors URL. --rpccorsdomain URL Equivalent to --jsonrpc-cors URL.
@ -188,7 +189,7 @@ struct Args {
flag_cache_max_size: usize, flag_cache_max_size: usize,
flag_queue_max_size: usize, flag_queue_max_size: usize,
flag_jsonrpc: bool, flag_jsonrpc: bool,
flag_jsonrpc_addr: String, flag_jsonrpc_interface: String,
flag_jsonrpc_port: u16, flag_jsonrpc_port: u16,
flag_jsonrpc_cors: String, flag_jsonrpc_cors: String,
flag_jsonrpc_apis: String, flag_jsonrpc_apis: String,
@ -523,7 +524,11 @@ impl Configuration {
// Setup rpc // Setup rpc
if self.args.flag_jsonrpc || self.args.flag_rpc { if self.args.flag_jsonrpc || self.args.flag_rpc {
let url = format!("{}:{}", let url = format!("{}:{}",
self.args.flag_rpcaddr.as_ref().unwrap_or(&self.args.flag_jsonrpc_addr), match self.args.flag_rpcaddr.as_ref().unwrap_or(&self.args.flag_jsonrpc_interface).as_str() {
"all" => "0.0.0.0",
"local" => "127.0.0.1",
x => x,
},
self.args.flag_rpcport.unwrap_or(self.args.flag_jsonrpc_port) self.args.flag_rpcport.unwrap_or(self.args.flag_jsonrpc_port)
); );
SocketAddr::from_str(&url).unwrap_or_else(|_| die!("{}: Invalid JSONRPC listen host/port given.", url)); SocketAddr::from_str(&url).unwrap_or_else(|_| die!("{}: Invalid JSONRPC listen host/port given.", url));