narrowlink_types/
lib.rs

1use std::net::IpAddr;
2
3use serde::{Deserialize, Serialize};
4
5pub mod agent;
6// pub mod api;
7pub mod client;
8pub mod error;
9pub mod generic;
10pub mod policy;
11pub mod publish;
12pub mod token;
13pub trait GetResponse {
14    type Item;
15
16    fn response(&self) -> Option<Self::Item>;
17}
18
19#[derive(Deserialize, Debug, Clone, Serialize, Default)]
20pub enum ServiceType {
21    Ws,
22    #[default]
23    Wss,
24}
25
26#[derive(Debug, Serialize, Deserialize, Clone)]
27pub struct Peer2PeerInstruction {
28    pub peer_ip: IpAddr,
29    pub seed_port: u16,
30    pub seq: u16,
31    pub peer_nat: NatType, // peer nat type
32    pub nat: NatType,      // nat type
33}
34
35#[derive(PartialEq, Debug, Serialize, Deserialize, Clone, Copy)]
36pub enum NatType {
37    Easy,
38    Hard,
39    Unknown,
40}