withFailedRequest method

ProxyModel withFailedRequest()

Creates a new ProxyModel with an updated score after a failed request

Implementation

ProxyModel withFailedRequest() {
  final newScore = (score ?? ProxyScore.initial()).recordFailure();

  return ProxyModel(
    ip: ip,
    port: port,
    countryCode: countryCode,
    isHttps: isHttps,
    anonymityLevel: anonymityLevel,
    region: region,
    isp: isp,
    speed: speed,
    supportsWebsockets: supportsWebsockets,
    protocol: protocol,
    auth: auth,
    lastChecked: DateTime.now().millisecondsSinceEpoch,
    responseTime: responseTime,
    score: newScore,
  );
}