pub struct RpcParams {Show 16 fields
pub rpc_external: bool,
pub unsafe_rpc_external: bool,
pub rpc_methods: RpcMethods,
pub rpc_rate_limit: Option<NonZeroU32>,
pub rpc_rate_limit_whitelisted_ips: Vec<IpNetwork>,
pub rpc_rate_limit_trust_proxy_headers: bool,
pub rpc_max_request_size: u32,
pub rpc_max_response_size: u32,
pub rpc_max_subscriptions_per_connection: u32,
pub rpc_port: Option<u16>,
pub experimental_rpc_endpoint: Vec<RpcEndpoint>,
pub rpc_max_connections: u32,
pub rpc_message_buffer_capacity_per_connection: u32,
pub rpc_disable_batch_requests: bool,
pub rpc_max_batch_request_len: Option<u32>,
pub rpc_cors: Option<Cors>,
}
Expand description
Parameters of RPC.
Fields§
§rpc_external: bool
Listen to all RPC interfaces (default: local).
Not all RPC methods are safe to be exposed publicly.
Use an RPC proxy server to filter out dangerous methods. More details: https://docs.substrate.io/build/remote-procedure-calls/#public-rpc-interfaces.
Use --unsafe-rpc-external
to suppress the warning if you understand the risks.
unsafe_rpc_external: bool
Listen to all RPC interfaces.
Same as --rpc-external
.
rpc_methods: RpcMethods
RPC methods to expose.
rpc_rate_limit: Option<NonZeroU32>
RPC rate limiting (calls/minute) for each connection.
This is disabled by default.
For example --rpc-rate-limit 10
will maximum allow
10 calls per minute per connection.
rpc_rate_limit_whitelisted_ips: Vec<IpNetwork>
Disable RPC rate limiting for certain ip addresses.
Each IP address must be in CIDR notation such as 1.2.3.4/24
.
rpc_rate_limit_trust_proxy_headers: bool
Trust proxy headers for disable rate limiting.
By default the rpc server will not trust headers such X-Real-IP
, X-Forwarded-For
and
Forwarded
and this option will make the rpc server to trust these headers.
For instance this may be secure if the rpc server is behind a reverse proxy and that the proxy always sets these headers.
rpc_max_request_size: u32
Set the maximum RPC request payload size for both HTTP and WS in megabytes.
rpc_max_response_size: u32
Set the maximum RPC response payload size for both HTTP and WS in megabytes.
rpc_max_subscriptions_per_connection: u32
Set the maximum concurrent subscriptions per connection.
rpc_port: Option<u16>
Specify JSON-RPC server TCP port.
experimental_rpc_endpoint: Vec<RpcEndpoint>
EXPERIMENTAL: Specify the JSON-RPC server interface and this option which can be enabled several times if you want expose several RPC interfaces with different configurations.
The format for this option is:
--experimental-rpc-endpoint" listen-addr=<ip:port>,<key=value>,..."
where each option is
separated by a comma and listen-addr
is the only required param.
The following options are available: • listen-addr: The socket address (ip:port) to listen on. Be careful to not expose the server to the public internet unless you know what you’re doing. (required) • disable-batch-requests: Disable batch requests (optional) • max-connections: The maximum number of concurrent connections that the server will accept (optional) • max-request-size: The maximum size of a request body in megabytes (optional) • max-response-size: The maximum size of a response body in megabytes (optional) • max-subscriptions-per-connection: The maximum number of subscriptions per connection (optional) • max-buffer-capacity-per-connection: The maximum buffer capacity per connection (optional) • max-batch-request-len: The maximum number of requests in a batch (optional) • cors: The CORS allowed origins, this can enabled more than once (optional) • methods: Which RPC methods to allow, valid values are “safe”, “unsafe” and “auto” (optional) • optional: If the listen address is optional i.e the interface is not required to be available For example this may be useful if some platforms doesn’t support ipv6 (optional) • rate-limit: The rate limit in calls per minute for each connection (optional) • rate-limit-trust-proxy-headers: Trust proxy headers for disable rate limiting (optional) • rate-limit-whitelisted-ips: Disable rate limiting for certain ip addresses, this can be enabled more than once (optional) • retry-random-port: If the port is already in use, retry with a random port (optional)
Use with care, this flag is unstable and subject to change.
rpc_max_connections: u32
Maximum number of RPC server connections.
rpc_message_buffer_capacity_per_connection: u32
The number of messages the RPC server is allowed to keep in memory.
If the buffer becomes full then the server will not process new messages until the connected client start reading the underlying messages.
This applies per connection which includes both JSON-RPC methods calls and subscriptions.
rpc_disable_batch_requests: bool
Disable RPC batch requests
rpc_max_batch_request_len: Option<u32>
Limit the max length per RPC batch request
rpc_cors: Option<Cors>
Specify browser origins allowed to access the HTTP & WS RPC servers.
A comma-separated list of origins (protocol://domain or special null
value). Value of all
will disable origin validation. Default is to
allow localhost and https://polkadot.js.org origins. When running in
--dev
mode the default is to allow all origins.
Implementations§
source§impl RpcParams
impl RpcParams
sourcepub fn rpc_cors(&self, is_dev: bool) -> Result<Option<Vec<String>>>
pub fn rpc_cors(&self, is_dev: bool) -> Result<Option<Vec<String>>>
Returns the RPC CORS configuration.
sourcepub fn rpc_addr(
&self,
is_dev: bool,
is_validator: bool,
default_listen_port: u16,
) -> Result<Option<Vec<RpcEndpoint>>>
pub fn rpc_addr( &self, is_dev: bool, is_validator: bool, default_listen_port: u16, ) -> Result<Option<Vec<RpcEndpoint>>>
Returns the RPC endpoints.
sourcepub fn rpc_batch_config(&self) -> Result<RpcBatchRequestConfig>
pub fn rpc_batch_config(&self) -> Result<RpcBatchRequestConfig>
Returns the configuration for batch RPC requests.
Trait Implementations§
source§impl Args for RpcParams
impl Args for RpcParams
source§fn augment_args<'b>(__clap_app: Command) -> Command
fn augment_args<'b>(__clap_app: Command) -> Command
source§fn augment_args_for_update<'b>(__clap_app: Command) -> Command
fn augment_args_for_update<'b>(__clap_app: Command) -> Command
Command
so it can instantiate self
via
FromArgMatches::update_from_arg_matches_mut
Read moresource§impl FromArgMatches for RpcParams
impl FromArgMatches for RpcParams
source§fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
source§fn from_arg_matches_mut(
__clap_arg_matches: &mut ArgMatches,
) -> Result<Self, Error>
fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>
source§fn update_from_arg_matches(
&mut self,
__clap_arg_matches: &ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>
ArgMatches
to self
.source§fn update_from_arg_matches_mut(
&mut self,
__clap_arg_matches: &mut ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches_mut( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>
ArgMatches
to self
.Auto Trait Implementations§
impl Freeze for RpcParams
impl RefUnwindSafe for RpcParams
impl Send for RpcParams
impl Sync for RpcParams
impl Unpin for RpcParams
impl UnwindSafe for RpcParams
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CheckedConversion for T
impl<T> CheckedConversion for T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> FmtForward for T
impl<T> FmtForward for T
source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self
to use its Display
implementation when
Debug
-formatted.source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self
to use its LowerExp
implementation when
Debug
-formatted.source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self
to use its LowerHex
implementation when
Debug
-formatted.source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self
to use its Pointer
implementation when
Debug
-formatted.source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self
to use its UpperExp
implementation when
Debug
-formatted.source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self
to use its UpperHex
implementation when
Debug
-formatted.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<T, Outer> IsWrappedBy<Outer> for T
impl<T, Outer> IsWrappedBy<Outer> for T
source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moresource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moresource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self
, then passes self.as_ref()
into the pipe function.source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self
, then passes self.as_mut()
into the pipe
function.source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self
, then passes self.deref()
into the pipe function.source§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
source§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
source§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
T
. Read moresource§impl<T> Tap for T
impl<T> Tap for T
source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B>
of a value. Read moresource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B>
of a value. Read moresource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R>
view of a value. Read moresource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R>
view of a value. Read moresource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target
of a value. Read moresource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target
of a value. Read moresource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds.source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow()
only in debug builds, and is erased in release
builds.source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref()
only in debug builds, and is erased in release
builds.source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut()
only in debug builds, and is erased in release
builds.source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref()
only in debug builds, and is erased in release
builds.source§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
source§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
unchecked_from
.source§impl<T, S> UniqueSaturatedInto<T> for S
impl<T, S> UniqueSaturatedInto<T> for S
source§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
T
.