changeset 11: |
d8f806f1d327 |
author: |
ellis <ellis@rwest.io> |
date: |
Sun, 14 May 2023 21:27:04 -0400 |
permissions: |
-rw-r--r-- |
description: |
obj updates |
1 //! cfg::config::network 3 //! Network configuration primitives 4 use serde::{Deserialize, Serialize}; 5 use std::{fmt, net::SocketAddr}; 7 /// Network configuration 8 #[derive(Serialize, Deserialize, Hash, Debug, PartialEq, Clone)] 9 pub struct NetworkConfig { 11 pub socket: SocketAddr, 12 /// a proxy to forward packets from 13 pub proxy: Option<SocketAddr>, 15 pub tunnel: Option<String>, 16 /// network engine to attach 17 pub engine: EngineType, 18 /// peers to register AOT 19 pub peers: Option<Vec<SocketAddr>>, 22 impl Default for NetworkConfig { 23 fn default() -> Self { 25 socket: "127.0.0.1:0".parse().unwrap(), 28 engine: EngineType::default(), 34 #[derive(Serialize, Deserialize, Hash, Debug, PartialEq, Clone)] 43 impl Default for EngineType { 44 fn default() -> Self { 49 impl std::fmt::Display for EngineType { 50 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 52 EngineType::Quic => write!(f, "quic"), 53 EngineType::Http => write!(f, "http"), 54 EngineType::Dns => write!(f, "dns"), 55 EngineType::Ssh => write!(f, "ssh"), 56 EngineType::Uds => write!(f, "uds"),