pub struct ServerApi<'client> { /* private fields */ }Expand description
Server status, Xray lifecycle, maintenance, and utility endpoints.
Implementations§
Source§impl<'client> ServerApi<'client>
impl<'client> ServerApi<'client>
Sourcepub async fn status(self) -> Result<ServerStatus>
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.
Sourcepub async fn legacy_cpu_history(
self,
bucket: HistoryBucket,
) -> Result<Vec<LegacyCpuPoint>>
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.
Sourcepub async fn system_history(
self,
metric: SystemMetric,
bucket: HistoryBucket,
) -> Result<Vec<MetricPoint>>
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.
Sourcepub async fn xray_metrics_state(self) -> Result<XrayMetricsState>
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.
Sourcepub async fn xray_metrics_history(
self,
metric: XrayMetric,
bucket: HistoryBucket,
) -> Result<Vec<MetricPoint>>
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.
Sourcepub async fn xray_observatory(self) -> Result<Vec<XrayObservatoryEntry>>
pub async fn xray_observatory(self) -> Result<Vec<XrayObservatoryEntry>>
Returns the latest Xray observatory snapshot.
§Errors
Returns an error when retrieval or decoding fails.
Sourcepub async fn xray_observatory_history(
self,
tag: &str,
bucket: HistoryBucket,
) -> Result<Vec<MetricPoint>>
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.
Sourcepub async fn xray_versions(self) -> Result<Vec<String>>
pub async fn xray_versions(self) -> Result<Vec<String>>
Lists Xray versions available for installation.
§Errors
Returns an error when lookup or decoding fails.
Sourcepub async fn panel_update_info(self) -> Result<PanelUpdateInfo>
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.
Sourcepub async fn panel_update_status(self) -> Result<PanelUpdateStatus>
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.
Sourcepub async fn xray_config(self) -> Result<XrayConfig>
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.
Sourcepub async fn download_database(self) -> Result<DatabaseFile>
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.
Sourcepub async fn download_migration(self) -> Result<DatabaseFile>
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.
Sourcepub async fn import_database(
self,
filename: &str,
database_bytes: &[u8],
) -> Result<()>
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.
Sourcepub async fn generate_uuid(self) -> Result<String>
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.
Sourcepub async fn web_certificate_files(self) -> Result<WebCertificateFiles>
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.
Sourcepub async fn descendants(self) -> Result<Vec<NodeSummary>>
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.
Sourcepub async fn generate_x25519(self) -> Result<X25519KeyPair>
pub async fn generate_x25519(self) -> Result<X25519KeyPair>
Generates an X25519 keypair for REALITY.
§Errors
Returns an error when generation or decoding fails.
Sourcepub async fn generate_mldsa65(self) -> Result<Mldsa65KeyPair>
pub async fn generate_mldsa65(self) -> Result<Mldsa65KeyPair>
Sourcepub async fn generate_mlkem768(self) -> Result<Mlkem768KeyPair>
pub async fn generate_mlkem768(self) -> Result<Mlkem768KeyPair>
Sourcepub async fn generate_vless_encryption(self) -> Result<VlessEncryptionOptions>
pub async fn generate_vless_encryption(self) -> Result<VlessEncryptionOptions>
Generates VLESS encryption/decryption choices.
§Errors
Returns an error when generation or decoding fails.
Sourcepub async fn generate_ech(self, sni: &str) -> Result<EchKeyPair>
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.
Sourcepub async fn certificate_file_hashes(
self,
certificate_file: &str,
) -> Result<Vec<String>>
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.
Sourcepub async fn certificate_content_hashes(
self,
certificate_content: &str,
) -> Result<Vec<String>>
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.
Sourcepub async fn remote_certificate_hashes(
self,
server: &str,
) -> Result<Vec<String>>
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.
Sourcepub async fn scan_reality_target(
self,
request: &RealityScanRequest,
) -> Result<RealityScanResult>
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.
Sourcepub async fn scan_reality_targets(
self,
targets: &[impl AsRef<str>],
) -> Result<Vec<RealityScanResult>>
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.
Sourcepub async fn scan_default_reality_targets(
self,
) -> Result<Vec<RealityScanResult>>
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.
Sourcepub async fn client_ips(self) -> Result<Vec<ClientIpRecord>>
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.
Sourcepub async fn merge_client_ips(self, records: &[ClientIpRecord]) -> Result<()>
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.
Sourcepub async fn fail2ban_status(self) -> Result<Fail2banStatus>
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.
Sourcepub async fn restart_xray(self) -> Result<()>
pub async fn restart_xray(self) -> Result<()>
Restarts Xray with the current configuration.
§Errors
Returns an error when validation or restart fails.
Sourcepub async fn install_xray(self, version: &str) -> Result<()>
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.
Sourcepub async fn update_panel(
self,
dev_override: Option<bool>,
) -> Result<PanelUpdateRun>
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.
Sourcepub async fn set_update_channel(self, dev: bool) -> Result<()>
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.
Sourcepub async fn update_geofiles(self) -> Result<()>
pub async fn update_geofiles(self) -> Result<()>
Refreshes the panel’s default GeoIP and GeoSite files.
§Errors
Returns an error when the update fails.
Sourcepub async fn update_geofile(self, filename: &str) -> Result<()>
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.
Sourcepub async fn panel_logs(self, request: &PanelLogRequest) -> Result<Vec<String>>
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.
Sourcepub async fn xray_logs(
self,
request: &XrayLogRequest,
) -> Result<Vec<XrayLogEntry>>
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.
Sourcepub async fn amneziawg_logs(
self,
count: u32,
filter: &str,
) -> Result<AmneziaWgLogs>
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§
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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