Class NetworkScope
ProxyProvider reads this
to decide which route the request should take.
The account is carried because per-account proxying is the point: an alt manager that validates
fifty accounts from one address looks like one machine hammering the service, which is what the rate
limiter is there to stop. Both account fields are null for a request that has no account yet —
a fresh Microsoft login, a cookie import — and a host proxying those assigns from its own pool.
The route tag is the host's own label for a request that has no account to route on yet. A host
that runs one proxy per account, the host of a bot for one, signs a new account in through
AltLoginService.routed(tag) (or a bulk import with BulkOptions.withRouteTag(tag)), and
every request of that sign-in, on every hop, reaches the provider with the tag. It is empty for every
other request.
A final class rather than a record since 1.0.0, so a later field is an addition and not a break:
build one with of(NetworkScope.Purpose), forAccount(NetworkScope.Purpose, String, String) and withRouteTag(String). Two scopes are equal when
every field is.
- Since:
- 0.8.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe kind of request being made, so a host can route authentication and avatars differently. -
Method Summary
Modifier and TypeMethodDescriptionReturns the username of the account this is for.Returns the dashed UUID of the account this is for.booleanReturns whetherois a scope with every field equal to this one's.static NetworkScopeforAccount(NetworkScope.Purpose purpose, String accountUuid, String accountUsername) Creates a scope for a request made on one account's behalf.inthashCode()Returns a hash over every field, consistent withequals(Object).static NetworkScopeof(NetworkScope.Purpose purpose) Creates a scope for a request that belongs to no particular account.purpose()Returns what is being fetched.routeTag()Returns the host's route tag for this request.toString()Returns every field, in the form the record printed them.withRouteTag(String tag) Returns a copy of this scope carrying a route tag.
-
Method Details
-
of
Creates a scope for a request that belongs to no particular account.- Parameters:
purpose- what is being fetched;nullreads asNetworkScope.Purpose.AUTH- Returns:
- an account-less scope
- Since:
- 0.8.0
-
forAccount
public static NetworkScope forAccount(NetworkScope.Purpose purpose, String accountUuid, String accountUsername) Creates a scope for a request made on one account's behalf.- Parameters:
purpose- what is being fetched;nullreads asNetworkScope.Purpose.AUTHaccountUuid- the dashed UUID of the account, ornullaccountUsername- the username of the account, ornull- Returns:
- a scope naming the account
- Since:
- 0.8.0
-
withRouteTag
Returns a copy of this scope carrying a route tag.- Parameters:
tag- the host's route tag, or null for none- Returns:
- the tagged copy
- Throws:
IllegalArgumentException- iftagis blank- Since:
- 1.0.0
-
purpose
Returns what is being fetched.- Returns:
- the purpose, never
null - Since:
- 0.8.0
-
accountUuid
Returns the dashed UUID of the account this is for.- Returns:
- the UUID, or
nullfor a request with no account - Since:
- 0.8.0
-
accountUsername
Returns the username of the account this is for.- Returns:
- the username, or
nullfor a request with no account - Since:
- 0.8.0
-
routeTag
-
equals
-
hashCode
public int hashCode()Returns a hash over every field, consistent withequals(Object). -
toString
-