trojan_rust 0.1.0

A library and tool for trojan proxy
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use std::net:: SocketAddr;

#[derive(Debug)]
pub enum IpAddress {
    IpAddr(SocketAddr),
    Domain(String,u16),
}

impl std::fmt::Display for IpAddress {
    #[inline]
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        match *self {
            IpAddress::IpAddr(ref addr) => write!(f, "{}", addr),
            IpAddress::Domain(ref addr, ref port) => write!(f, "{}:{}", addr, port),
        }
    }
}