Struct sc_rpc_server::Config

source ·
pub struct Config<'a, M: Send + Sync + 'static> {
Show 15 fields pub addrs: [SocketAddr; 2], pub cors: Option<&'a Vec<String>>, pub max_connections: u32, pub max_subs_per_conn: u32, pub max_payload_in_mb: u32, pub max_payload_out_mb: u32, pub metrics: Option<RpcMetrics>, pub message_buffer_capacity: u32, pub rpc_api: RpcModule<M>, pub id_provider: Option<Box<dyn IdProvider>>, pub tokio_handle: Handle, pub batch_config: BatchRequestConfig, pub rate_limit: Option<NonZeroU32>, pub rate_limit_whitelisted_ips: Vec<IpNetwork>, pub rate_limit_trust_proxy_headers: bool,
}
Expand description

RPC server configuration.

Fields§

§addrs: [SocketAddr; 2]

Socket addresses.

§cors: Option<&'a Vec<String>>

CORS.

§max_connections: u32

Maximum connections.

§max_subs_per_conn: u32

Maximum subscriptions per connection.

§max_payload_in_mb: u32

Maximum rpc request payload size.

§max_payload_out_mb: u32

Maximum rpc response payload size.

§metrics: Option<RpcMetrics>

Metrics.

§message_buffer_capacity: u32

Message buffer size

§rpc_api: RpcModule<M>

RPC API.

§id_provider: Option<Box<dyn IdProvider>>

Subscription ID provider.

§tokio_handle: Handle

Tokio runtime handle.

§batch_config: BatchRequestConfig

Batch request config.

§rate_limit: Option<NonZeroU32>

Rate limit calls per minute.

§rate_limit_whitelisted_ips: Vec<IpNetwork>

Disable rate limit for certain ips.

§rate_limit_trust_proxy_headers: bool

Trust proxy headers for rate limiting.

Trait Implementations§

source§

impl<'a, M: Debug + Send + Sync + 'static> Debug for Config<'a, M>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a, M> Freeze for Config<'a, M>

§

impl<'a, M> !RefUnwindSafe for Config<'a, M>

§

impl<'a, M> Send for Config<'a, M>

§

impl<'a, M> Sync for Config<'a, M>

§

impl<'a, M> Unpin for Config<'a, M>

§

impl<'a, M> !UnwindSafe for Config<'a, M>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more