--rpclisten-borsh/json should support ip only like --grpclisten
kaspad supports specifying --rpclisten=0.0.0.0 for listening on all interfaces on default network port.
However, it doesn't support the same for --rpclisten-borsh and --rpclisten-json, even though the --help text specifies it as optional and is identical for the three:
--rpclisten[=<IP[:PORT]>]
Interface:port to listen for gRPC connections (default port: 16110, testnet: 16210).
--rpclisten-borsh[=<IP[:PORT]>]
Interface:port to listen for wRPC Borsh connections (default port: 17110, testnet: 17210).
--rpclisten-json[=<IP[:PORT]>]
Interface:port to listen for wRPC JSON connections (default port: 18110, testnet: 18210).
For rpclisten-borsh the input is parsed into a WrpcNetAddress which can be any of default, public or an <ip>:<port>. The goal here is to also support just <ip>.
The string parsing logic in rpc/wrpc/server/src/addresses.rs is:
impl FromStr for WrpcNetAddress {
type Err = AddrParseError;
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"default" => Ok(WrpcNetAddress::Default),
"public" => Ok(WrpcNetAddress::Public),
_ => {
let addr: ContextualNetAddress = s.parse()?;
Ok(Self::Custom(addr))
}
}
}
}
The work is focused on the _ arm of this match.
NOTE: Make sure that if only the IP is passed that you use the default port for the given network. Mainnet, testnet, simnet, devnet may have different default ports.
I have drafted a PR for this issue, but forgot to include a reference in the commit https://github.com/kaspanet/rusty-kaspa/pull/439
This has been implemented in one of the merged PRs. Closing.