mirror of
https://github.com/tun2proxy/tun2proxy.git
synced 2025-06-21 16:41:01 +00:00
Use Option type for credentials
This commit applys the diff by @ssrlive from
3223ca4e22 (commitcomment-105521241)
.
This commit is contained in:
parent
8dd075a7f4
commit
2f295c3fdc
7 changed files with 40 additions and 35 deletions
16
src/lib.rs
16
src/lib.rs
|
@ -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 => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue