30 lines
1.4 KiB
C#
30 lines
1.4 KiB
C#
namespace BlueLaminate.Scraper.Proxies;
|
|
|
|
/// <summary>
|
|
/// A concrete, ready-to-use proxy endpoint handed back by an
|
|
/// <see cref="IProxyProvider"/>. This is the only proxy type a consumer ever
|
|
/// sees, so swapping providers (or mixing several in a grab-bag) never touches
|
|
/// the calling code. <see cref="Username"/> and <see cref="Password"/> are the
|
|
/// literal credentials to present to the gateway — for providers like IPRoyal
|
|
/// the targeting/session parameters are already baked into them.
|
|
/// </summary>
|
|
/// <param name="Host">Gateway host, e.g. "geo.iproyal.com".</param>
|
|
/// <param name="Port">Gateway port, e.g. 12321.</param>
|
|
/// <param name="Username">Credential username for the gateway.</param>
|
|
/// <param name="Password">Credential password (may carry encoded session/geo params).</param>
|
|
/// <param name="Provider">Name of the provider that issued this lease.</param>
|
|
/// <param name="SessionId">The sticky session key, if this is a pinned IP.</param>
|
|
/// <param name="ExpiresAt">When a sticky IP may be recycled; null if rotating/unbounded.</param>
|
|
public sealed record ProxyLease(
|
|
string Host,
|
|
int Port,
|
|
string Username,
|
|
string Password,
|
|
string Provider,
|
|
string? SessionId = null,
|
|
DateTimeOffset? ExpiresAt = null)
|
|
{
|
|
/// <summary>"host:port" form used by browser proxy settings.</summary>
|
|
public string Endpoint => $"{Host}:{Port}";
|
|
}
|