Skip to content

itzlambda/alloy-multiproxy-provider

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Alloy Multi-Proxy Provider

A Rust library that provides automatic proxy rotation for Alloy providers. Distributes requests across multiple proxies in a round-robin fashion to avoid rate limits.

Installation

Add this to your Cargo.toml:

[dependencies]
alloy-multiproxy-provider = "0.1.0"

Usage

use alloy_multiproxy_provider::MultiProxyProvider;
use alloy::providers::Provider;
use reqwest::Url;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let proxies = vec![
        "http://proxy1.example.com:8080".to_string(),
        "http://username:password@proxy2.example.com:8080".to_string(),
        "http://proxy3.example.com:8080".to_string(),
    ];
    
    let rpc_url = Url::parse("https://eth-mainnet.alchemyapi.io/v2/your-api-key")?;
    
    let provider = MultiProxyProvider::new(proxies, rpc_url).await?;
    
    // Use like any other Alloy provider
    let block_number = provider.get_block_number().await?;
    println!("Latest block: {}", block_number);
    
    Ok(())
}

License

MIT

About

Custom Alloy provider which uses proxies for sending request

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages