Skip to main content

ServerApi

Struct ServerApi 

Source
pub struct ServerApi<'client> { /* private fields */ }
Expand description

Server status, Xray lifecycle, maintenance, and utility endpoints.

Implementations§

Source§

impl<'client> ServerApi<'client>

Source

pub async fn status(self) -> Result<ServerStatus>

Returns the latest cached machine and Xray status snapshot.

§Errors

Returns an error when the request or response contract fails.

Source

pub async fn legacy_cpu_history( self, bucket: HistoryBucket, ) -> Result<Vec<LegacyCpuPoint>>

Returns CPU history through the legacy {t, cpu} endpoint.

Prefer Self::system_history for the uniform {t, v} shape.

§Errors

Returns an error when retrieval or decoding fails.

Source

pub async fn system_history( self, metric: SystemMetric, bucket: HistoryBucket, ) -> Result<Vec<MetricPoint>>

Returns aggregated history for one host metric.

§Errors

Returns an error when retrieval or decoding fails.

Source

pub async fn xray_metrics_state(self) -> Result<XrayMetricsState>

Returns Xray metrics discovery and collection state.

§Errors

Returns an error when retrieval or decoding fails.

Source

pub async fn xray_metrics_history( self, metric: XrayMetric, bucket: HistoryBucket, ) -> Result<Vec<MetricPoint>>

Returns aggregated history for one Xray runtime metric.

§Errors

Returns an error when retrieval or decoding fails.

Source

pub async fn xray_observatory(self) -> Result<Vec<XrayObservatoryEntry>>

Returns the latest Xray observatory snapshot.

§Errors

Returns an error when retrieval or decoding fails.

Source

pub async fn xray_observatory_history( self, tag: &str, bucket: HistoryBucket, ) -> Result<Vec<MetricPoint>>

Returns observatory delay history for one outbound tag.

The tag is encoded as exactly one URL path segment.

§Errors

Returns an error when retrieval or decoding fails.

Source

pub async fn xray_versions(self) -> Result<Vec<String>>

Lists Xray versions available for installation.

§Errors

Returns an error when lookup or decoding fails.

Source

pub async fn panel_update_info(self) -> Result<PanelUpdateInfo>

Returns current and latest panel release information.

§Errors

Returns an error when lookup or decoding fails.

Source

pub async fn panel_update_status(self) -> Result<PanelUpdateStatus>

Returns the latest panel self-update status.

§Errors

Returns an error when retrieval or decoding fails.

Source

pub async fn xray_config(self) -> Result<XrayConfig>

Returns the complete assembled Xray configuration currently in use.

Xray configuration is intentionally represented as open-ended JSON because its schema depends on the installed xray-core version and enabled protocols.

§Errors

Returns an error when retrieval or decoding fails.

Source

pub async fn download_database(self) -> Result<DatabaseFile>

Downloads a database backup without writing it to disk.

§Errors

Returns an error when the download fails.

Source

pub async fn download_migration(self) -> Result<DatabaseFile>

Downloads the cross-engine migration artifact without writing it to disk.

§Errors

Returns an error when the download fails.

Source

pub async fn import_database( self, filename: &str, database_bytes: &[u8], ) -> Result<()>

Restores a database upload and lets the panel restart Xray.

This is destructive. The SDK sends a genuine multipart part named db and never reads from or writes to the local filesystem itself.

§Errors

Returns an error when upload, validation, import, or restart fails.

Source

pub async fn generate_uuid(self) -> Result<String>

Generates a UUID v4 using the panel helper.

§Errors

Returns an error when generation or decoding fails.

Source

pub async fn web_certificate_files(self) -> Result<WebCertificateFiles>

Returns the panel web certificate and private-key paths.

§Errors

Returns an error when retrieval or decoding fails.

Source

pub async fn descendants(self) -> Result<Vec<NodeSummary>>

Returns read-only summaries of nodes directly managed by this panel.

§Errors

Returns an error when retrieval or decoding fails.

Source

pub async fn generate_x25519(self) -> Result<X25519KeyPair>

Generates an X25519 keypair for REALITY.

§Errors

Returns an error when generation or decoding fails.

Source

pub async fn generate_mldsa65(self) -> Result<Mldsa65KeyPair>

Generates ML-DSA-65 signing material.

§Errors

Returns an error when generation or decoding fails.

Source

pub async fn generate_mlkem768(self) -> Result<Mlkem768KeyPair>

Generates ML-KEM-768 key material.

§Errors

Returns an error when generation or decoding fails.

Source

pub async fn generate_vless_encryption(self) -> Result<VlessEncryptionOptions>

Generates VLESS encryption/decryption choices.

§Errors

Returns an error when generation or decoding fails.

Source

pub async fn generate_ech(self, sni: &str) -> Result<EchKeyPair>

Generates ECH server keys and a public ECH config list for an SNI.

§Errors

Returns an error when generation or decoding fails.

Source

pub async fn certificate_file_hashes( self, certificate_file: &str, ) -> Result<Vec<String>>

