1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Copyright (c) 2023 MASSA LABS <info@massa.net>

use massa_time::MassaTime;

/// Client common settings.
/// the client common settings
#[derive(Debug, Clone)]
pub struct ClientConfig {
    /// maximum size in bytes of a request.
    pub max_request_body_size: u32,
    /// timeout of an request.
    pub request_timeout: MassaTime,
    /// maximum concurrent requests.
    pub max_concurrent_requests: usize,
    /// certificate_store, `Native` or `WebPki`
    pub certificate_store: String,
    /// JSON-RPC request object id data type, `Number` or `String`
    pub id_kind: String,
    /// max length for logging for requests and responses. Logs bigger than this limit will be truncated.
    pub max_log_length: u32,
    /// custom headers to pass with every request.
    pub headers: Vec<(String, String)>,
}

/// Http client settings.
/// the Http client settings
#[derive(Debug, Clone)]
pub struct HttpConfig {
    /// common client configuration.
    pub client_config: ClientConfig,
    /// whether to enable HTTP.
    pub enabled: bool,
}

/// WebSocket client settings.
/// the WebSocket client settings
#[derive(Debug, Clone)]
pub struct WsConfig {
    /// common client configuration.
    pub client_config: ClientConfig,
    /// whether to enable WS.
    pub enabled: bool,
    /// Max notifications per subscription.
    pub max_notifs_per_subscription: usize,
    /// Max number of redirections.
    pub max_redirections: usize,
}