Merge pull request #513 from pierre-l/#495
Listening address is hardcoded to 127 0 0 1 #495
This commit is contained in:
commit
424642fbee
|
@ -21,6 +21,12 @@ args:
|
||||||
value_name: IP
|
value_name: IP
|
||||||
help: Connect only to the specified node.
|
help: Connect only to the specified node.
|
||||||
takes_value: true
|
takes_value: true
|
||||||
|
- host:
|
||||||
|
short: h
|
||||||
|
long: host
|
||||||
|
value_name: HOST
|
||||||
|
help: Listen for connections on HOST.
|
||||||
|
takes_value: true
|
||||||
- seednode:
|
- seednode:
|
||||||
short: s
|
short: s
|
||||||
long: seednode
|
long: seednode
|
||||||
|
|
|
@ -96,7 +96,7 @@ pub fn start(cfg: config::Config) -> Result<(), String> {
|
||||||
protocol_version: PROTOCOL_VERSION,
|
protocol_version: PROTOCOL_VERSION,
|
||||||
protocol_minimum: PROTOCOL_MINIMUM,
|
protocol_minimum: PROTOCOL_MINIMUM,
|
||||||
magic: cfg.consensus.magic(),
|
magic: cfg.consensus.magic(),
|
||||||
local_address: SocketAddr::new("127.0.0.1".parse().unwrap(), cfg.port),
|
local_address: SocketAddr::new(cfg.host, cfg.port),
|
||||||
services: cfg.services,
|
services: cfg.services,
|
||||||
user_agent: cfg.user_agent,
|
user_agent: cfg.user_agent,
|
||||||
start_height: 0,
|
start_height: 0,
|
||||||
|
|
|
@ -19,6 +19,7 @@ pub struct Config {
|
||||||
pub services: Services,
|
pub services: Services,
|
||||||
pub port: u16,
|
pub port: u16,
|
||||||
pub connect: Option<net::SocketAddr>,
|
pub connect: Option<net::SocketAddr>,
|
||||||
|
pub host: net::IpAddr,
|
||||||
pub seednodes: Vec<String>,
|
pub seednodes: Vec<String>,
|
||||||
pub quiet: bool,
|
pub quiet: bool,
|
||||||
pub inbound_connections: u32,
|
pub inbound_connections: u32,
|
||||||
|
@ -111,6 +112,14 @@ pub fn parse(matches: &clap::ArgMatches) -> Result<Config, String> {
|
||||||
None => InternetProtocol::default(),
|
None => InternetProtocol::default(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let host = match matches.value_of("host") {
|
||||||
|
Some(s) => s.parse::<net::IpAddr>().map_err(|_| "Invalid host".to_owned())?,
|
||||||
|
None => match only_net {
|
||||||
|
InternetProtocol::IpV6 => "::".parse().unwrap(),
|
||||||
|
_ => "0.0.0.0".parse().unwrap(),
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
let rpc_config = parse_rpc_config(network, matches)?;
|
let rpc_config = parse_rpc_config(network, matches)?;
|
||||||
|
|
||||||
let block_notify_command = match matches.value_of("blocknotify") {
|
let block_notify_command = match matches.value_of("blocknotify") {
|
||||||
|
@ -147,6 +156,7 @@ pub fn parse(matches: &clap::ArgMatches) -> Result<Config, String> {
|
||||||
services: services,
|
services: services,
|
||||||
port: port,
|
port: port,
|
||||||
connect: connect,
|
connect: connect,
|
||||||
|
host: host,
|
||||||
seednodes: seednodes,
|
seednodes: seednodes,
|
||||||
inbound_connections: in_connections,
|
inbound_connections: in_connections,
|
||||||
outbound_connections: out_connections,
|
outbound_connections: out_connections,
|
||||||
|
|
Loading…
Reference in New Issue