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 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§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<Src, Dest> IntoTuple<Dest> for Srcwhere
Dest: FromTuple<Src>,
impl<Src, Dest> IntoTuple<Dest> for Srcwhere
Dest: FromTuple<Src>,
fn into_tuple(self) -> Dest
Source§impl<T, Outer> IsWrappedBy<Outer> for T
impl<T, Outer> IsWrappedBy<Outer> for T
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<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
.