Struct clashctl_core::Clash [−][src]
pub struct Clash { /* fields omitted */ }Expand description
Clash API
Use struct Clash for interacting with Clash RESTful API.
For more information, check https://github.com/Dreamacro/clash/wiki/external-controller-API-reference###Proxies,
or maybe just read source code of clash
Implementations
Send a oneshot request to the specific endpoint with method, with body
Send a oneshot request to the specific endpoint with method, without body
pub fn longhaul_req<T: DeserializeOwned>(
&self,
endpoint: &str,
method: &str
) -> Result<LongHaul<T>>
pub fn longhaul_req<T: DeserializeOwned>(
&self,
endpoint: &str,
method: &str
) -> Result<LongHaul<T>>
Send a longhaul request to the specific endpoint with method, Underlying is an http stream with chunked-encoding.
Use LongHaul::next_item, LongHaul::next_raw or Iterator::next to retreive data
Examplel
let traffics = clash.longhaul_req::<Traffic>("traffic", "GET").expect("connect failed");
// LongHaul implements `Iterator` so you can use iterator combinators
for traffic in traffics.take(3) {
println!("{:#?}", traffic)
}Helper function for method GET
Helper function for method PUT
Get clash version
Get base configs
Reloading base configs.
force: will change ports etc.,path: the absolute path to config file
This will NOT affect external-controller & secret
Get proxies information
Get connections information
Close all connections
Close specific connection
Get real-time traffic data
Note: This is a longhaul request, which will last forever until interrupted or disconnected.
See longhaul_req for more information
Get real-time logs
Note: This is a longhaul request, which will last forever until interrupted or disconnected.
See longhaul_req for more information
Get specific proxy delay test information
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Clash
impl !UnwindSafe for Clash
Blanket Implementations
Mutably borrows from an owned value. Read more
