Expand description
Shared module for code reuse between bssh client and server.
This module contains utilities and types that are used by both the bssh SSH client and the bssh-server implementations. By centralizing this shared code, we ensure:
- Consistent behavior between client and server
- No code duplication
- Easier maintenance
§Modules
validation: Input validation utilities for usernames, hostnames, pathsrate_limit: Generic token bucket rate limiterauth_types: Common authentication types and resultserror: Shared error types
§Usage
The shared module is designed to be used transparently by other modules.
For backward compatibility, the existing modules (security, jump)
re-export these shared utilities, so existing code continues to work.
§Direct Usage
use bssh::shared::validation::validate_hostname;
use bssh::shared::rate_limit::RateLimiter;
use bssh::shared::auth_types::{AuthResult, UserInfo};
// Validate a hostname
let hostname = validate_hostname("example.com").unwrap();
// Use the generic rate limiter
let limiter: RateLimiter<String> = RateLimiter::new();§Via Re-exports (Backward Compatible)
// These continue to work as before
use bssh::security::validate_hostname;
use bssh::jump::rate_limiter::ConnectionRateLimiter;Re-exports§
pub use auth_types::AuthResult;pub use auth_types::ServerCheckMethod;pub use auth_types::UserInfo;pub use error::AuthError;pub use error::ConnectionError;pub use error::RateLimitError;pub use error::ValidationError;pub use rate_limit::ConnectionRateLimiter;pub use rate_limit::RateLimitConfig;pub use rate_limit::RateLimiter;pub use validation::sanitize_error_message;pub use validation::validate_hostname;pub use validation::validate_local_path;pub use validation::validate_remote_path;pub use validation::validate_username;
Modules§
- auth_
types - Shared authentication types for client and server implementations.
- error
- Shared error types for client and server implementations.
- rate_
limit - Generic rate limiting using the token bucket algorithm.
- validation
- Shared validation utilities for validating and sanitizing user input.