Computes SHA-256 hashes for a certificate referenced by panel file path.

The server accepts only certificate files already referenced by its own configuration.

§Errors

Returns an error when validation, hashing, or decoding fails.

Source

pub async fn certificate_content_hashes( self, certificate_content: &str, ) -> Result<Vec<String>>

Computes SHA-256 hashes for inline PEM or DER certificate content.

§Errors

Returns an error when parsing, hashing, or decoding fails.

Source

pub async fn remote_certificate_hashes( self, server: &str, ) -> Result<Vec<String>>

Fetches the live leaf certificate hash from a remote TLS server.

§Errors

Returns an error when probing, hashing, or decoding fails.

Source

pub async fn scan_reality_target( self, request: &RealityScanRequest, ) -> Result<RealityScanResult>

Probes one REALITY target and returns its feasibility verdict.

§Errors

Returns an error when the live probe or decoding fails.

Source

pub async fn scan_reality_targets( self, targets: &[impl AsRef<str>], ) -> Result<Vec<RealityScanResult>>

Probes comma-separated REALITY targets, or the panel seed list when empty.

§Errors

Returns an error when live probes or decoding fail.

Source

pub async fn scan_default_reality_targets( self, ) -> Result<Vec<RealityScanResult>>

Probes the panel’s built-in REALITY target seed list.

This is the unambiguous convenience form of Self::scan_reality_targets for the upstream empty-list behavior.

§Errors

Returns an error when live probes or decoding fail.

Source

pub async fn client_ips(self) -> Result<Vec<ClientIpRecord>>

Returns the cluster-wide recently observed client IP table.

§Errors

Returns an error when retrieval or decoding fails.

Source

pub async fn merge_client_ips(self, records: &[ClientIpRecord]) -> Result<()>

Merges client IP observations into the panel’s cluster-wide table.

§Errors

Returns an error when validation or merge fails.

Source

pub async fn fail2ban_status(self) -> Result<Fail2banStatus>

Reports whether Fail2ban-backed per-client IP limits are usable.

§Errors

Returns an error when retrieval or decoding fails.

Source

pub async fn stop_xray(self) -> Result<()>

Stops Xray immediately.

§Errors

Returns an error when the panel cannot stop Xray.

Source

pub async fn restart_xray(self) -> Result<()>

Restarts Xray with the current configuration.

§Errors

Returns an error when validation or restart fails.

Source

pub async fn install_xray(self, version: &str) -> Result<()>

Downloads and installs an Xray release tag, or latest.

The version is encoded as exactly one URL path segment.

§Errors

Returns an error when download or installation fails.

Source

pub async fn update_panel( self, dev_override: Option<bool>, ) -> Result<PanelUpdateRun>

Starts a panel self-update and returns its run identifier.

dev_override selects the channel for this run when present; None uses the panel’s configured update channel.

§Errors

Returns an error when the updater cannot be started or decoded.

Source

pub async fn set_update_channel(self, dev: bool) -> Result<()>

Selects stable (false) or rolling dev (true) for future panel updates.

§Errors

Returns an error when the setting cannot be changed.

Source

pub async fn update_geofiles(self) -> Result<()>

Refreshes the panel’s default GeoIP and GeoSite files.

§Errors

Returns an error when the update fails.

Source

pub async fn update_geofile(self, filename: &str) -> Result<()>

Refreshes one named Xray geo file.

The filename is encoded as one path segment; the server additionally enforces its v3.8.5 safe-filename allowlist.

§Errors

Returns an error when validation or update fails.

Source

pub async fn panel_logs(self, request: &PanelLogRequest) -> Result<Vec<String>>

Returns filtered trailing lines from the panel log.

§Errors

Returns an error when retrieval or decoding fails.

Source

pub async fn xray_logs( self, request: &XrayLogRequest, ) -> Result<Vec<XrayLogEntry>>

Returns filtered trailing lines from the Xray process log.

§Errors

Returns an error when retrieval or decoding fails.

Source

pub async fn amneziawg_logs( self, count: u32, filter: &str, ) -> Result<AmneziaWgLogs>

Returns live AmneziaWG peer activity and recent lifecycle log lines.

The server caps invalid or out-of-range counts to 100 and applies the case-insensitive filter to both peer metadata and event text.

§Errors

Returns an error when retrieval or response decoding fails.

Trait Implementations§

Source§

impl<'client> Clone for ServerApi<'client>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<'client> Copy for ServerApi<'client>

Source§

impl<'client> Debug for ServerApi<'client>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'client> !RefUnwindSafe for ServerApi<'client>

§

impl<'client> !UnwindSafe for ServerApi<'client>

§

impl<'client> Freeze for ServerApi<'client>

§

impl<'client> Send for ServerApi<'client>

§

impl<'client> Sync for ServerApi<'client>

§

impl<'client> Unpin for ServerApi<'client>

§

impl<'client> UnsafeUnpin for ServerApi<'client>

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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 = !

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

fn try_from(value: U) -> Result<T, !>

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