A modern, type-safe Rust client for the Proxy6 API. This library provides a complete wrapper for managing proxies, handling authentication, and performing all operations available through the Proxy6 API.
- π Type Safety - Strongly typed API with compile-time guarantees
- π Async/Await - Built on
reqwestfor high-performance async operations - π Comprehensive - Complete coverage of all Proxy6 API methods
- π‘οΈ Error Handling - Detailed error types with proper error categorization
- π§ͺ Well-Tested - Extensive test suite with mock server support
- π Documentation - Full API documentation with examples
Add to Cargo.toml or add to project:
cargo add proxy6use proxy6::{Client, Country, params::*};
use std::error::Error;
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
// Create a client with your API key
let client = Client::builder().api_key("your-api-key-here").build()?;
// Get available countries
let countries = client.get_country(GetCountry { version: None }).await?;
println!("Available countries: {:?}", countries.list);
// Get proxy count for a specific country
let count = client
.get_count(GetCount {
country: Country::new("us")?,
version: None,
})
.await?;
println!("Available proxies in US: {}", count.count);
// Get your proxy list
let proxies = client
.get_proxy(GetProxy {
state: None,
description: None,
page: None,
limit: None,
})
.await?;
println!("Your proxies: {:?}", proxies.list);
Ok(())
}get_proxy()- Retrieve your proxy listbuy()- Purchase new proxiesprolong()- Extend proxy validitydelete()- Delete proxiescheck()- Check proxy validity
get_price()- Get pricing informationget_count()- Get available proxy count by countryget_country()- Get available countries
set_type()- Change proxy protocol (HTTP/SOCKS)set_description()- Update proxy descriptionsip_auth()- Manage IP authentication
The library provides detailed error types:
match client.get_proxy(/* params */).await {
Ok(response) => println!("Success: {:?}", response),
Err(ApiError::DocumentedError { code, response }) => {
eprintln!("API error {}: {}", code, response);
}
Err(ApiError::TooManyRequests { response }) => {
eprintln!("Rate limited: {}", response);
}
Err(e) => eprintln!("Other error: {}", e),
}You can provide your own reqwest::Client instance:
let custom_client = reqwest::ClientBuilder::new()
.timeout(std::time::Duration::from_secs(30))
.proxy(reqwest::Proxy::all("user:pass@127.0.0.1:8123")?)
.build()?;
let client = proxy6::Client::builder()
.api_key("your-api-key")
.requester(custom_client)
.build()?;// Buy multiple proxies
let buy_response = client
.buy(Buy {
count: 5,
period: ProxyPeriod::new(30)?,
country: Country::new("us")?,
version: Some(ProxyVersion::Ipv4),
r#type: Some(ProxyType::Http),
description: Some(ProxyDescription::new("my-proxies")?),
auto_prolong: true,
})
.await?;
// Extend specific proxies
let prolong_response = client
.prolong(Prolong {
period: ProxyPeriod::new(30)?,
ids: vec![
ProxyId::new("proxy-id-1"),
ProxyId::new("proxy-id-2"),
],
})
.await?;The library includes comprehensive tests. Run them with:
cargo testFor tests with mock server:
cargo test --features mockFull API documentation is available at:
- Docs.rs - Online documentation
- Local docs:
cargo doc --open
Contributions are welcome! Please feel free to submit pull requests.
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a pull request
# Clone the repository
git clone https://github.com/Filipponik/proxy6-rs
cd proxy6-rs
# Run tests
cargo test
# Check code quality
cargo clippy
# Format code
cargo fmtThis project is licensed under the MIT License - see the LICENSE file for details.
- Proxy6 for providing the API
- The Rust community for excellent tooling and libraries
Need help? Open an issue on GitHub or check the comprehensive documentation! π―
Filipponik
- GitHub: @Filipponik
- Repository: proxy6-rs
Made with β€οΈ and π¦ Rust