Struct VMess

Source
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

Source

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==");
Source

pub fn scrape(source: &str) -> Vec<Self>

Scrapes VMess proxy information from the provided source string and returns a vector of VMess instances.

§Arguments
  • source - A string containing the source code or text from which to extract VMess proxy information.
§Returns

A vector of VMess instances parsed from the source string.

Trait Implementations§

Source§

impl Debug for VMess

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for VMess

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for VMess

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. 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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,