pub struct ServerBuilder { /* private fields */ }Expand description
Builder for creating an SSH server.
Implementations§
Source§impl ServerBuilder
impl ServerBuilder
Sets a static banner.
Sets a dynamic banner handler.
Sourcepub fn host_key_path(self, path: impl Into<String>) -> Self
pub fn host_key_path(self, path: impl Into<String>) -> Self
Sets the host key path.
Sourcepub fn host_key_pem(self, pem: Vec<u8>) -> Self
pub fn host_key_pem(self, pem: Vec<u8>) -> Self
Sets the host key from PEM data.
Sourcepub fn with_middleware(self, mw: Middleware) -> Self
pub fn with_middleware(self, mw: Middleware) -> Self
Adds middleware to the server.
Sourcepub fn handler_arc(self, handler: Handler) -> Self
pub fn handler_arc(self, handler: Handler) -> Self
Sourcepub fn auth_handler<H: AuthHandler + 'static>(self, handler: H) -> Self
pub fn auth_handler<H: AuthHandler + 'static>(self, handler: H) -> Self
Sets the trait-based authentication handler.
If set, this takes precedence over the callback-based handlers.
Sourcepub fn max_auth_attempts(self, max: u32) -> Self
pub fn max_auth_attempts(self, max: u32) -> Self
Sets the maximum authentication attempts.
Sourcepub fn auth_rejection_delay(self, delay_ms: u64) -> Self
pub fn auth_rejection_delay(self, delay_ms: u64) -> Self
Sets the authentication rejection delay in milliseconds.
Sourcepub fn allow_no_auth(self) -> Self
pub fn allow_no_auth(self) -> Self
Allow unauthenticated access when no auth handlers are configured.
By default, auth_none is rejected unless at least one auth handler
is registered. Call this to explicitly opt in to anonymous access
(e.g., for demo/development servers).
Sourcepub fn public_key_auth<F>(self, handler: F) -> Self
pub fn public_key_auth<F>(self, handler: F) -> Self
Sets the public key authentication handler.
Sourcepub fn password_auth<F>(self, handler: F) -> Self
pub fn password_auth<F>(self, handler: F) -> Self
Sets the password authentication handler.
Sourcepub fn keyboard_interactive_auth<F>(self, handler: F) -> Self
pub fn keyboard_interactive_auth<F>(self, handler: F) -> Self
Sets the keyboard-interactive authentication handler.
Sourcepub fn idle_timeout(self, duration: Duration) -> Self
pub fn idle_timeout(self, duration: Duration) -> Self
Sets the idle timeout.
Sourcepub fn max_timeout(self, duration: Duration) -> Self
pub fn max_timeout(self, duration: Duration) -> Self
Sets the maximum connection timeout.