Mercurial > core / rust/lib/obj/src/config/network.rs
changeset 67: |
0ccbbd142694 |
parent: |
c7165d93a9eb
|
author: |
ellis <ellis@rwest.io> |
date: |
Sat, 02 Dec 2023 16:26:08 -0500 |
permissions: |
-rw-r--r-- |
description: |
rust cleanup, added rocksdb bindings |
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)] 44 impl Default for EngineType { 45 fn default() -> Self { 50 impl std::fmt::Display for EngineType { 51 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 53 EngineType::Quic => write!(f, "quic"), 54 EngineType::Http => write!(f, "http"), 55 EngineType::Dns => write!(f, "dns"), 56 EngineType::Ssh => write!(f, "ssh"), 57 EngineType::Uds => write!(f, "uds"), 58 EngineType::Raw => write!(f, "raw"),