6 releases (stable)
1.1.8 | Apr 14, 2024 |
---|---|
1.1.7 | Mar 8, 2024 |
1.1.6 | Feb 29, 2024 |
0.1.5 | Feb 28, 2024 |
#47 in Caching
154 downloads per month
11KB
111 lines
FortifyNet Proxy: Secure and Efficient Rust Proxy Server
FortifyNet Proxy is a lightweight Rust proxy server designed to provide secure and efficient handling of HTTP requests with basic authentication and resource caching capabilities.
- github clone repo - -
git clone https://github.com/JeninSutradhar/fortifynet_proxy
- Project Crate: https://crates.io/crates/fortifynet_proxy
Features
- Proxy Authentication: Securely authenticate users before allowing access to resources.
- HTTP Request Handling: Efficiently handle HTTP requests and generate appropriate responses.
- Activity Logging: Log proxy server activities for monitoring and troubleshooting.
- Resource Caching: Cache frequently accessed resources to optimize performance.
- Graceful Shutdown: Gracefully shutdown the proxy server to ensure data integrity and user experience.
Installation
To use FortifyNet Proxy in your Rust project, add the following line to your Cargo.toml
file:
[dependencies]
fortifynet_proxy = "1.1.7"
Usage
Basic Usage
To use the FortifyNet Proxy Server, follow these simple steps:
- Define a ProxyConfig struct to specify the server configuration parameters.
- Start the proxy server using the start_proxy_server function with the provided configuration.
use fortifynet_proxy::{ProxyConfig, start_proxy_server};
fn main() {
// Define proxy server configuration
let config = ProxyConfig {
ip_address: "127.0.0.1".to_string(),
port: 8080,
authentication: true,
username: "admin".to_string(),
password: "password123".to_string(),
cache_enabled: true,
};
// Start the proxy server with the provided configuration
start_proxy_server(config);
}
Customization:
FortifyNet Proxy offers extensive configuration options:
- IP Address and Port: Specify the desired IP address and port for the server.
- Authentication: Enable user authentication with custom usernames and passwords.
- Resource Caching: Implement caching strategies to store frequently accessed resources and improve performance.
Advanced Usage
Customized Authentication
Configure custom authentication settings to enforce user access control.
use fortifynet_proxy::{ProxyConfig, start_proxy_server};
fn main() {
// Configure custom authentication
let config = ProxyConfig {
ip_address: "127.0.0.1".to_string(),
port: 8080,
authentication: true,
username: "admin".to_string(),
password: "password123".to_string(),
cache_enabled: true,
};
// Start the proxy server with custom authentication
start_proxy_server(config);
}
Resource Caching Strategies
Implement resource caching strategies to optimize network performance.
use fortifynet_proxy::{ProxyConfig, start_proxy_server};
fn main() {
// Configure resource caching
let config = ProxyConfig {
ip_address: "127.0.0.1".to_string(),
port: 8080,
authentication: false,
username: "".to_string(),
password: "".to_string(),
cache_enabled: true,
};
// Start the proxy server with resource caching enabled
start_proxy_server(config);
}
Graceful Shutdown Handling
Gracefully shutdown the proxy server to ensure ongoing connections are completed.
use fortifynet_proxy::{ProxyConfig, start_proxy_server};
fn main() {
// Configure proxy server
let config = ProxyConfig {
ip_address: "127.0.0.1".to_string(),
port: 8080,
authentication: false,
username: "".to_string(),
password: "".to_string(),
cache_enabled: true,
};
// Start the proxy server
let server_thread = start_proxy_server(config);
// Gracefully shutdown the server after a specified time
std::thread::sleep(std::time::Duration::from_secs(10));
server_thread.join().expect("Failed to join server thread");
}
Further Resources:
Project Crate: https://crates.io/crates/fortifynet_proxy Github: https://github.com/JeninSutradhar/fortifynet_proxy Github official: https://github.com/JeninSutradhar/
Dependencies
~1.5MB
~60K SLoC