Proxy

Struct Proxy 

Source
pub struct Proxy {
Show 60 fields pub proxy_type: ProxyType, pub combined_proxy: Option<CombinedProxy>, pub id: u32, pub group_id: i32, pub group: String, pub remark: String, pub hostname: String, pub port: u16, pub username: Option<String>, pub password: Option<String>, pub encrypt_method: Option<String>, pub plugin: Option<String>, pub plugin_option: Option<String>, pub protocol: Option<String>, pub protocol_param: Option<String>, pub obfs: Option<String>, pub obfs_param: Option<String>, pub user_id: Option<String>, pub alter_id: u16, pub transfer_protocol: Option<String>, pub fake_type: Option<String>, pub tls_secure: bool, pub host: Option<String>, pub path: Option<String>, pub edge: Option<String>, pub quic_secure: Option<String>, pub quic_secret: Option<String>, pub udp: Option<bool>, pub tcp_fast_open: Option<bool>, pub allow_insecure: Option<bool>, pub tls13: Option<bool>, pub underlying_proxy: Option<String>, pub snell_version: u16, pub server_name: Option<String>, pub self_ip: Option<String>, pub self_ipv6: Option<String>, pub public_key: Option<String>, pub private_key: Option<String>, pub pre_shared_key: Option<String>, pub dns_servers: HashSet<String>, pub mtu: u16, pub allowed_ips: String, pub keep_alive: u16, pub test_url: Option<String>, pub client_id: Option<String>, pub ports: Option<String>, pub up_speed: u32, pub down_speed: u32, pub auth: Option<String>, pub auth_str: Option<String>, pub sni: Option<String>, pub fingerprint: Option<String>, pub ca: Option<String>, pub ca_str: Option<String>, pub recv_window_conn: u32, pub recv_window: u32, pub disable_mtu_discovery: Option<bool>, pub hop_interval: u32, pub alpn: HashSet<String>, pub cwnd: u32,
}
Expand description

Represents a proxy configuration. Serialized for JavaScripts.

Fields§

§proxy_type: ProxyType§combined_proxy: Option<CombinedProxy>§id: u32§group_id: i32§group: String§remark: String§hostname: String§port: u16§username: Option<String>§password: Option<String>§encrypt_method: Option<String>§plugin: Option<String>§plugin_option: Option<String>

Plugin options in the format of key1=value1;key2=value2

§protocol: Option<String>§protocol_param: Option<String>§obfs: Option<String>§obfs_param: Option<String>§user_id: Option<String>§alter_id: u16§transfer_protocol: Option<String>§fake_type: Option<String>§tls_secure: bool§host: Option<String>§path: Option<String>§edge: Option<String>§quic_secure: Option<String>§quic_secret: Option<String>§udp: Option<bool>§tcp_fast_open: Option<bool>§allow_insecure: Option<bool>§tls13: Option<bool>§underlying_proxy: Option<String>§snell_version: u16§server_name: Option<String>§self_ip: Option<String>§self_ipv6: Option<String>§public_key: Option<String>§private_key: Option<String>§pre_shared_key: Option<String>§dns_servers: HashSet<String>§mtu: u16§allowed_ips: String§keep_alive: u16§test_url: Option<String>§client_id: Option<String>§ports: Option<String>§up_speed: u32

upload speed in Mbps

§down_speed: u32

download speed in Mbps

§auth: Option<String>§auth_str: Option<String>§sni: Option<String>§fingerprint: Option<String>§ca: Option<String>§ca_str: Option<String>§recv_window_conn: u32§recv_window: u32§disable_mtu_discovery: Option<bool>§hop_interval: u32§alpn: HashSet<String>§cwnd: u32

Implementations§

Source§

impl Proxy

Source

pub fn common_construct( proxy_type: ProxyType, group: &str, remark: &str, server: &str, port: u16, udp: Option<bool>, tfo: Option<bool>, scv: Option<bool>, tls13: Option<bool>, underlying_proxy: &str, ) -> Self

Source

pub fn vmess_construct( group: &str, remark: &str, add: &str, port: u16, typ: &str, id: &str, aid: u16, net: &str, cipher: &str, path: &str, host: &str, edge: &str, tls: &str, sni: &str, udp: Option<bool>, tfo: Option<bool>, scv: Option<bool>, tls13: Option<bool>, underlying_proxy: &str, ) -> Self

Source

pub fn ssr_construct( group: &str, remark: &str, server: &str, port: u16, protocol: &str, method: &str, obfs: &str, password: &str, obfs_param: &str, proto_param: &str, udp: Option<bool>, tfo: Option<bool>, scv: Option<bool>, underlying_proxy: &str, ) -> Self

Source

pub fn ss_construct( group: &str, remark: &str, server: &str, port: u16, password: &str, method: &str, plugin: &str, plugin_opts: &str, udp: Option<bool>, tfo: Option<bool>, scv: Option<bool>, tls13: Option<bool>, underlying_proxy: &str, ) -> Self

Source

pub fn socks_construct( group: &str, remark: &str, server: &str, port: u16, username: &str, password: &str, udp: Option<bool>, tfo: Option<bool>, scv: Option<bool>, underlying_proxy: &str, ) -> Self

Source

pub fn http_construct( group: &str, remark: &str, server: &str, port: u16, username: &str, password: &str, tls: bool, tfo: Option<bool>, scv: Option<bool>, tls13: Option<bool>, underlying_proxy: &str, ) -> Self

Source

