Add -rpcbind option to allow binding RPC port on a specific interface
Add -rpcbind command option to specify binding RPC service on one
or multiple specific interfaces.
Functionality if -rpcbind is not specified remains the same as before:
- If no -rpcallowip specified, bind on localhost
- If no -rpcbind specified, bind on any interface
Implements part of #3111.
strUsage+=" -server "+_("Accept command line and JSON-RPC commands")+"\n";
strUsage+=" -server "+_("Accept command line and JSON-RPC commands")+"\n";
strUsage+=" -rpcbind=<addr> "+_("Bind to given address to listen for JSON-RPC connections. Use [host]:port notation for IPv6. This option can be specified multiple times (default: bind to all interfaces)")+"\n";
strUsage+=" -rpcuser=<user> "+_("Username for JSON-RPC connections")+"\n";
strUsage+=" -rpcuser=<user> "+_("Username for JSON-RPC connections")+"\n";
strUsage+=" -rpcpassword=<pw> "+_("Password for JSON-RPC connections")+"\n";
strUsage+=" -rpcpassword=<pw> "+_("Password for JSON-RPC connections")+"\n";
strUsage+=" -rpcport=<port> "+_("Listen for JSON-RPC connections on <port> (default: 8332 or testnet: 18332)")+"\n";
strUsage+=" -rpcport=<port> "+_("Listen for JSON-RPC connections on <port> (default: 8332 or testnet: 18332)")+"\n";
strUsage+=" -rpcallowip=<ip> "+_("Allow JSON-RPC connections from specified IP address")+"\n";
strUsage+=" -rpcallowip=<ip> "+_("Allow JSON-RPC connections from specified IP address. This option can be specified multiple times")+"\n";
strUsage+=" -rpcthreads=<n> "+_("Set the number of threads to service RPC calls (default: 4)")+"\n";
strUsage+=" -rpcthreads=<n> "+_("Set the number of threads to service RPC calls (default: 4)")+"\n";
strUsage+="\n"+_("RPC SSL options: (see the Bitcoin Wiki for SSL setup instructions)")+"\n";
strUsage+="\n"+_("RPC SSL options: (see the Bitcoin Wiki for SSL setup instructions)")+"\n";
strerr=strprintf(_("An error occurred while setting up the RPC port %u for listening on IPv6, falling back to IPv4: %s"),endpoint.port(),e.what());
LogPrintf("ERROR: Binding RPC on address %s port %i failed: %s\n",bindAddress.to_string(),endpoint.port(),e.what());
strerr=strprintf(_("An error occurred while setting up the RPC address %s port %u for listening: %s"),bindAddress.to_string(),endpoint.port(),e.what());
}
}
try{
// If dual IPv6/IPv4 failed (or we're opening loopback interfaces only), open IPv4 separately