binlist_rs

Crates.iobinlist_rs
lib.rsbinlist_rs
version0.1.1
created_at2025-07-22 23:05:20.414052+00
updated_at2025-07-22 23:23:43.469701+00
descriptionRust wrapper for Binlist API
homepage
repositoryhttps://github.com/Junaid433/binlist_rs
max_upload_size
id1764191
size53,341
Junaid Rahman (Junaid433)

documentation

README

binlist_rs

License Crates.io Build

binlist_rs is a lightweight and async Rust wrapper for the Binlist API (https://binlist.net/). It allows you to perform BIN lookups with full support for proxies, custom error types, and structured JSON responses.

โœจ Features

  • ๐Ÿ” Query BINs for card metadata
  • ๐ŸŒ Optional proxy support (SOCKS & HTTPS)
  • ๐Ÿ”ง Strongly typed response models
  • ๐Ÿšซ Graceful handling of API rate limits
  • ๐Ÿงช Designed for use in CLI tools or backend services

๐Ÿ“ฆ Installation

Add this to your Cargo.toml:

[dependencies]
binlist_rs = "0.1.1"

Replace version with the latest from https://crates.io/crates/binlist\_rs

โšก๏ธ Usage

use binlist_rs::BinLookup;

#[tokio::main]
async fn main() {
    let bin = "531462";

    let mut lookup = BinLookup::new();
    let result = lookup.lookup(bin, None).await;

    if let Ok(info) = result {
        println!("Scheme: {}", info.scheme.unwrap_or("Unknown".into()));
        if let Some(country) = info.country {
            println!("Country: {}", country.name.unwrap_or("Unknown".into()));
        }
    } else {
        println!("Failed to look up BIN.");
    }
}

๐Ÿ“š API Reference

  • BinLookup::new(): Initializes the client.
  • lookup(bin: &str, proxy_url: Option<&str>): Performs the API request.
  • Returns a Result<CardInfo, LookupError>.

Available Fields in Response:

  • scheme, brand, type, prepaid
  • country: name, emoji, currency, coordinates
  • bank: name

๐Ÿ›  Error Handling

All errors implement std::error::Error:

  • LookupError::BINLookupError
  • LookupError::ReqwestError
  • LookupError::RateLimitExceeded

๐Ÿ” Proxy Support

Supports:

  • http://, https://
  • socks5://, socks5h://

Example:

let proxy = Some("socks5://127.0.0.1:9050");

๐Ÿ“„ License

MIT ยฉ 2025 Junaid Rahman (https://github.com/junaid433)

๐Ÿง  Acknowledgments

Powered by the awesome Binlist API (https://binlist.net).

Commit count: 0

cargo fmt