config: normalize external IPs when parsing config

This commit is contained in:
Wilmer Paulino 2018-04-23 12:42:17 -04:00
parent d17a561d8b
commit 5732f5a1c4
No known key found for this signature in database
GPG Key ID: 6DF57B9F9514972F

View File

@ -790,18 +790,27 @@ func loadConfig() (*config, error) {
// Add default port to all RPC listener addresses if needed and remove
// duplicate addresses.
cfg.RPCListeners = normalizeAddresses(cfg.RPCListeners,
strconv.Itoa(defaultRPCPort))
cfg.RPCListeners = normalizeAddresses(
cfg.RPCListeners, strconv.Itoa(defaultRPCPort),
)
// Add default port to all REST listener addresses if needed and remove
// duplicate addresses.
cfg.RESTListeners = normalizeAddresses(cfg.RESTListeners,
strconv.Itoa(defaultRESTPort))
cfg.RESTListeners = normalizeAddresses(
cfg.RESTListeners, strconv.Itoa(defaultRESTPort),
)
// Add default port to all listener addresses if needed and remove
// duplicate addresses.
cfg.Listeners = normalizeAddresses(cfg.Listeners,
strconv.Itoa(defaultPeerPort))
cfg.Listeners = normalizeAddresses(
cfg.Listeners, strconv.Itoa(defaultPeerPort),
)
// Add default port to all external IP addresses if needed and remove
// duplicate addresses.
cfg.ExternalIPs = normalizeAddresses(
cfg.ExternalIPs, strconv.Itoa(defaultPeerPort),
)
// Finally, ensure that we are only listening on localhost if Tor
// inbound support is enabled.