Skip to main content

ResponseClassifier

Trait ResponseClassifier 

Source
pub trait ResponseClassifier:
    Send
    + Sync
    + 'static {
    // Required method
    fn classify(&self, response: &Response) -> ProxyResponseVerdict;
}
Expand description

Classify responses to determine proxy health at the business level.

Implement this trait to detect anti-bot responses (captchas, blocks, etc.) that pass HTTP-level health checks but indicate the proxy is unusable for your target site.

§Example

use reqwest_proxy_pool::{ResponseClassifier, ProxyResponseVerdict};

struct CaptchaDetector;

impl ResponseClassifier for CaptchaDetector {
    fn classify(&self, response: &reqwest::Response) -> ProxyResponseVerdict {
        // Check status or headers for signs of blocking
        if response.status() == 403 {
            ProxyResponseVerdict::ProxyBlocked
        } else {
            ProxyResponseVerdict::Success
        }
    }
}

Required Methods§

Implementors§