public class RelayLocationStatusGenerator
extends java.lang.Object
Constructor and Description |
---|
RelayLocationStatusGenerator() |
Modifier and Type | Method and Description |
---|---|
static MicroblogStatus |
generateAsBandwidthTweet(java.util.List<Relay> relays)
Returns a tweet about how much bandwidth relays in a certain AS are
contributing to the Tor network.
|
static MicroblogStatus |
generateCountryBandwidthTweet(java.util.List<Relay> relays)
Returns a tweet about how much bandwidth relays in a certain country are
contributing to the Tor network.
|
static java.lang.String |
generateLocationTweetText(java.lang.String location,
java.util.List<Relay> relays,
java.lang.String searchQuery)
Helper to produce bandwidth contribution tweets for locations.
|
public static MicroblogStatus generateCountryBandwidthTweet(java.util.List<Relay> relays) throws OnionooMissingInformationException
An example tweet looks like:
16 relays in Vietnam are contributing 7.0MiB/s bandwidth to the #Tor network. https://metrics.torproject.org/rs.html#search/country:vn
This function requires that all the relays passed in the relays list are already filtered to be from the same country. The country code and country name are both determined from the first relay in the list.
relays
- A list of RelayDetails objects for the country to have a tweet
generated.OnionooMissingInformationException
- when information required to generate the tweet is missing from
the RelayDetails object (probably because Onionoo did not
have it)public static MicroblogStatus generateAsBandwidthTweet(java.util.List<Relay> relays) throws OnionooMissingInformationException
An example tweet looks like:
5 relays in EE Limited (AS12576) are contributing 2.4MiB/s bandwidth to the #Tor network. https://metrics.torproject.org/rs.html#search/as:12576
This function requires that all the relays passed in the relays list are already filtered to be from the same AS. The AS number and AS name are both determined from the first relay in the list.
relays
- A list of RelayDetails objects for the AS to have a tweet
generated.OnionooMissingInformationException
- when information required to generate the tweet is missing from
the RelayDetails object (probably because Onionoo did not
have it)public static java.lang.String generateLocationTweetText(java.lang.String location, java.util.List<Relay> relays, java.lang.String searchQuery)
location
- The human readable location for the tweet.relays
- A list of relays that match the location for the tweet.searchQuery
- The Relay Search query to search for relays matching the location.