pub struct VMess {
pub add: String,
pub host: Option<String>,
pub id: String,
pub port: Value,
pub net: String,
pub sni: Option<String>,
pub tls: Option<String>,
pub metadata: Option<HashMap<String, String>>,
}
Expand description
Represents a VMess proxy.
Fields§
§add: String
The address of the VMess server.
host: Option<String>
The optional host address of the VMess server.
id: String
The UUID of the VMess server.
port: Value
The port number of the VMess server.
net: String
The network type of the VMess server.
sni: Option<String>
The optional SNI (Server Name Indication) of the VMess server.
tls: Option<String>
The optional TLS (Transport Layer Security) of the VMess server.
metadata: Option<HashMap<String, String>>
Additional metadata associated with the VMess server.
Implementations§
Source§impl VMess
impl VMess
Sourcepub fn to_url(&self) -> String
pub fn to_url(&self) -> String
Converts the VMess proxy information into a VMess URL.
§Example
use proxy_scraper::vmess::VMess;
let proxy = VMess {
add: "example.com".to_string(),
host: Some("www.example.com".to_string()),
id: "uuid".to_string(),
port: serde_json::json!(443),
net: "tcp".to_string(),
sni: Some("example.com".to_string()),
tls: Some("tls".to_string()),
metadata: None,
};
let url = proxy.to_url();
assert_eq!(url, "vmess://ewogICJhZGQiOiAiZXhhbXBsZS5jb20iLAogICJob3N0IjogInd3dy5leGFtcGxlLmNvbSIsCiAgImlkIjogInV1aWQiLAogICJwb3J0IjogNDQzLAogICJuZXQiOiAidGNwIiwKICAic25pIjogImV4YW1wbGUuY29tIiwKICAidGxzIjogInRscyIKfQ==");
Trait Implementations§
Source§impl<'de> Deserialize<'de> for VMess
impl<'de> Deserialize<'de> for VMess
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 VMess
impl RefUnwindSafe for VMess
impl Send for VMess
impl Sync for VMess
impl Unpin for VMess
impl UnwindSafe for VMess
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