pub fn trojan_construct( group: String, remark: String, hostname: String, port: u16, password: String, network: Option<String>, host: Option<String>, path: Option<String>, sni: Option<String>, tls_secure: bool, udp: Option<bool>, tfo: Option<bool>, allow_insecure: Option<bool>, tls13: Option<bool>, underlying_proxy: Option<String>, ) -> Self

Source

pub fn snell_construct( group: String, remark: String, hostname: String, port: u16, password: String, obfs: String, host: String, version: u16, udp: Option<bool>, tfo: Option<bool>, allow_insecure: Option<bool>, underlying_proxy: Option<String>, ) -> Self

Source

pub fn wireguard_construct( group: String, remark: String, hostname: String, port: u16, self_ip: String, self_ipv6: String, private_key: String, public_key: String, preshared_key: String, dns_servers: Vec<String>, mtu: Option<u16>, keep_alive: Option<u16>, test_url: String, client_id: String, udp: Option<bool>, underlying_proxy: Option<String>, ) -> Self

Source

pub fn hysteria2_construct( group: String, remark: String, hostname: String, port: u16, ports: Option<String>, up_speed: Option<u32>, down_speed: Option<u32>, password: String, obfs: Option<String>, obfs_param: Option<String>, sni: Option<String>, fingerprint: Option<String>, alpn: Vec<String>, ca: Option<String>, ca_str: Option<String>, cwnd: Option<u32>, tcp_fast_open: Option<bool>, allow_insecure: Option<bool>, underlying_proxy: Option<String>, ) -> Self

Source

pub fn hysteria_construct( group: String, remark: String, hostname: String, port: u16, ports: String, protocol: String, obfs_param: String, up_speed: Option<u32>, down_speed: Option<u32>, auth_str: String, obfs: String, sni: String, fingerprint: String, ca: String, ca_str: String, recv_window_conn: Option<u32>, recv_window: Option<u32>, disable_mtu_discovery: Option<bool>, hop_interval: Option<u32>, alpn: Vec<String>, tcp_fast_open: Option<bool>, allow_insecure: Option<bool>, underlying_proxy: Option<String>, ) -> Self

Source§

impl Proxy

Source

pub fn is_combined_proxy(&self) -> bool

Source

pub fn with_udp(self, udp: Option<bool>) -> Self

设置 UDP 支持,如果值已存在则不覆盖

Source

pub fn set_udp(self, udp: bool) -> Self

强制设置 UDP 支持,不论是否已存在值

Source

pub fn with_tfo(self, tfo: Option<bool>) -> Self

设置 TCP Fast Open,如果值已存在则不覆盖

Source

pub fn set_tfo(self, tfo: bool) -> Self

强制设置 TCP Fast Open,不论是否已存在值

Source

pub fn with_skip_cert_verify(self, scv: Option<bool>) -> Self

设置 Skip Cert Verify,如果值已存在则不覆盖

Source

pub fn set_skip_cert_verify(self, scv: bool) -> Self

强制设置 Skip Cert Verify,不论是否已存在值

Source

pub fn set_remark(self, remark: String) -> Self

设置代理备注

Source

pub fn apply_default_values( self, default_udp: Option<bool>, default_tfo: Option<bool>, default_scv: Option<bool>, ) -> Self

使用默认值应用 tribool 属性,如果属性值为 None 则设置为提供的默认值

Trait Implementations§

Source§

impl Clone for Proxy

Source§

fn clone(&self) -> Proxy

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Proxy

Source§

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

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

impl Default for Proxy

Implement Default for Proxy

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Proxy

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 From<Proxy> for ClashOutputAnyTLS

Source§

fn from(proxy: Proxy) -> Self

Converts to this type from the input type.
Source§

impl From<Proxy> for ClashProxyOutput

Implementation of From trait for ClashProxyOutput

Source§

fn from(proxy: Proxy) -> Self

Converts to this type from the input type.
Source§

impl From<Proxy> for HttpProxy

Source§

fn from(proxy: Proxy) -> Self

Converts to this type from the input type.
Source§

impl From<Proxy> for Hysteria2Proxy

Source§

fn from(proxy: Proxy) -> Self

Converts to this type from the input type.
Source§

impl From<Proxy> for HysteriaProxy

Source§

fn from(proxy: Proxy) -> Self

Converts to this type from the input type.
Source§

impl From<Proxy> for ShadowsocksProxy

Source§

fn from(proxy: Proxy) -> Self

Converts to this type from the input type.
Source§

impl From<Proxy> for ShadowsocksRProxy

Source§

fn from(proxy: Proxy) -> Self

Converts to this type from the input type.
Source§

impl From<Proxy> for SnellProxy

Source§

fn from(proxy: Proxy) -> Self

Converts to this type from the input type.
Source§

impl From<Proxy> for Socks5Proxy

Source§

fn from(proxy: Proxy) -> Self

Converts to this type from the input type.
Source§

impl From<Proxy> for TrojanProxy

Source§

fn from(proxy: Proxy) -> Self

Converts to this type from the input type.
Source§

impl From<Proxy> for VLessProxy

Source§

fn from(proxy: Proxy) -> Self

Converts to this type from the input type.
Source§

impl From<Proxy> for VmessProxy

Source§

fn from(proxy: Proxy) -> Self

Converts to this type from the input type.
Source§

impl From<Proxy> for WireGuardProxy

Source§

fn from(proxy: Proxy) -> Self

Converts to this type from the input type.
Source§

impl Serialize for Proxy

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 Proxy

§

impl RefUnwindSafe for Proxy

§

impl Send for Proxy

§

impl Sync for Proxy

§

impl Unpin for Proxy

§

impl UnwindSafe for Proxy

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

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

Source§

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

Source§

impl<T> MaybeSendSync for T