Interface ProxyProvider
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
The library asks per request, so any rotation policy a host likes — round-robin, per-account pinning, health-checked pools — is implemented behind this method. Acquiring proxies, and knowing whether one is alive, stays the host's business.
Resolution fails closed. Once a provider is installed, returning null or
throwing makes the request fail rather than fall back to a direct connection. The intuitive fallback
is the wrong one here: the reason to proxy an alt manager is that its accounts must not all look like
one machine, so a silent fallback discloses the real address at exactly the moment the host believed
it was covered. A failed request is recoverable; a disclosed address is not. Say "direct is fine here"
by returning ProxyRoute.direct().
A provider belongs to one runtime: it is asked about that runtime's requests and no other's. A
request with no account yet, such as a new account's first sign-in, can still be routed: a sign-in
started through AltLoginService.routed(tag), or a bulk import with a route tag, carries the
tag in NetworkScope.routeTag() on every request it makes.
- Since:
- 0.8.0
-
Method Summary
Modifier and TypeMethodDescriptionrouteFor(NetworkScope scope) Returns the route the given request should take.
-
Method Details
-
routeFor
Returns the route the given request should take.- Parameters:
scope- what is being fetched, and on whose behalf- Returns:
- the route to use;
ProxyRoute.direct()for no proxy. Nevernull - Since:
- 0.8.0
-