pub struct NodeRequest {Show 14 fields
pub id: i64,
pub name: String,
pub remark: String,
pub scheme: NodeScheme,
pub address: String,
pub port: u16,
pub base_path: String,
pub enable: bool,
pub allow_private_address: bool,
pub tls_verify_mode: NodeTlsVerifyMode,
pub pinned_cert_sha256: String,
pub inbound_sync_mode: NodeInboundSyncMode,
pub inbound_tags: Vec<String>,
pub outbound_tag: String,
/* private fields */
}Expand description
Complete writable node connection and synchronization configuration.
API tokens are write-only and redacted from Debug. The request encodes
the controller’s three update states without allowing contradictory
apiToken and clearApiToken fields.
Fields§
§id: i64Existing node ID used when probing an edit form, or zero for a new node.
name: StringUnique configured name.
remark: StringOperator-visible description.
scheme: NodeSchemeRemote panel URL scheme.
address: StringHostname or IP address without a port.
port: u16Remote panel port.
base_path: StringRemote panel base path.
enable: boolWhether node synchronization is enabled.
allow_private_address: boolWhether guarded node connections may resolve to private addresses.
tls_verify_mode: NodeTlsVerifyModeNode TLS verification/authentication mode.
pinned_cert_sha256: StringBase64 SHA-256 leaf-certificate pin.
inbound_sync_mode: NodeInboundSyncModeRemote inbound import mode.
Remote inbound tags selected for import.
outbound_tag: StringLocal Xray outbound used to reach the node.
Implementations§
Source§impl NodeRequest
impl NodeRequest
Sourcepub fn new(
name: impl Into<String>,
address: impl Into<String>,
port: u16,
) -> Self
pub fn new( name: impl Into<String>, address: impl Into<String>, port: u16, ) -> Self
Creates an enabled HTTPS node using normal certificate verification.
Sourcepub fn with_api_token(self, token: impl Into<String>) -> Self
pub fn with_api_token(self, token: impl Into<String>) -> Self
Configures a replacement API token and returns the request.
Sourcepub fn set_api_token(&mut self, token: impl Into<String>)
pub fn set_api_token(&mut self, token: impl Into<String>)
Configures a replacement API token.
Sourcepub fn clear_stored_api_token(&mut self)
pub fn clear_stored_api_token(&mut self)
Explicitly clears the stored token on update.
3x-ui only permits an enabled tokenless node when mTLS is active.
Sourcepub fn retain_stored_api_token(&mut self)
pub fn retain_stored_api_token(&mut self)
Omits both credential fields so an update retains the stored token.
Sourcepub fn api_token(&self) -> Option<&str>
pub fn api_token(&self) -> Option<&str>
Exposes the replacement token when explicitly needed by the caller.
Sourcepub const fn clears_stored_api_token(&self) -> bool
pub const fn clears_stored_api_token(&self) -> bool
Returns whether this update explicitly clears the stored token.
Trait Implementations§
Source§impl Clone for NodeRequest
impl Clone for NodeRequest
Source§impl Debug for NodeRequest
impl Debug for NodeRequest
Auto Trait Implementations§
impl Freeze for NodeRequest
impl RefUnwindSafe for NodeRequest
impl Send for NodeRequest
impl Sync for NodeRequest
impl Unpin for NodeRequest
impl UnsafeUnpin for NodeRequest
impl UnwindSafe for NodeRequest
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