Use Option type for credentials

This commit applys the diff by @ssrlive from
3223ca4e22 (commitcomment-105521241).
This commit is contained in:
B. Blechschmidt 2023-03-22 12:18:41 +01:00
parent 8dd075a7f4
commit 2f295c3fdc
7 changed files with 40 additions and 35 deletions

View file

@ -13,7 +13,21 @@ pub enum ProxyType {
Http,
}
pub fn main_entry(tun: &str, addr: SocketAddr, proxy_type: ProxyType, credentials: Credentials) {
impl std::fmt::Display for ProxyType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
ProxyType::Socks5 => write!(f, "socks5"),
ProxyType::Http => write!(f, "http"),
}
}
}
pub fn main_entry(
tun: &str,
addr: SocketAddr,
proxy_type: ProxyType,
credentials: Option<Credentials>,
) {
let mut ttp = TunToProxy::new(tun);
match proxy_type {
ProxyType::Socks5 => {