1use std::time::Duration;
2
3use crate::reqwest::header::HeaderValue;
4use ergo_chain_types::PeerAddr;
5
6#[derive(PartialEq, Eq, Debug, Clone, Copy)]
8pub struct NodeConf {
9 pub addr: PeerAddr,
11 pub api_key: Option<&'static str>,
13 pub timeout: Option<Duration>,
15}
16
17impl NodeConf {
18 pub fn get_node_api_header(&self) -> HeaderValue {
20 match self.api_key {
21 Some(api_key) => match HeaderValue::from_str(api_key) {
22 Ok(k) => k,
23 _ => HeaderValue::from_static("None"),
24 },
25 None => HeaderValue::from_static("None"),
26 }
27 }
28}