1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
use std::net::IpAddr;

use serde::{Deserialize, Serialize};

pub mod agent;
// pub mod api;
pub mod client;
pub mod error;
pub mod generic;
pub mod policy;
pub mod publish;
pub mod token;
pub trait GetResponse {
    type Item;

    fn response(&self) -> Option<Self::Item>;
}

#[derive(Deserialize, Debug, Clone, Serialize, Default)]
pub enum ServiceType {
    Ws,
    #[default]
    Wss,
}

#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct Peer2PeerInstruction {
    pub peer_ip: IpAddr,
    pub seed_port: u16,
    pub seq: u16,
    pub peer_nat: NatType, // peer nat type
    pub nat: NatType,      // nat type
}

#[derive(PartialEq, Debug, Serialize, Deserialize, Clone, Copy)]
pub enum NatType {
    Easy,
    Hard,
    Unknown,
}