#[derive(Clone)]
pub struct Config {
identity: Identity, datastore: Datastore, addrs: Addresses, mounts: Mounts, discovery: Discovery, routing: Routing, ipns: Ipns, bootstrap: Vec<String>, gateway: Gateway, api: API, swarm: Swarm,
auto_nat: AutoNAT,
pubsub: PubsubConfig,
peering: Peering,
provider: Provider,
reprovider: Reprovider,
experimental: Experiments,
plugins: Plugins,
}
pub struct Identity {
peer_id: String,
priv_key: Option<String>,
key_pair: Option<identity::KeyPair>,
}
pub struct Datastore {
storage_max: String, storage_gc_watermark: u64, gc_period: String, spec: toml::Value,
hash_on_read: bool,
bloom_filtersize: usizea,
}
pub struct Addresses {
swarm: Vec<String>, announce: Vec<String>, no_announce: Vec<String>, api: Vec<String>, gateway: Vec<String>, }
pub struct Mounts {
ipfs: String,
ipns: String,
fuse_allow_other: bool,
}
pub struct Discovery {
mdns: Mdns,
}
pub struct Mdns {
enabled: bool,
interval: u64, }
pub struct Routing {
r#type: String,
}
pub struct Ipns {
republish_period: String,
record_lifetime: String,
resolve_cachesize: usize,
}
pub struct GatewaySpec {
paths: Vec<String>,
use_subdomains: bool,
no_dnslink: bool,
}
pub struct Gateway {
http_headers: toml::Value, root_redirect: String,
writable: bool,
path_prefixes: Vec<String>,
api_commands: Vec<String>,
no_fetch: bool,
no_dnslink: bool,
public_gateways: toml::Value,
}
pub struct Api {
http_headers: toml::Value, }
pub struct Swarm {
addr_filters: Vec<String>,
disable_bandwidth_metrics: bool,
disable_nat_portmap: bool,
enable_relay_hop: bool,
enable_auto_relay: bool,
transports: Transports,
connmgr: ConnMgr,
}
pub struct Transports {
network: Network,
security: Security,
multiplexers: Multiplexers,
}
pub struct Security {
tls: Priority, secio: Priority, noise: Priority, }
pub struct Network {
quic: Ternary,
tcp: Ternary,
web_socket: Ternary,
relay: Ternary,
}
pub struct Multiplexers {
yamux: Priority, mplex: Priority, }
pub struct ConnMgr {
r#type: String,
low_water: i64,
high_water: i64,
grace_period: String,
}
pub struct AutoNAT {
service: AutoNATService,
throttle AutoNATThrottle,
}
pub struct AutoNATThrottle {
global_limit: u64,
peer_limit: u64,
interval: u64,
}
enum AutoNATService {
Unset,
Enabled
Disabled
)
impl Config {
pub fn to_peer_id(&self) -> PeerId {
todo!()
}
}