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

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 DELETE

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 rules information

Get specific proxy 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

Select specific proxy

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.