Skip to main content

WinrmConfig

Struct WinrmConfig 

Source
pub struct WinrmConfig {
Show 18 fields pub port: u16, pub use_tls: bool, pub accept_invalid_certs: bool, pub connect_timeout_secs: u64, pub operation_timeout_secs: u64, pub auth_method: AuthMethod, pub max_envelope_size: u32, pub max_retries: u32, pub client_cert_pem: Option<String>, pub client_key_pem: Option<String>, pub proxy: Option<String>, pub codepage: u32, pub working_directory: Option<String>, pub env_vars: Vec<(String, String)>, pub encryption: EncryptionMode, pub user_agent: Option<String>, pub idle_timeout_secs: Option<u64>, pub max_output_bytes: Option<usize>,
}
Expand description

Configuration for a WinrmClient connection.

Controls the transport (HTTP vs HTTPS), timeouts, and authentication method. Use Default::default() for sensible defaults (HTTP on port 5985, NTLM auth, 30 s connect / 60 s operation timeouts).

Fields§

§port: u16

TCP port of the WinRM listener (default: 5985 for HTTP, 5986 for HTTPS).

§use_tls: bool

Whether to connect over HTTPS. When true, the endpoint URL uses https://.

§accept_invalid_certs: bool

Accept invalid or self-signed TLS certificates.

§Security

Setting this to true disables chain verification on both the regular HTTPS transport and the CredSSP outer TLS leg, leaving the connection vulnerable to MITM. Credentials transmitted over Basic, NTLM, or CredSSP can then be intercepted.

Use only in test environments. The constructor logs a tracing::warn when this flag is enabled.

§connect_timeout_secs: u64

TCP connect timeout in seconds (default: 30).

§operation_timeout_secs: u64

WS-Management OperationTimeout in seconds (default: 60). The HTTP client timeout is set to this value plus 10 seconds to allow the server to respond before the transport gives up.

§auth_method: AuthMethod

Authentication method to use for all requests (default: AuthMethod::Ntlm).

§max_envelope_size: u32

Maximum SOAP envelope size in bytes (default: 153600).

Controls the MaxEnvelopeSize header sent in every WS-Management request. Increase this for hosts that return large responses.

§max_retries: u32

Maximum number of retries for transient HTTP errors (default: 0 = no retry).

Uses exponential backoff starting at 100 ms (100, 200, 400, …). Only WinrmError::Http errors trigger a retry; authentication and SOAP faults are returned immediately.

§client_cert_pem: Option<String>

Path to client certificate PEM file (for AuthMethod::Certificate).

§client_key_pem: Option<String>

Path to client private key PEM file (for AuthMethod::Certificate).

§proxy: Option<String>

HTTP proxy URL (e.g. "http://proxy:8080").

When set, all WinRM HTTP(S) requests are routed through this proxy.

§codepage: u32

Console output code page (default: 65001 = UTF-8).

Controls the WINRS_CODEPAGE option in the shell creation envelope. Common values: 65001 (UTF-8), 437 (US), 850 (Western European).

§working_directory: Option<String>

Initial working directory for the remote shell (default: None).

When set, the shell starts in this directory. Equivalent to running cd <path> before any command.

§env_vars: Vec<(String, String)>

Environment variables to set in the remote shell (default: empty).

Each (key, value) pair is injected into the shell’s environment at creation time via <rsp:Environment>.

§encryption: EncryptionMode

Message encryption mode for NTLM (default: EncryptionMode::Auto).

Controls whether NTLM sealing is applied to SOAP message bodies.

§user_agent: Option<String>

Custom HTTP User-Agent header (default: None = winrm-rs/<version>).

§idle_timeout_secs: Option<u64>

Shell idle timeout in seconds (default: None = server default).

When set, the shell will be automatically closed by the server after this many seconds of inactivity.

§max_output_bytes: Option<usize>

Maximum cumulative bytes accepted from the server for a single command’s stdout+stderr (default: Some(64 * 1024 * 1024) = 64 MiB).

Prevents a malicious or runaway server from exhausting client memory by streaming an unbounded base64 chunk sequence. When the cap is reached, the operation returns crate::error::WinrmError::Transfer and the shell is best-effort closed. Set to None to disable the cap (pre-1.1 behaviour).

Trait Implementations§

Source§

impl Clone for WinrmConfig

Source§

fn clone(&self) -> WinrmConfig

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 Debug for WinrmConfig

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for WinrmConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: 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: 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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