pub struct Trojan {
pub host: String,
pub port: u32,
pub password: String,
pub parameters: Option<HashMap<String, String>>,
}
Expand description
Represents a Trojan proxy.
Fields§
§host: String
The host address of the Trojan proxy.
port: u32
The port number for the Trojan proxy.
password: String
The password associated with the Trojan proxy.
parameters: Option<HashMap<String, String>>
Additional parameters associated with the Trojan proxy.
Implementations§
Source§impl Trojan
impl Trojan
Sourcepub fn to_url(&self) -> String
pub fn to_url(&self) -> String
Converts the Trojan proxy information into a Trojan URL.
§Example
use std::collections::HashMap;
use proxy_scraper::trojan::Trojan;
let proxy = Trojan {
host: "example.com".to_string(),
port: 443,
password: "password123".to_string(),
parameters: Some(HashMap::new()), // Insert additional parameters here
};
let url = proxy.to_url();
assert_eq!(url, "trojan://password123@example.com:443?");
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Trojan
impl<'de> Deserialize<'de> for Trojan
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Trojan
impl RefUnwindSafe for Trojan
impl Send for Trojan
impl Sync for Trojan
impl Unpin for Trojan
impl UnwindSafe for Trojan
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more