fortifynet_proxy 0.1.0

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.
Documentation
fortifynet_proxy-0.1.0 has been yanked.

FortifyNet Proxy

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.

Features

  • Basic HTTP request handling with customizable responses.
  • Simple authentication mechanism for user verification.
  • Resource caching to optimize performance and reduce bandwidth usage.
  • Graceful shutdown mechanism for safe server termination.

Installation

To use FortifyNet Proxy in your Rust project, add the following line to your Cargo.toml file:

[dependencies]
fortifynet_proxy = "0.1.0"

Usages

Custom Pot Configuration

use fortifynet_proxy::start_proxy_server;
use std::net::Ipv4Addr;

fn main() {
    // Start the proxy server on custom IP address and port
    let ip_address = Ipv4Addr::new(127, 0, 0, 1);
    let port = 9090;
    start_proxy_server(ip_address, port);
}

Advanced Configuration with Authentication

use fortifynet_proxy::{start_proxy_server, ProxyConfig};

fn main() {
    // Start the proxy server with advanced 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_proxy_server(config);
}

Customized Resource Cache

use fortifynet_proxy::{start_proxy_server, ProxyConfig};

fn main() {
    // Start the proxy server with customized resource caching
    let config = ProxyConfig {
        ip_address: "127.0.0.1".to_string(),
        port: 8080,
        authentication: false,
        cache_enabled: true,
    };
    start_proxy_server(config);

    // Later, you can manually cache resources using the provided API
    // cache_resource("example.com/image.jpg");
}

Graceful Shutdown Handling

use fortifynet_proxy::{start_proxy_server, ProxyConfig};

fn main() {
    // Start the proxy server and gracefully handle shutdown
    let config = ProxyConfig {
        ip_address: "127.0.0.1".to_string(),
        port: 8080,
        authentication: false,
        cache_enabled: true,
    };
    let server_thread = start_proxy_server(config);

    // Gracefully shutdown the server after 10 seconds
    std::thread::sleep(std::time::Duration::from_secs(10));
    server_thread.join().expect("Failed to join server thread");
}
  • These examples showcase different ways users can configure and use the FortifyNet Proxy API in their Rust applications. Users can customize settings such as IP address, port, authentication, caching, and gracefully handle server shutdown based on their requirements.