commit d863abbc4e132c8d6375f6e2e00f390075507133 Author: Karsten Loesing karsten.loesing@gmx.net Date: Sun Jun 12 21:46:21 2016 +0200
Add @Override annotations.
Also reduce visibility of all public methods in ParseHelper and of one public method in TorperfResultsImpl, and remove unused methods in DirectorySignatureImpl and ExitListEntryImpl. --- .../descriptor/impl/BandwidthHistoryImpl.java | 4 ++ .../descriptor/impl/BlockingIteratorImpl.java | 3 ++ .../descriptor/impl/BridgeNetworkStatusImpl.java | 10 ++++ .../descriptor/impl/BridgePoolAssignmentImpl.java | 2 + .../descriptor/impl/DescriptorDownloaderImpl.java | 18 +++++++ .../descriptor/impl/DescriptorFileImpl.java | 7 +++ .../torproject/descriptor/impl/DescriptorImpl.java | 3 ++ .../descriptor/impl/DescriptorParserImpl.java | 2 + .../descriptor/impl/DescriptorReaderImpl.java | 9 ++++ .../descriptor/impl/DescriptorRequestImpl.java | 10 ++++ .../descriptor/impl/DirSourceEntryImpl.java | 10 ++++ .../descriptor/impl/DirectoryDownloader.java | 1 + .../impl/DirectoryKeyCertificateImpl.java | 11 ++++ .../descriptor/impl/DirectorySignatureImpl.java | 7 +-- .../descriptor/impl/DownloadCoordinatorImpl.java | 2 + .../descriptor/impl/ExitListEntryImpl.java | 9 ++-- .../torproject/descriptor/impl/ExitListImpl.java | 3 ++ .../descriptor/impl/ExtraInfoDescriptorImpl.java | 63 ++++++++++++++++++++++ .../descriptor/impl/MicrodescriptorImpl.java | 11 ++++ .../descriptor/impl/NetworkStatusEntryImpl.java | 18 +++++++ .../torproject/descriptor/impl/ParseHelper.java | 40 +++++++------- .../descriptor/impl/RelayDirectoryImpl.java | 9 ++++ .../impl/RelayNetworkStatusConsensusImpl.java | 15 ++++++ .../descriptor/impl/RelayNetworkStatusImpl.java | 14 +++++ .../impl/RelayNetworkStatusVoteImpl.java | 38 +++++++++++++ .../descriptor/impl/RouterStatusEntryImpl.java | 4 ++ .../descriptor/impl/ServerDescriptorImpl.java | 41 ++++++++++++++ .../descriptor/impl/TorperfResultImpl.java | 26 ++++++++- 28 files changed, 363 insertions(+), 27 deletions(-)
diff --git a/src/org/torproject/descriptor/impl/BandwidthHistoryImpl.java b/src/org/torproject/descriptor/impl/BandwidthHistoryImpl.java index 0023b88..295e0a4 100644 --- a/src/org/torproject/descriptor/impl/BandwidthHistoryImpl.java +++ b/src/org/torproject/descriptor/impl/BandwidthHistoryImpl.java @@ -66,21 +66,25 @@ public class BandwidthHistoryImpl implements BandwidthHistory { }
private String line; + @Override public String getLine() { return this.line; }
private long historyEndMillis; + @Override public long getHistoryEndMillis() { return this.historyEndMillis; }
private long intervalLength; + @Override public long getIntervalLength() { return this.intervalLength; }
private long[] bandwidthValues; + @Override public SortedMap<Long, Long> getBandwidthValues() { SortedMap<Long, Long> result = new TreeMap<>(); if (this.bandwidthValues != null) { diff --git a/src/org/torproject/descriptor/impl/BlockingIteratorImpl.java b/src/org/torproject/descriptor/impl/BlockingIteratorImpl.java index b4ea525..66426d8 100644 --- a/src/org/torproject/descriptor/impl/BlockingIteratorImpl.java +++ b/src/org/torproject/descriptor/impl/BlockingIteratorImpl.java @@ -58,6 +58,7 @@ public class BlockingIteratorImpl<T> implements Iterator<T> { /* Return whether there are more objects. Block if there are currently * no objects, but the producer hasn't signalized that there won't be * further objects. */ + @Override public synchronized boolean hasNext() { while (!this.outOfDescriptors && this.queue.isEmpty()) { try { @@ -72,6 +73,7 @@ public class BlockingIteratorImpl<T> implements Iterator<T> { * are no further objects. Block if there are currently no objects, but * the producer hasn't signalized that there won't be further * objects. */ + @Override public synchronized T next() { while (!this.outOfDescriptors && this.queue.isEmpty()) { try { @@ -88,6 +90,7 @@ public class BlockingIteratorImpl<T> implements Iterator<T> {
/* Don't support explicitly removing objects. They are removed * anyway. */ + @Override public void remove() { throw new UnsupportedOperationException(); } diff --git a/src/org/torproject/descriptor/impl/BridgeNetworkStatusImpl.java b/src/org/torproject/descriptor/impl/BridgeNetworkStatusImpl.java index fcc9b64..bf3804d 100644 --- a/src/org/torproject/descriptor/impl/BridgeNetworkStatusImpl.java +++ b/src/org/torproject/descriptor/impl/BridgeNetworkStatusImpl.java @@ -168,51 +168,61 @@ public class BridgeNetworkStatusImpl extends NetworkStatusImpl }
private long publishedMillis; + @Override public long getPublishedMillis() { return this.publishedMillis; }
private long stableUptime; + @Override public long getStableUptime() { return this.stableUptime; }
private long stableMtbf; + @Override public long getStableMtbf() { return this.stableMtbf; }
private long fastBandwidth; + @Override public long getFastBandwidth() { return this.fastBandwidth; }
private double guardWfu; + @Override public double getGuardWfu() { return this.guardWfu; }
private long guardTk; + @Override public long getGuardTk() { return this.guardTk; }
private long guardBandwidthIncludingExits; + @Override public long getGuardBandwidthIncludingExits() { return this.guardBandwidthIncludingExits; }
private long guardBandwidthExcludingExits; + @Override public long getGuardBandwidthExcludingExits() { return this.guardBandwidthExcludingExits; }
private int enoughMtbfInfo; + @Override public int getEnoughMtbfInfo() { return this.enoughMtbfInfo; }
private int ignoringAdvertisedBws; + @Override public int getIgnoringAdvertisedBws() { return this.ignoringAdvertisedBws; } diff --git a/src/org/torproject/descriptor/impl/BridgePoolAssignmentImpl.java b/src/org/torproject/descriptor/impl/BridgePoolAssignmentImpl.java index 06270bc..99578e8 100644 --- a/src/org/torproject/descriptor/impl/BridgePoolAssignmentImpl.java +++ b/src/org/torproject/descriptor/impl/BridgePoolAssignmentImpl.java @@ -85,11 +85,13 @@ public class BridgePoolAssignmentImpl extends DescriptorImpl }
private long publishedMillis; + @Override public long getPublishedMillis() { return this.publishedMillis; }
private SortedMap<String, String> entries = new TreeMap<>(); + @Override public SortedMap<String, String> getEntries() { return new TreeMap<>(this.entries); } diff --git a/src/org/torproject/descriptor/impl/DescriptorDownloaderImpl.java b/src/org/torproject/descriptor/impl/DescriptorDownloaderImpl.java index aaac8f8..e726ce9 100644 --- a/src/org/torproject/descriptor/impl/DescriptorDownloaderImpl.java +++ b/src/org/torproject/descriptor/impl/DescriptorDownloaderImpl.java @@ -18,6 +18,7 @@ public class DescriptorDownloaderImpl
private SortedMap<String, DirectoryDownloader> directoryAuthorities = new TreeMap<>(); + @Override public void addDirectoryAuthority(String nickname, String ip, int dirPort) { if (this.hasStartedDownloading) { @@ -32,6 +33,7 @@ public class DescriptorDownloaderImpl
private SortedMap<String, DirectoryDownloader> directoryMirrors = new TreeMap<>(); + @Override public void addDirectoryMirror(String nickname, String ip, int dirPort) { if (this.hasStartedDownloading) { @@ -73,6 +75,7 @@ public class DescriptorDownloaderImpl }
private boolean downloadConsensus = false; + @Override public void setIncludeCurrentConsensus() { if (this.hasStartedDownloading) { throw new IllegalStateException("Reconfiguration is not permitted " @@ -82,6 +85,7 @@ public class DescriptorDownloaderImpl }
private boolean downloadConsensusFromAllAuthorities = false; + @Override public void setIncludeCurrentConsensusFromAllDirectoryAuthorities() { if (this.hasStartedDownloading) { throw new IllegalStateException("Reconfiguration is not permitted " @@ -91,6 +95,7 @@ public class DescriptorDownloaderImpl }
private boolean includeCurrentReferencedVotes = false; + @Override public void setIncludeCurrentReferencedVotes() { if (this.hasStartedDownloading) { throw new IllegalStateException("Reconfiguration is not permitted " @@ -100,6 +105,7 @@ public class DescriptorDownloaderImpl }
private Set<String> downloadVotes = new HashSet<>(); + @Override public void setIncludeCurrentVote(String fingerprint) { if (this.hasStartedDownloading) { throw new IllegalStateException("Reconfiguration is not permitted " @@ -109,6 +115,7 @@ public class DescriptorDownloaderImpl this.downloadVotes.add(fingerprint); }
+ @Override public void setIncludeCurrentVotes(Set<String> fingerprints) { if (this.hasStartedDownloading) { throw new IllegalStateException("Reconfiguration is not permitted " @@ -133,6 +140,7 @@ public class DescriptorDownloaderImpl } }
+ @Override public void setIncludeReferencedServerDescriptors() { if (this.hasStartedDownloading) { throw new IllegalStateException("Reconfiguration is not permitted " @@ -143,6 +151,7 @@ public class DescriptorDownloaderImpl + "descriptors is not implemented yet."); }
+ @Override public void setExcludeServerDescriptor(String identifier) { if (this.hasStartedDownloading) { throw new IllegalStateException("Reconfiguration is not permitted " @@ -153,6 +162,7 @@ public class DescriptorDownloaderImpl + "descriptors is not implemented yet."); }
+ @Override public void setExcludeServerDescriptors(Set<String> identifier) { if (this.hasStartedDownloading) { throw new IllegalStateException("Reconfiguration is not permitted " @@ -163,6 +173,7 @@ public class DescriptorDownloaderImpl + "descriptors is not implemented yet."); }
+ @Override public void setIncludeReferencedExtraInfoDescriptors() { if (this.hasStartedDownloading) { throw new IllegalStateException("Reconfiguration is not permitted " @@ -173,6 +184,7 @@ public class DescriptorDownloaderImpl + "descriptors is not implemented yet."); }
+ @Override public void setExcludeExtraInfoDescriptor(String identifier) { if (this.hasStartedDownloading) { throw new IllegalStateException("Reconfiguration is not permitted " @@ -183,6 +195,7 @@ public class DescriptorDownloaderImpl + "descriptors is not implemented yet."); }
+ @Override public void setExcludeExtraInfoDescriptors(Set<String> identifiers) { if (this.hasStartedDownloading) { throw new IllegalStateException("Reconfiguration is not permitted " @@ -194,6 +207,7 @@ public class DescriptorDownloaderImpl }
private long readTimeoutMillis = 60L * 1000L; + @Override public void setReadTimeout(long readTimeoutMillis) { if (this.hasStartedDownloading) { throw new IllegalStateException("Reconfiguration is not permitted " @@ -208,6 +222,7 @@ public class DescriptorDownloaderImpl }
private long connectTimeoutMillis = 60L * 1000L; + @Override public void setConnectTimeout(long connectTimeoutMillis) { if (this.hasStartedDownloading) { throw new IllegalStateException("Reconfiguration is not permitted " @@ -222,6 +237,7 @@ public class DescriptorDownloaderImpl }
private long globalTimeoutMillis = 60L * 60L * 1000L; + @Override public void setGlobalTimeout(long globalTimeoutMillis) { if (this.hasStartedDownloading) { throw new IllegalStateException("Reconfiguration is not permitted " @@ -236,6 +252,7 @@ public class DescriptorDownloaderImpl }
private boolean failUnrecognizedDescriptorLines = false; + @Override public void setFailUnrecognizedDescriptorLines() { if (this.hasStartedDownloading) { throw new IllegalStateException("Reconfiguration is not permitted " @@ -244,6 +261,7 @@ public class DescriptorDownloaderImpl this.failUnrecognizedDescriptorLines = true; }
+ @Override public Iterator<DescriptorRequest> downloadDescriptors() { if (this.hasStartedDownloading) { throw new IllegalStateException("Initiating downloads is only " diff --git a/src/org/torproject/descriptor/impl/DescriptorFileImpl.java b/src/org/torproject/descriptor/impl/DescriptorFileImpl.java index b683e7f..801c546 100644 --- a/src/org/torproject/descriptor/impl/DescriptorFileImpl.java +++ b/src/org/torproject/descriptor/impl/DescriptorFileImpl.java @@ -15,6 +15,7 @@ public class DescriptorFileImpl implements DescriptorFile { protected void setDirectory(File directory) { this.directory = directory; } + @Override public File getDirectory() { return this.directory; } @@ -23,6 +24,7 @@ public class DescriptorFileImpl implements DescriptorFile { protected void setTarball(File tarball) { this.tarball = tarball; } + @Override public File getTarball() { return this.tarball; } @@ -31,6 +33,7 @@ public class DescriptorFileImpl implements DescriptorFile { protected void setFile(File file) { this.file = file; } + @Override public File getFile() { return this.file; } @@ -39,6 +42,7 @@ public class DescriptorFileImpl implements DescriptorFile { protected void setFileName(String fileName) { this.fileName = fileName; } + @Override public String getFileName() { return this.fileName; } @@ -47,6 +51,7 @@ public class DescriptorFileImpl implements DescriptorFile { protected void setLastModified(long lastModified) { this.lastModified = lastModified; } + @Override public long getLastModified() { return this.lastModified; } @@ -55,6 +60,7 @@ public class DescriptorFileImpl implements DescriptorFile { protected void setDescriptors(List<Descriptor> descriptors) { this.descriptors = descriptors; } + @Override public List<Descriptor> getDescriptors() { return this.descriptors == null ? new ArrayList<Descriptor>() : new ArrayList<>(this.descriptors); @@ -64,6 +70,7 @@ public class DescriptorFileImpl implements DescriptorFile { protected void setException(Exception exception) { this.exception = exception; } + @Override public Exception getException() { return this.exception; } diff --git a/src/org/torproject/descriptor/impl/DescriptorImpl.java b/src/org/torproject/descriptor/impl/DescriptorImpl.java index e7a3f0e..5625b3f 100644 --- a/src/org/torproject/descriptor/impl/DescriptorImpl.java +++ b/src/org/torproject/descriptor/impl/DescriptorImpl.java @@ -159,6 +159,7 @@ public abstract class DescriptorImpl implements Descriptor { }
protected byte[] rawDescriptorBytes; + @Override public byte[] getRawDescriptorBytes() { return this.rawDescriptorBytes; } @@ -166,6 +167,7 @@ public abstract class DescriptorImpl implements Descriptor { protected boolean failUnrecognizedDescriptorLines = false;
protected List<String> unrecognizedLines; + @Override public List<String> getUnrecognizedLines() { return this.unrecognizedLines == null ? new ArrayList<String>() : new ArrayList<>(this.unrecognizedLines); @@ -205,6 +207,7 @@ public abstract class DescriptorImpl implements Descriptor { this.rawDescriptorBytes = rawDescriptor; } } + @Override public List<String> getAnnotations() { return new ArrayList<>(this.annotations); } diff --git a/src/org/torproject/descriptor/impl/DescriptorParserImpl.java b/src/org/torproject/descriptor/impl/DescriptorParserImpl.java index b9af853..6ac53f8 100644 --- a/src/org/torproject/descriptor/impl/DescriptorParserImpl.java +++ b/src/org/torproject/descriptor/impl/DescriptorParserImpl.java @@ -12,12 +12,14 @@ public class DescriptorParserImpl implements DescriptorParser {
private boolean failUnrecognizedDescriptorLines;
+ @Override public void setFailUnrecognizedDescriptorLines( boolean failUnrecognizedDescriptorLines) { this.failUnrecognizedDescriptorLines = failUnrecognizedDescriptorLines; }
+ @Override public List<Descriptor> parseDescriptors(byte[] rawDescriptorBytes, String fileName) throws DescriptorParseException { return DescriptorImpl.parseDescriptors(rawDescriptorBytes, fileName, diff --git a/src/org/torproject/descriptor/impl/DescriptorReaderImpl.java b/src/org/torproject/descriptor/impl/DescriptorReaderImpl.java index 454c526..8da88e9 100644 --- a/src/org/torproject/descriptor/impl/DescriptorReaderImpl.java +++ b/src/org/torproject/descriptor/impl/DescriptorReaderImpl.java @@ -35,6 +35,7 @@ public class DescriptorReaderImpl implements DescriptorReader { private boolean hasStartedReading = false;
private List<File> directories = new ArrayList<>(); + @Override public void addDirectory(File directory) { if (this.hasStartedReading) { throw new IllegalStateException("Reconfiguration is not permitted " @@ -44,6 +45,7 @@ public class DescriptorReaderImpl implements DescriptorReader { }
private List<File> tarballs = new ArrayList<>(); + @Override public void addTarball(File tarball) { if (this.hasStartedReading) { throw new IllegalStateException("Reconfiguration is not permitted " @@ -53,6 +55,7 @@ public class DescriptorReaderImpl implements DescriptorReader { }
private File historyFile; + @Override public void setExcludeFiles(File historyFile) { if (this.hasStartedReading) { throw new IllegalStateException("Reconfiguration is not permitted " @@ -62,6 +65,7 @@ public class DescriptorReaderImpl implements DescriptorReader { }
private SortedMap<String, Long> excludedFiles; + @Override public void setExcludedFiles(SortedMap<String, Long> excludedFiles) { if (this.hasStartedReading) { throw new IllegalStateException("Reconfiguration is not permitted " @@ -70,6 +74,7 @@ public class DescriptorReaderImpl implements DescriptorReader { this.excludedFiles = excludedFiles; }
+ @Override public SortedMap<String, Long> getExcludedFiles() { if (this.reader == null || !this.reader.hasFinishedReading) { throw new IllegalStateException("Operation is not permitted before " @@ -78,6 +83,7 @@ public class DescriptorReaderImpl implements DescriptorReader { return new TreeMap<>(this.reader.excludedFilesAfter); }
+ @Override public SortedMap<String, Long> getParsedFiles() { if (this.reader == null || !this.reader.hasFinishedReading) { throw new IllegalStateException("Operation is not permitted before " @@ -87,6 +93,7 @@ public class DescriptorReaderImpl implements DescriptorReader { }
private boolean failUnrecognizedDescriptorLines = false; + @Override public void setFailUnrecognizedDescriptorLines() { if (this.hasStartedReading) { throw new IllegalStateException("Reconfiguration is not permitted " @@ -96,6 +103,7 @@ public class DescriptorReaderImpl implements DescriptorReader { }
private Integer maxDescriptorFilesInQueue = null; + @Override public void setMaxDescriptorFilesInQueue(int max) { if (this.hasStartedReading) { throw new IllegalStateException("Reconfiguration is not permitted " @@ -105,6 +113,7 @@ public class DescriptorReaderImpl implements DescriptorReader { }
private DescriptorReaderRunnable reader; + @Override public Iterator<DescriptorFile> readDescriptors() { if (this.hasStartedReading) { throw new IllegalStateException("Initiating reading is only " diff --git a/src/org/torproject/descriptor/impl/DescriptorRequestImpl.java b/src/org/torproject/descriptor/impl/DescriptorRequestImpl.java index 5a5f020..0238f24 100644 --- a/src/org/torproject/descriptor/impl/DescriptorRequestImpl.java +++ b/src/org/torproject/descriptor/impl/DescriptorRequestImpl.java @@ -34,6 +34,7 @@ public class DescriptorRequestImpl implements DescriptorRequest { }
private String requestUrl; + @Override public String getRequestUrl() { return this.requestUrl; } @@ -42,6 +43,7 @@ public class DescriptorRequestImpl implements DescriptorRequest { protected void setDirectoryNickname(String directoryNickname) { this.directoryNickname = directoryNickname; } + @Override public String getDirectoryNickname() { return this.directoryNickname; } @@ -50,6 +52,7 @@ public class DescriptorRequestImpl implements DescriptorRequest { protected void setResponseCode(int responseCode) { this.responseCode = responseCode; } + @Override public int getResponseCode() { return this.responseCode; } @@ -58,6 +61,7 @@ public class DescriptorRequestImpl implements DescriptorRequest { protected void setRequestStart(long requestStart) { this.requestStart = requestStart; } + @Override public long getRequestStart() { return this.requestStart; } @@ -66,21 +70,25 @@ public class DescriptorRequestImpl implements DescriptorRequest { protected void setRequestEnd(long requestEnd) { this.requestEnd = requestEnd; } + @Override public long getRequestEnd() { return this.requestEnd; }
private boolean connectTimeoutHasExpired; + @Override public boolean connectTimeoutHasExpired() { return this.connectTimeoutHasExpired; }
private boolean readTimeoutHasExpired; + @Override public boolean readTimeoutHasExpired() { return this.readTimeoutHasExpired; }
private boolean globalTimeoutHasExpired; + @Override public boolean globalTimeoutHasExpired() { return this.globalTimeoutHasExpired; } @@ -89,6 +97,7 @@ public class DescriptorRequestImpl implements DescriptorRequest { protected void setDescriptors(List<Descriptor> descriptors) { this.descriptors = descriptors; } + @Override public List<Descriptor> getDescriptors() { return this.descriptors; } @@ -97,6 +106,7 @@ public class DescriptorRequestImpl implements DescriptorRequest { protected void setException(Exception exception) { this.exception = exception; } + @Override public Exception getException() { return this.exception; } diff --git a/src/org/torproject/descriptor/impl/DirSourceEntryImpl.java b/src/org/torproject/descriptor/impl/DirSourceEntryImpl.java index 5e39cfe..fb2f5ad 100644 --- a/src/org/torproject/descriptor/impl/DirSourceEntryImpl.java +++ b/src/org/torproject/descriptor/impl/DirSourceEntryImpl.java @@ -14,6 +14,7 @@ import org.torproject.descriptor.DirSourceEntry; public class DirSourceEntryImpl implements DirSourceEntry {
private byte[] dirSourceEntryBytes; + @Override public byte[] getDirSourceEntryBytes() { return this.dirSourceEntryBytes; } @@ -161,46 +162,55 @@ public class DirSourceEntryImpl implements DirSourceEntry { }
private String nickname; + @Override public String getNickname() { return this.nickname; }
private String identity; + @Override public String getIdentity() { return this.identity; }
private boolean isLegacy; + @Override public boolean isLegacy() { return this.isLegacy; }
private String hostname; + @Override public String getHostname() { return this.hostname; }
private String ip; + @Override public String getIp() { return this.ip; }
private int dirPort; + @Override public int getDirPort() { return this.dirPort; }
private int orPort; + @Override public int getOrPort() { return this.orPort; }
private String contactLine; + @Override public String getContactLine() { return this.contactLine; }
private String voteDigest; + @Override public String getVoteDigest() { return this.voteDigest; } diff --git a/src/org/torproject/descriptor/impl/DirectoryDownloader.java b/src/org/torproject/descriptor/impl/DirectoryDownloader.java index 66af559..a27ed76 100644 --- a/src/org/torproject/descriptor/impl/DirectoryDownloader.java +++ b/src/org/torproject/descriptor/impl/DirectoryDownloader.java @@ -49,6 +49,7 @@ public class DirectoryDownloader implements Runnable { failUnrecognizedDescriptorLines); }
+ @Override public void run() { boolean keepRunning = true; do { diff --git a/src/org/torproject/descriptor/impl/DirectoryKeyCertificateImpl.java b/src/org/torproject/descriptor/impl/DirectoryKeyCertificateImpl.java index 13baedb..b62fc8e 100644 --- a/src/org/torproject/descriptor/impl/DirectoryKeyCertificateImpl.java +++ b/src/org/torproject/descriptor/impl/DirectoryKeyCertificateImpl.java @@ -240,56 +240,67 @@ public class DirectoryKeyCertificateImpl extends DescriptorImpl }
private int dirKeyCertificateVersion; + @Override public int getDirKeyCertificateVersion() { return this.dirKeyCertificateVersion; }
private String address; + @Override public String getAddress() { return this.address; }
private int port = -1; + @Override public int getPort() { return this.port; }
private String fingerprint; + @Override public String getFingerprint() { return this.fingerprint; }
private String dirIdentityKey; + @Override public String getDirIdentityKey() { return this.dirIdentityKey; }
private long dirKeyPublishedMillis; + @Override public long getDirKeyPublishedMillis() { return this.dirKeyPublishedMillis; }
private long dirKeyExpiresMillis; + @Override public long getDirKeyExpiresMillis() { return this.dirKeyExpiresMillis; }
private String dirSigningKey; + @Override public String getDirSigningKey() { return this.dirSigningKey; }
private String dirKeyCrosscert; + @Override public String getDirKeyCrosscert() { return this.dirKeyCrosscert; }
private String dirKeyCertification; + @Override public String getDirKeyCertification() { return this.dirKeyCertification; }
private String certificateDigest; + @Override public String getCertificateDigest() { return this.certificateDigest; } diff --git a/src/org/torproject/descriptor/impl/DirectorySignatureImpl.java b/src/org/torproject/descriptor/impl/DirectorySignatureImpl.java index 18de918..597ccce 100644 --- a/src/org/torproject/descriptor/impl/DirectorySignatureImpl.java +++ b/src/org/torproject/descriptor/impl/DirectorySignatureImpl.java @@ -12,9 +12,6 @@ import org.torproject.descriptor.DirectorySignature; public class DirectorySignatureImpl implements DirectorySignature {
private byte[] directorySignatureBytes; - public byte[] getDirectorySignatureBytes() { - return this.directorySignatureBytes; - }
private boolean failUnrecognizedDescriptorLines; private List<String> unrecognizedLines; @@ -90,21 +87,25 @@ public class DirectorySignatureImpl implements DirectorySignature { }
private String algorithm = "sha1"; + @Override public String getAlgorithm() { return this.algorithm; }
private String identity; + @Override public String getIdentity() { return this.identity; }
private String signingKeyDigest; + @Override public String getSigningKeyDigest() { return this.signingKeyDigest; }
private String signature; + @Override public String getSignature() { return this.signature; } diff --git a/src/org/torproject/descriptor/impl/DownloadCoordinatorImpl.java b/src/org/torproject/descriptor/impl/DownloadCoordinatorImpl.java index 6a73090..a8e3731 100644 --- a/src/org/torproject/descriptor/impl/DownloadCoordinatorImpl.java +++ b/src/org/torproject/descriptor/impl/DownloadCoordinatorImpl.java @@ -142,6 +142,7 @@ public class DownloadCoordinatorImpl implements DownloadCoordinator { /* Look up what request a directory should make next. If there is * nothing to do right now, but maybe later, block the caller. If * we're done downloading, return null to notify the caller. */ + @Override public synchronized DescriptorRequestImpl createRequest( String nickname) { while (!this.hasFinishedDownloading) { @@ -197,6 +198,7 @@ public class DownloadCoordinatorImpl implements DownloadCoordinator { * or a failure response code. Update the lists of missing descriptors, * decide if there are more descriptors to download, and wake up any * waiting downloader threads. */ + @Override public synchronized void deliverResponse( DescriptorRequestImpl response) { String nickname = response.getDirectoryNickname(); diff --git a/src/org/torproject/descriptor/impl/ExitListEntryImpl.java b/src/org/torproject/descriptor/impl/ExitListEntryImpl.java index 6d00bf4..efbf31c 100644 --- a/src/org/torproject/descriptor/impl/ExitListEntryImpl.java +++ b/src/org/torproject/descriptor/impl/ExitListEntryImpl.java @@ -18,9 +18,6 @@ import org.torproject.descriptor.ExitListEntry; public class ExitListEntryImpl implements ExitListEntry, ExitList.Entry {
private byte[] exitListEntryBytes; - public byte[] getExitListEntryBytes() { - return this.exitListEntryBytes; - }
private boolean failUnrecognizedDescriptorLines; private List<String> unrecognizedLines; @@ -172,21 +169,25 @@ public class ExitListEntryImpl implements ExitListEntry, ExitList.Entry { }
private String fingerprint; + @Override public String getFingerprint() { return this.fingerprint; }
private long publishedMillis; + @Override public long getPublishedMillis() { return this.publishedMillis; }
private long lastStatusMillis; + @Override public long getLastStatusMillis() { return this.lastStatusMillis; }
private String exitAddress; + @Override public String getExitAddress() { if (null == exitAddress) { Map.Entry<String, Long> randomEntry = @@ -198,11 +199,13 @@ public class ExitListEntryImpl implements ExitListEntry, ExitList.Entry { }
private Map<String, Long> exitAddresses = new HashMap<>(); + @Override public Map<String, Long> getExitAddresses(){ return new HashMap<>(this.exitAddresses); }
private long scanMillis; + @Override public long getScanMillis() { if (null == exitAddress) { getExitAddress(); diff --git a/src/org/torproject/descriptor/impl/ExitListImpl.java b/src/org/torproject/descriptor/impl/ExitListImpl.java index 33003df..10619ba 100644 --- a/src/org/torproject/descriptor/impl/ExitListImpl.java +++ b/src/org/torproject/descriptor/impl/ExitListImpl.java @@ -121,17 +121,20 @@ public class ExitListImpl extends DescriptorImpl implements ExitList { }
private long downloadedMillis; + @Override public long getDownloadedMillis() { return this.downloadedMillis; }
private Set<ExitListEntry> oldExitListEntries = new HashSet<>(); @Deprecated + @Override public Set<ExitListEntry> getExitListEntries() { return new HashSet<>(this.oldExitListEntries); }
private Set<ExitList.Entry> exitListEntries = new HashSet<>(); + @Override public Set<ExitList.Entry> getEntries() { return new HashSet<>(this.exitListEntries); } diff --git a/src/org/torproject/descriptor/impl/ExtraInfoDescriptorImpl.java b/src/org/torproject/descriptor/impl/ExtraInfoDescriptorImpl.java index 3255bd9..3f72616 100644 --- a/src/org/torproject/descriptor/impl/ExtraInfoDescriptorImpl.java +++ b/src/org/torproject/descriptor/impl/ExtraInfoDescriptorImpl.java @@ -881,339 +881,402 @@ public abstract class ExtraInfoDescriptorImpl extends DescriptorImpl }
private String extraInfoDigest; + @Override public String getExtraInfoDigest() { return this.extraInfoDigest; }
private String extraInfoDigestSha256; + @Override public String getExtraInfoDigestSha256() { return this.extraInfoDigestSha256; }
private String nickname; + @Override public String getNickname() { return this.nickname; }
private String fingerprint; + @Override public String getFingerprint() { return this.fingerprint; }
private long publishedMillis; + @Override public long getPublishedMillis() { return this.publishedMillis; }
private BandwidthHistory readHistory; + @Override public BandwidthHistory getReadHistory() { return this.readHistory; }
private BandwidthHistory writeHistory; + @Override public BandwidthHistory getWriteHistory() { return this.writeHistory; }
private String geoipDbDigest; + @Override public String getGeoipDbDigest() { return this.geoipDbDigest; }
private String geoip6DbDigest; + @Override public String getGeoip6DbDigest() { return this.geoip6DbDigest; }
private long dirreqStatsEndMillis = -1L; + @Override public long getDirreqStatsEndMillis() { return this.dirreqStatsEndMillis; }
private long dirreqStatsIntervalLength = -1L; + @Override public long getDirreqStatsIntervalLength() { return this.dirreqStatsIntervalLength; }
private String dirreqV2Ips; + @Override public SortedMap<String, Integer> getDirreqV2Ips() { return ParseHelper.convertCommaSeparatedKeyIntegerValueList( this.dirreqV2Ips); }
private String dirreqV3Ips; + @Override public SortedMap<String, Integer> getDirreqV3Ips() { return ParseHelper.convertCommaSeparatedKeyIntegerValueList( this.dirreqV3Ips); }
private String dirreqV2Reqs; + @Override public SortedMap<String, Integer> getDirreqV2Reqs() { return ParseHelper.convertCommaSeparatedKeyIntegerValueList( this.dirreqV2Reqs); }
private String dirreqV3Reqs; + @Override public SortedMap<String, Integer> getDirreqV3Reqs() { return ParseHelper.convertCommaSeparatedKeyIntegerValueList( this.dirreqV3Reqs); }
private double dirreqV2Share = -1.0; + @Override public double getDirreqV2Share() { return this.dirreqV2Share; }
private double dirreqV3Share = -1.0; + @Override public double getDirreqV3Share() { return this.dirreqV3Share; }
private String dirreqV2Resp; + @Override public SortedMap<String, Integer> getDirreqV2Resp() { return ParseHelper.convertCommaSeparatedKeyIntegerValueList( this.dirreqV2Resp); }
private String dirreqV3Resp; + @Override public SortedMap<String, Integer> getDirreqV3Resp() { return ParseHelper.convertCommaSeparatedKeyIntegerValueList( this.dirreqV3Resp); }
private String dirreqV2DirectDl; + @Override public SortedMap<String, Integer> getDirreqV2DirectDl() { return ParseHelper.convertCommaSeparatedKeyIntegerValueList( this.dirreqV2DirectDl); }
private String dirreqV3DirectDl; + @Override public SortedMap<String, Integer> getDirreqV3DirectDl() { return ParseHelper.convertCommaSeparatedKeyIntegerValueList( this.dirreqV3DirectDl); }
private String dirreqV2TunneledDl; + @Override public SortedMap<String, Integer> getDirreqV2TunneledDl() { return ParseHelper.convertCommaSeparatedKeyIntegerValueList( this.dirreqV2TunneledDl); }
private String dirreqV3TunneledDl; + @Override public SortedMap<String, Integer> getDirreqV3TunneledDl() { return ParseHelper.convertCommaSeparatedKeyIntegerValueList( this.dirreqV3TunneledDl); }
private BandwidthHistory dirreqReadHistory; + @Override public BandwidthHistory getDirreqReadHistory() { return this.dirreqReadHistory; }
private BandwidthHistory dirreqWriteHistory; + @Override public BandwidthHistory getDirreqWriteHistory() { return this.dirreqWriteHistory; }
private long entryStatsEndMillis = -1L; + @Override public long getEntryStatsEndMillis() { return this.entryStatsEndMillis; }
private long entryStatsIntervalLength = -1L; + @Override public long getEntryStatsIntervalLength() { return this.entryStatsIntervalLength; }
private String entryIps; + @Override public SortedMap<String, Integer> getEntryIps() { return ParseHelper.convertCommaSeparatedKeyIntegerValueList( this.entryIps); }
private long cellStatsEndMillis = -1L; + @Override public long getCellStatsEndMillis() { return this.cellStatsEndMillis; }
private long cellStatsIntervalLength = -1L; + @Override public long getCellStatsIntervalLength() { return this.cellStatsIntervalLength; }
private Integer[] cellProcessedCells; + @Override public List<Integer> getCellProcessedCells() { return this.cellProcessedCells == null ? null : Arrays.asList(this.cellProcessedCells); }
private Double[] cellQueuedCells; + @Override public List<Double> getCellQueuedCells() { return this.cellQueuedCells == null ? null : Arrays.asList(this.cellQueuedCells); }
private Integer[] cellTimeInQueue; + @Override public List<Integer> getCellTimeInQueue() { return this.cellTimeInQueue == null ? null : Arrays.asList(this.cellTimeInQueue); }
private int cellCircuitsPerDecile = -1; + @Override public int getCellCircuitsPerDecile() { return this.cellCircuitsPerDecile; }
private long connBiDirectStatsEndMillis = -1L; + @Override public long getConnBiDirectStatsEndMillis() { return this.connBiDirectStatsEndMillis; }
private long connBiDirectStatsIntervalLength = -1L; + @Override public long getConnBiDirectStatsIntervalLength() { return this.connBiDirectStatsIntervalLength; }
private int connBiDirectBelow = -1; + @Override public int getConnBiDirectBelow() { return this.connBiDirectBelow; }
private int connBiDirectRead = -1; + @Override public int getConnBiDirectRead() { return this.connBiDirectRead; }
private int connBiDirectWrite = -1; + @Override public int getConnBiDirectWrite() { return this.connBiDirectWrite; }
private int connBiDirectBoth = -1; + @Override public int getConnBiDirectBoth() { return this.connBiDirectBoth; }
private long exitStatsEndMillis = -1L; + @Override public long getExitStatsEndMillis() { return this.exitStatsEndMillis; }
private long exitStatsIntervalLength = -1L; + @Override public long getExitStatsIntervalLength() { return this.exitStatsIntervalLength; }
private SortedMap<String, Long> exitKibibytesWritten; + @Override public SortedMap<String, Long> getExitKibibytesWritten() { return this.exitKibibytesWritten == null ? null : new TreeMap<>(this.exitKibibytesWritten); }
private SortedMap<String, Long> exitKibibytesRead; + @Override public SortedMap<String, Long> getExitKibibytesRead() { return this.exitKibibytesRead == null ? null : new TreeMap<>(this.exitKibibytesRead); }
private SortedMap<String, Long> exitStreamsOpened; + @Override public SortedMap<String, Long> getExitStreamsOpened() { return this.exitStreamsOpened == null ? null : new TreeMap<>(this.exitStreamsOpened); }
private long geoipStartTimeMillis = -1L; + @Override public long getGeoipStartTimeMillis() { return this.geoipStartTimeMillis; }
private String geoipClientOrigins; + @Override public SortedMap<String, Integer> getGeoipClientOrigins() { return ParseHelper.convertCommaSeparatedKeyIntegerValueList( this.geoipClientOrigins); }
private long bridgeStatsEndMillis = -1L; + @Override public long getBridgeStatsEndMillis() { return this.bridgeStatsEndMillis; }
private long bridgeStatsIntervalLength = -1L; + @Override public long getBridgeStatsIntervalLength() { return this.bridgeStatsIntervalLength; }
private String bridgeIps; + @Override public SortedMap<String, Integer> getBridgeIps() { return ParseHelper.convertCommaSeparatedKeyIntegerValueList( this.bridgeIps); }
private String bridgeIpVersions; + @Override public SortedMap<String, Integer> getBridgeIpVersions() { return ParseHelper.convertCommaSeparatedKeyIntegerValueList( this.bridgeIpVersions); }
private String bridgeIpTransports; + @Override public SortedMap<String, Integer> getBridgeIpTransports() { return ParseHelper.convertCommaSeparatedKeyIntegerValueList( this.bridgeIpTransports); }
private List<String> transports = new ArrayList<>(); + @Override public List<String> getTransports() { return new ArrayList<>(this.transports); }
private long hidservStatsEndMillis = -1L; + @Override public long getHidservStatsEndMillis() { return this.hidservStatsEndMillis; }
private long hidservStatsIntervalLength = -1L; + @Override public long getHidservStatsIntervalLength() { return this.hidservStatsIntervalLength; }
private Double hidservRendRelayedCells; + @Override public Double getHidservRendRelayedCells() { return this.hidservRendRelayedCells; }
private Map<String, Double> hidservRendRelayedCellsParameters; + @Override public Map<String, Double> getHidservRendRelayedCellsParameters() { return this.hidservRendRelayedCellsParameters == null ? null : new HashMap<>(this.hidservRendRelayedCellsParameters); }
private Double hidservDirOnionsSeen; + @Override public Double getHidservDirOnionsSeen() { return this.hidservDirOnionsSeen; }
private Map<String, Double> hidservDirOnionsSeenParameters; + @Override public Map<String, Double> getHidservDirOnionsSeenParameters() { return this.hidservDirOnionsSeenParameters == null ? null : new HashMap<>(this.hidservDirOnionsSeenParameters); }
private String routerSignature; + @Override public String getRouterSignature() { return this.routerSignature; }
private String identityEd25519; + @Override public String getIdentityEd25519() { return this.identityEd25519; }
private String masterKeyEd25519; + @Override public String getMasterKeyEd25519() { return this.masterKeyEd25519; }
private String routerSignatureEd25519; + @Override public String getRouterSignatureEd25519() { return this.routerSignatureEd25519; } diff --git a/src/org/torproject/descriptor/impl/MicrodescriptorImpl.java b/src/org/torproject/descriptor/impl/MicrodescriptorImpl.java index cf8f3e6..4931c31 100644 --- a/src/org/torproject/descriptor/impl/MicrodescriptorImpl.java +++ b/src/org/torproject/descriptor/impl/MicrodescriptorImpl.java @@ -260,56 +260,67 @@ public class MicrodescriptorImpl extends DescriptorImpl }
private String microdescriptorDigest; + @Override public String getMicrodescriptorDigest() { return this.microdescriptorDigest; }
private String onionKey; + @Override public String getOnionKey() { return this.onionKey; }
private String ntorOnionKey; + @Override public String getNtorOnionKey() { return this.ntorOnionKey; }
private List<String> orAddresses = new ArrayList<>(); + @Override public List<String> getOrAddresses() { return new ArrayList<>(this.orAddresses); }
private String[] familyEntries; + @Override public List<String> getFamilyEntries() { return this.familyEntries == null ? null : Arrays.asList(this.familyEntries); } private String defaultPolicy; + @Override public String getDefaultPolicy() { return this.defaultPolicy; }
private String portList; + @Override public String getPortList() { return this.portList; }
private String ipv6DefaultPolicy; + @Override public String getIpv6DefaultPolicy() { return this.ipv6DefaultPolicy; }
private String ipv6PortList; + @Override public String getIpv6PortList() { return this.ipv6PortList; }
private String rsa1024Identity; + @Override public String getRsa1024Identity() { return this.rsa1024Identity; }
private String ed25519Identity; + @Override public String getEd25519Identity() { return this.ed25519Identity; } diff --git a/src/org/torproject/descriptor/impl/NetworkStatusEntryImpl.java b/src/org/torproject/descriptor/impl/NetworkStatusEntryImpl.java index a17973e..b73d211 100644 --- a/src/org/torproject/descriptor/impl/NetworkStatusEntryImpl.java +++ b/src/org/torproject/descriptor/impl/NetworkStatusEntryImpl.java @@ -20,6 +20,7 @@ import org.torproject.descriptor.NetworkStatusEntry; public class NetworkStatusEntryImpl implements NetworkStatusEntry {
private byte[] statusEntryBytes; + @Override public byte[] getStatusEntryBytes() { return this.statusEntryBytes; } @@ -269,52 +270,62 @@ public class NetworkStatusEntryImpl implements NetworkStatusEntry { }
private String nickname; + @Override public String getNickname() { return this.nickname; }
private String fingerprint; + @Override public String getFingerprint() { return this.fingerprint; }
private String descriptor; + @Override public String getDescriptor() { return this.descriptor; }
private long publishedMillis; + @Override public long getPublishedMillis() { return this.publishedMillis; }
private String address; + @Override public String getAddress() { return this.address; }
private int orPort; + @Override public int getOrPort() { return this.orPort; }
private int dirPort; + @Override public int getDirPort() { return this.dirPort; }
private Set<String> microdescriptorDigests; + @Override public Set<String> getMicrodescriptorDigests() { return this.microdescriptorDigests == null ? null : new HashSet<>(this.microdescriptorDigests); }
private List<String> orAddresses = new ArrayList<>(); + @Override public List<String> getOrAddresses() { return new ArrayList<>(this.orAddresses); }
private BitSet flags; + @Override public SortedSet<String> getFlags() { SortedSet<String> result = new TreeSet<>(); if (this.flags != null) { @@ -327,36 +338,43 @@ public class NetworkStatusEntryImpl implements NetworkStatusEntry { }
private String version; + @Override public String getVersion() { return this.version; }
private long bandwidth = -1L; + @Override public long getBandwidth() { return this.bandwidth; }
private long measured = -1L; + @Override public long getMeasured() { return this.measured; }
private boolean unmeasured = false; + @Override public boolean getUnmeasured() { return this.unmeasured; }
private String defaultPolicy; + @Override public String getDefaultPolicy() { return this.defaultPolicy; }
private String portList; + @Override public String getPortList() { return this.portList; }
private String masterKeyEd25519; + @Override public String getMasterKeyEd25519() { return this.masterKeyEd25519; } diff --git a/src/org/torproject/descriptor/impl/ParseHelper.java b/src/org/torproject/descriptor/impl/ParseHelper.java index 6ae549b..1d349b4 100644 --- a/src/org/torproject/descriptor/impl/ParseHelper.java +++ b/src/org/torproject/descriptor/impl/ParseHelper.java @@ -22,7 +22,7 @@ public class ParseHelper {
private static Pattern keywordPattern = Pattern.compile("^[A-Za-z0-9-]+$"); - public static String parseKeyword(String line, String keyword) + protected static String parseKeyword(String line, String keyword) throws DescriptorParseException { if (!keywordPattern.matcher(keyword).matches()) { throw new DescriptorParseException("Unrecognized character in " @@ -33,7 +33,7 @@ public class ParseHelper {
private static Pattern ipv4Pattern = Pattern.compile("^[0-9\.]{7,15}$"); - public static String parseIpv4Address(String line, String address) + protected static String parseIpv4Address(String line, String address) throws DescriptorParseException { boolean isValid = true; if (!ipv4Pattern.matcher(address).matches()) { @@ -62,7 +62,7 @@ public class ParseHelper { return address; }
- public static int parsePort(String line, String portString) + protected static int parsePort(String line, String portString) throws DescriptorParseException { int port = -1; try { @@ -78,7 +78,7 @@ public class ParseHelper { return port; }
- public static long parseSeconds(String line, String secondsString) + protected static long parseSeconds(String line, String secondsString) throws DescriptorParseException { try { return Long.parseLong(secondsString); @@ -88,7 +88,7 @@ public class ParseHelper { } }
- public static String parseExitPattern(String line, String exitPattern) + protected static String parseExitPattern(String line, String exitPattern) throws DescriptorParseException { if (!exitPattern.contains(":")) { throw new DescriptorParseException("'" + exitPattern + "' in line '" @@ -166,7 +166,7 @@ public class ParseHelper { return threadDateFormats.get(format); }
- public static long parseTimestampAtIndex(String line, String[] parts, + protected static long parseTimestampAtIndex(String line, String[] parts, int dateIndex, int timeIndex) throws DescriptorParseException { if (dateIndex >= parts.length || timeIndex >= parts.length) { throw new DescriptorParseException("Line '" + line + "' does not " @@ -187,7 +187,7 @@ public class ParseHelper { return result; }
- public static long parseDateAtIndex(String line, String[] parts, + protected static long parseDateAtIndex(String line, String[] parts, int dateIndex) throws DescriptorParseException { if (dateIndex >= parts.length) { throw new DescriptorParseException("Line '" + line + "' does not " @@ -209,7 +209,7 @@ public class ParseHelper {
private static Pattern twentyByteHexPattern = Pattern.compile("^[0-9a-fA-F]{40}$"); - public static String parseTwentyByteHexString(String line, + protected static String parseTwentyByteHexString(String line, String hexString) throws DescriptorParseException { if (!twentyByteHexPattern.matcher(hexString).matches()) { throw new DescriptorParseException("Illegal hex string in line '" @@ -218,7 +218,7 @@ public class ParseHelper { return hexString.toUpperCase(); }
- public static SortedMap<String, String> parseKeyValueStringPairs( + protected static SortedMap<String, String> parseKeyValueStringPairs( String line, String[] parts, int startIndex, String separatorString) throws DescriptorParseException { SortedMap<String, String> result = new TreeMap<>(); @@ -234,7 +234,7 @@ public class ParseHelper { return result; }
- public static SortedMap<String, Integer> parseKeyValueIntegerPairs( + protected static SortedMap<String, Integer> parseKeyValueIntegerPairs( String line, String[] parts, int startIndex, String separatorString) throws DescriptorParseException { SortedMap<String, Integer> result = new TreeMap<>(); @@ -254,7 +254,7 @@ public class ParseHelper {
private static Pattern nicknamePattern = Pattern.compile("^[0-9a-zA-Z]{1,19}$"); - public static String parseNickname(String line, String nickname) + protected static String parseNickname(String line, String nickname) throws DescriptorParseException { if (!nicknamePattern.matcher(nickname).matches()) { throw new DescriptorParseException("Illegal nickname in line '" @@ -263,7 +263,7 @@ public class ParseHelper { return nickname; }
- public static boolean parseBoolean(String b, String line) + protected static boolean parseBoolean(String b, String line) throws DescriptorParseException { switch (b) { case "1": @@ -277,7 +277,7 @@ public class ParseHelper {
private static Pattern twentyByteBase64Pattern = Pattern.compile("^[0-9a-zA-Z+/]{27}$"); - public static String parseTwentyByteBase64String(String line, + protected static String parseTwentyByteBase64String(String line, String base64String) throws DescriptorParseException { if (!twentyByteBase64Pattern.matcher(base64String).matches()) { throw new DescriptorParseException("'" + base64String @@ -291,7 +291,7 @@ public class ParseHelper {
private static Pattern thirtyTwoByteBase64Pattern = Pattern.compile("^[0-9a-zA-Z+/]{43}$"); - public static String parseThirtyTwoByteBase64String(String line, + protected static String parseThirtyTwoByteBase64String(String line, String base64String) throws DescriptorParseException { if (!thirtyTwoByteBase64Pattern.matcher(base64String).matches()) { throw new DescriptorParseException("'" + base64String @@ -305,7 +305,7 @@ public class ParseHelper {
private static Map<Integer, Pattern> commaSeparatedKeyValueListPatterns = new HashMap<>(); - public static String parseCommaSeparatedKeyIntegerValueList( + protected static String parseCommaSeparatedKeyIntegerValueList( String line, String[] partsNoOpt, int index, int keyLength) throws DescriptorParseException { String result = ""; @@ -338,7 +338,7 @@ public class ParseHelper { return result; }
- public static SortedMap<String, Integer> + protected static SortedMap<String, Integer> convertCommaSeparatedKeyIntegerValueList(String validatedString) { SortedMap<String, Integer> result = null; if (validatedString != null) { @@ -353,7 +353,7 @@ public class ParseHelper { return result; }
- public static SortedMap<String, Long> + protected static SortedMap<String, Long> parseCommaSeparatedKeyLongValueList(String line, String[] partsNoOpt, int index, int keyLength) throws DescriptorParseException { @@ -391,7 +391,7 @@ public class ParseHelper { return result; }
- public static Integer[] parseCommaSeparatedIntegerValueList( + protected static Integer[] parseCommaSeparatedIntegerValueList( String line, String[] partsNoOpt, int index) throws DescriptorParseException { Integer[] result = null; @@ -419,7 +419,7 @@ public class ParseHelper { return result; }
- public static Double[] parseCommaSeparatedDoubleValueList( + protected static Double[] parseCommaSeparatedDoubleValueList( String line, String[] partsNoOpt, int index) throws DescriptorParseException { Double[] result = null; @@ -480,7 +480,7 @@ public class ParseHelper { return result; }
- public static String + protected static String parseMasterKeyEd25519FromIdentityEd25519CryptoBlock( String identityEd25519CryptoBlock) throws DescriptorParseException { String identityEd25519CryptoBlockNoNewlines = diff --git a/src/org/torproject/descriptor/impl/RelayDirectoryImpl.java b/src/org/torproject/descriptor/impl/RelayDirectoryImpl.java index 873326d..1ff15cb 100644 --- a/src/org/torproject/descriptor/impl/RelayDirectoryImpl.java +++ b/src/org/torproject/descriptor/impl/RelayDirectoryImpl.java @@ -489,48 +489,57 @@ public class RelayDirectoryImpl extends DescriptorImpl }
private long publishedMillis; + @Override public long getPublishedMillis() { return this.publishedMillis; }
private String dirSigningKey; + @Override public String getDirSigningKey() { return this.dirSigningKey; }
private List<String> recommendedSoftware; + @Override public List<String> getRecommendedSoftware() { return this.recommendedSoftware == null ? null : new ArrayList<>(this.recommendedSoftware); }
private String directorySignature; + @Override public String getDirectorySignature() { return this.directorySignature; }
private List<RouterStatusEntry> statusEntries = new ArrayList<>(); + @Override public List<RouterStatusEntry> getRouterStatusEntries() { return new ArrayList<>(this.statusEntries); }
private List<ServerDescriptor> serverDescriptors = new ArrayList<>(); + @Override public List<ServerDescriptor> getServerDescriptors() { return new ArrayList<>(this.serverDescriptors); }
private List<Exception> serverDescriptorParseExceptions = new ArrayList<>(); + @Override public List<Exception> getServerDescriptorParseExceptions() { return new ArrayList<>(this.serverDescriptorParseExceptions); }
private String nickname; + @Override public String getNickname() { return this.nickname; }
private String directoryDigest; + @Override public String getDirectoryDigest() { return this.directoryDigest; } diff --git a/src/org/torproject/descriptor/impl/RelayNetworkStatusConsensusImpl.java b/src/org/torproject/descriptor/impl/RelayNetworkStatusConsensusImpl.java index 091ba09..fe045c1 100644 --- a/src/org/torproject/descriptor/impl/RelayNetworkStatusConsensusImpl.java +++ b/src/org/torproject/descriptor/impl/RelayNetworkStatusConsensusImpl.java @@ -317,80 +317,95 @@ public class RelayNetworkStatusConsensusImpl extends NetworkStatusImpl }
private String consensusDigest; + @Override public String getConsensusDigest() { return this.consensusDigest; }
private int networkStatusVersion; + @Override public int getNetworkStatusVersion() { return this.networkStatusVersion; }
private String consensusFlavor; + @Override public String getConsensusFlavor() { return this.consensusFlavor; }
private int consensusMethod; + @Override public int getConsensusMethod() { return this.consensusMethod; }
private long validAfterMillis; + @Override public long getValidAfterMillis() { return this.validAfterMillis; }
private long freshUntilMillis; + @Override public long getFreshUntilMillis() { return this.freshUntilMillis; }
private long validUntilMillis; + @Override public long getValidUntilMillis() { return this.validUntilMillis; }
private long voteSeconds; + @Override public long getVoteSeconds() { return this.voteSeconds; }
private long distSeconds; + @Override public long getDistSeconds() { return this.distSeconds; }
private String[] recommendedClientVersions; + @Override public List<String> getRecommendedClientVersions() { return this.recommendedClientVersions == null ? null : Arrays.asList(this.recommendedClientVersions); }
private String[] recommendedServerVersions; + @Override public List<String> getRecommendedServerVersions() { return this.recommendedServerVersions == null ? null : Arrays.asList(this.recommendedServerVersions); }
private List<String> packageLines; + @Override public List<String> getPackageLines() { return this.packageLines == null ? null : new ArrayList<>(this.packageLines); }
private String[] knownFlags; + @Override public SortedSet<String> getKnownFlags() { return new TreeSet<>(Arrays.asList(this.knownFlags)); }
private SortedMap<String, Integer> consensusParams; + @Override public SortedMap<String, Integer> getConsensusParams() { return this.consensusParams == null ? null: new TreeMap<>(this.consensusParams); }
private SortedMap<String, Integer> bandwidthWeights; + @Override public SortedMap<String, Integer> getBandwidthWeights() { return this.bandwidthWeights == null ? null : new TreeMap<>(this.bandwidthWeights); diff --git a/src/org/torproject/descriptor/impl/RelayNetworkStatusImpl.java b/src/org/torproject/descriptor/impl/RelayNetworkStatusImpl.java index 9ac3284..a5469db 100644 --- a/src/org/torproject/descriptor/impl/RelayNetworkStatusImpl.java +++ b/src/org/torproject/descriptor/impl/RelayNetworkStatusImpl.java @@ -296,73 +296,87 @@ public class RelayNetworkStatusImpl extends NetworkStatusImpl }
private String statusDigest; + @Override public String getStatusDigest() { return this.statusDigest; }
private int networkStatusVersion; + @Override public int getNetworkStatusVersion() { return this.networkStatusVersion; }
private String hostname; + @Override public String getHostname() { return this.hostname; }
private String address; + @Override public String getAddress() { return this.address; }
private int dirPort; + @Override public int getDirport() { return this.dirPort; }
private String fingerprint; + @Override public String getFingerprint() { return this.fingerprint; }
private String contactLine; + @Override public String getContactLine() { return this.contactLine; }
private String dirSigningKey; + @Override public String getDirSigningKey() { return this.dirSigningKey; }
private String[] recommendedClientVersions; + @Override public List<String> getRecommendedClientVersions() { return this.recommendedClientVersions == null ? null : Arrays.asList(this.recommendedClientVersions); }
private String[] recommendedServerVersions; + @Override public List<String> getRecommendedServerVersions() { return this.recommendedServerVersions == null ? null : Arrays.asList(this.recommendedServerVersions); }
private long publishedMillis; + @Override public long getPublishedMillis() { return this.publishedMillis; }
private String[] dirOptions; + @Override public SortedSet<String> getDirOptions() { return new TreeSet<>(Arrays.asList(this.dirOptions)); }
private String nickname; + @Override public String getNickname() { return this.nickname; }
private String directorySignature; + @Override public String getDirectorySignature() { return this.directorySignature; } diff --git a/src/org/torproject/descriptor/impl/RelayNetworkStatusVoteImpl.java b/src/org/torproject/descriptor/impl/RelayNetworkStatusVoteImpl.java index f378a79..d9bdd3c 100644 --- a/src/org/torproject/descriptor/impl/RelayNetworkStatusVoteImpl.java +++ b/src/org/torproject/descriptor/impl/RelayNetworkStatusVoteImpl.java @@ -513,80 +513,96 @@ public class RelayNetworkStatusVoteImpl extends NetworkStatusImpl }
private String nickname; + @Override public String getNickname() { return this.nickname; }
private String identity; + @Override public String getIdentity() { return this.identity; }
private String hostname; + @Override public String getHostname() { return this.hostname; }
private String address; + @Override public String getAddress() { return this.address; }
private int dirPort; + @Override public int getDirport() { return this.dirPort; }
private int orPort; + @Override public int getOrport() { return this.orPort; }
private String contactLine; + @Override public String getContactLine() { return this.contactLine; }
private int dirKeyCertificateVersion; + @Override public int getDirKeyCertificateVersion() { return this.dirKeyCertificateVersion; }
private String legacyDirKey; + @Override public String getLegacyDirKey() { return this.legacyDirKey; }
private long dirKeyPublishedMillis; + @Override public long getDirKeyPublishedMillis() { return this.dirKeyPublishedMillis; }
private long dirKeyExpiresMillis; + @Override public long getDirKeyExpiresMillis() { return this.dirKeyExpiresMillis; }
private String dirIdentityKey; + @Override public String getDirIdentityKey() { return this.dirIdentityKey; }
private String dirSigningKey; + @Override public String getDirSigningKey() { return this.dirSigningKey; }
private String dirKeyCrosscert; + @Override public String getDirKeyCrosscert() { return this.dirKeyCrosscert; }
private String dirKeyCertification; + @Override public String getDirKeyCertification() { return this.dirKeyCertification; }
+ @Override public String getSigningKeyDigest() { String signingKeyDigest = null; if (!this.directorySignatures.isEmpty()) { @@ -597,115 +613,137 @@ public class RelayNetworkStatusVoteImpl extends NetworkStatusImpl }
private int networkStatusVersion; + @Override public int getNetworkStatusVersion() { return this.networkStatusVersion; }
private Integer[] consensusMethods; + @Override public List<Integer> getConsensusMethods() { return this.consensusMethods == null ? null : Arrays.asList(this.consensusMethods); }
private long publishedMillis; + @Override public long getPublishedMillis() { return this.publishedMillis; }
private long validAfterMillis; + @Override public long getValidAfterMillis() { return this.validAfterMillis; }
private long freshUntilMillis; + @Override public long getFreshUntilMillis() { return this.freshUntilMillis; }
private long validUntilMillis; + @Override public long getValidUntilMillis() { return this.validUntilMillis; }
private long voteSeconds; + @Override public long getVoteSeconds() { return this.voteSeconds; }
private long distSeconds; + @Override public long getDistSeconds() { return this.distSeconds; }
private String[] recommendedClientVersions; + @Override public List<String> getRecommendedClientVersions() { return this.recommendedClientVersions == null ? null : Arrays.asList(this.recommendedClientVersions); }
private String[] recommendedServerVersions; + @Override public List<String> getRecommendedServerVersions() { return this.recommendedServerVersions == null ? null : Arrays.asList(this.recommendedServerVersions); }
private List<String> packageLines; + @Override public List<String> getPackageLines() { return this.packageLines == null ? null : new ArrayList<>(this.packageLines); }
private String[] knownFlags; + @Override public SortedSet<String> getKnownFlags() { return new TreeSet<>(Arrays.asList(this.knownFlags)); }
private long stableUptime; + @Override public long getStableUptime() { return this.stableUptime; }
private long stableMtbf; + @Override public long getStableMtbf() { return this.stableMtbf; }
private long fastBandwidth; + @Override public long getFastBandwidth() { return this.fastBandwidth; }
private double guardWfu; + @Override public double getGuardWfu() { return this.guardWfu; }
private long guardTk; + @Override public long getGuardTk() { return this.guardTk; }
private long guardBandwidthIncludingExits; + @Override public long getGuardBandwidthIncludingExits() { return this.guardBandwidthIncludingExits; }
private long guardBandwidthExcludingExits; + @Override public long getGuardBandwidthExcludingExits() { return this.guardBandwidthExcludingExits; }
private int enoughMtbfInfo; + @Override public int getEnoughMtbfInfo() { return this.enoughMtbfInfo; }
private int ignoringAdvertisedBws; + @Override public int getIgnoringAdvertisedBws() { return this.ignoringAdvertisedBws; }
private SortedMap<String, Integer> consensusParams; + @Override public SortedMap<String, Integer> getConsensusParams() { return this.consensusParams == null ? null: new TreeMap<>(this.consensusParams); diff --git a/src/org/torproject/descriptor/impl/RouterStatusEntryImpl.java b/src/org/torproject/descriptor/impl/RouterStatusEntryImpl.java index c6942e8..a359c50 100644 --- a/src/org/torproject/descriptor/impl/RouterStatusEntryImpl.java +++ b/src/org/torproject/descriptor/impl/RouterStatusEntryImpl.java @@ -15,21 +15,25 @@ public class RouterStatusEntryImpl implements RouterStatusEntry { }
private String nickname; + @Override public String getNickname() { return this.nickname; }
private String fingerprint; + @Override public String getFingerprint() { return this.fingerprint; }
private boolean isLive; + @Override public boolean isLive() { return this.isLive; }
private boolean isVerified; + @Override public boolean isVerified() { return this.isVerified; } diff --git a/src/org/torproject/descriptor/impl/ServerDescriptorImpl.java b/src/org/torproject/descriptor/impl/ServerDescriptorImpl.java index 8b6e983..aa9cc02 100644 --- a/src/org/torproject/descriptor/impl/ServerDescriptorImpl.java +++ b/src/org/torproject/descriptor/impl/ServerDescriptorImpl.java @@ -715,210 +715,251 @@ public abstract class ServerDescriptorImpl extends DescriptorImpl }
private String serverDescriptorDigest; + @Override public String getServerDescriptorDigest() { return this.serverDescriptorDigest; }
private String serverDescriptorDigestSha256; + @Override public String getServerDescriptorDigestSha256() { return this.serverDescriptorDigestSha256; }
private String nickname; + @Override public String getNickname() { return this.nickname; }
private String address; + @Override public String getAddress() { return this.address; }
private int orPort; + @Override public int getOrPort() { return this.orPort; }
private int socksPort; + @Override public int getSocksPort() { return this.socksPort; }
private int dirPort; + @Override public int getDirPort() { return this.dirPort; }
private List<String> orAddresses = new ArrayList<>(); + @Override public List<String> getOrAddresses() { return new ArrayList<>(this.orAddresses); }
private int bandwidthRate; + @Override public int getBandwidthRate() { return this.bandwidthRate; }
private int bandwidthBurst; + @Override public int getBandwidthBurst() { return this.bandwidthBurst; }
private int bandwidthObserved; + @Override public int getBandwidthObserved() { return this.bandwidthObserved; }
private String platform; + @Override public String getPlatform() { return this.platform; }
private long publishedMillis; + @Override public long getPublishedMillis() { return this.publishedMillis; }
private String fingerprint; + @Override public String getFingerprint() { return this.fingerprint; }
private boolean hibernating; + @Override public boolean isHibernating() { return this.hibernating; }
private Long uptime; + @Override public Long getUptime() { return this.uptime; }
private String onionKey; + @Override public String getOnionKey() { return this.onionKey; }
private String signingKey; + @Override public String getSigningKey() { return this.signingKey; }
private List<String> exitPolicyLines = new ArrayList<>(); + @Override public List<String> getExitPolicyLines() { return new ArrayList<>(this.exitPolicyLines); }
private String routerSignature; + @Override public String getRouterSignature() { return this.routerSignature; }
private String contact; + @Override public String getContact() { return this.contact; }
private String[] familyEntries; + @Override public List<String> getFamilyEntries() { return this.familyEntries == null ? null : Arrays.asList(this.familyEntries); }
private BandwidthHistory readHistory; + @Override public BandwidthHistory getReadHistory() { return this.readHistory; }
private BandwidthHistory writeHistory; + @Override public BandwidthHistory getWriteHistory() { return this.writeHistory; }
private boolean usesEnhancedDnsLogic; + @Override public boolean getUsesEnhancedDnsLogic() { return this.usesEnhancedDnsLogic; }
private boolean cachesExtraInfo; + @Override public boolean getCachesExtraInfo() { return this.cachesExtraInfo; }
private String extraInfoDigest; + @Override public String getExtraInfoDigest() { return this.extraInfoDigest; }
private String extraInfoDigestSha256; + @Override public String getExtraInfoDigestSha256() { return this.extraInfoDigestSha256; }
private Integer[] hiddenServiceDirVersions; + @Override public List<Integer> getHiddenServiceDirVersions() { return this.hiddenServiceDirVersions == null ? null : Arrays.asList(this.hiddenServiceDirVersions); }
private Integer[] linkProtocolVersions; + @Override public List<Integer> getLinkProtocolVersions() { return this.linkProtocolVersions == null ? null : Arrays.asList(this.linkProtocolVersions); }
private Integer[] circuitProtocolVersions; + @Override public List<Integer> getCircuitProtocolVersions() { return this.circuitProtocolVersions == null ? null : Arrays.asList(this.circuitProtocolVersions); }
private boolean allowSingleHopExits; + @Override public boolean getAllowSingleHopExits() { return this.allowSingleHopExits; }
private String ipv6DefaultPolicy; + @Override public String getIpv6DefaultPolicy() { return this.ipv6DefaultPolicy; }
private String ipv6PortList; + @Override public String getIpv6PortList() { return this.ipv6PortList; }
private String ntorOnionKey; + @Override public String getNtorOnionKey() { return this.ntorOnionKey; }
private String identityEd25519; + @Override public String getIdentityEd25519() { return this.identityEd25519; }
private String masterKeyEd25519; + @Override public String getMasterKeyEd25519() { return this.masterKeyEd25519; }
private String routerSignatureEd25519; + @Override public String getRouterSignatureEd25519() { return this.routerSignatureEd25519; }
private String onionKeyCrosscert; + @Override public String getOnionKeyCrosscert() { return this.onionKeyCrosscert; }
private String ntorOnionKeyCrosscert; + @Override public String getNtorOnionKeyCrosscert() { return this.ntorOnionKeyCrosscert; }
private int ntorOnionKeyCrosscertSign = -1; + @Override public int getNtorOnionKeyCrosscertSign() { return ntorOnionKeyCrosscertSign; } diff --git a/src/org/torproject/descriptor/impl/TorperfResultImpl.java b/src/org/torproject/descriptor/impl/TorperfResultImpl.java index 62cf68d..0800de0 100644 --- a/src/org/torproject/descriptor/impl/TorperfResultImpl.java +++ b/src/org/torproject/descriptor/impl/TorperfResultImpl.java @@ -18,7 +18,7 @@ import org.torproject.descriptor.TorperfResult; public class TorperfResultImpl extends DescriptorImpl implements TorperfResult {
- public static List<Descriptor> parseTorperfResults( + protected static List<Descriptor> parseTorperfResults( byte[] rawDescriptorBytes, boolean failUnrecognizedDescriptorLines) throws DescriptorParseException { if (rawDescriptorBytes.length == 0) { @@ -397,124 +397,148 @@ public class TorperfResultImpl extends DescriptorImpl }
private SortedMap<String, String> unrecognizedKeys; + @Override public SortedMap<String, String> getUnrecognizedKeys() { return this.unrecognizedKeys == null ? null : new TreeMap<>(this.unrecognizedKeys); }
private String source; + @Override public String getSource() { return this.source; }
private int fileSize; + @Override public int getFileSize() { return this.fileSize; }
private long startMillis; + @Override public long getStartMillis() { return this.startMillis; }
private long socketMillis; + @Override public long getSocketMillis() { return this.socketMillis; }
private long connectMillis; + @Override public long getConnectMillis() { return this.connectMillis; }
private long negotiateMillis; + @Override public long getNegotiateMillis() { return this.negotiateMillis; }
private long requestMillis; + @Override public long getRequestMillis() { return this.requestMillis; }
private long responseMillis; + @Override public long getResponseMillis() { return this.responseMillis; }
private long dataRequestMillis; + @Override public long getDataRequestMillis() { return this.dataRequestMillis; }
private long dataResponseMillis; + @Override public long getDataResponseMillis() { return this.dataResponseMillis; }
private long dataCompleteMillis; + @Override public long getDataCompleteMillis() { return this.dataCompleteMillis; }
private int writeBytes; + @Override public int getWriteBytes() { return this.writeBytes; }
private int readBytes; + @Override public int getReadBytes() { return this.readBytes; }
private boolean didTimeout; + @Override public Boolean didTimeout() { return this.didTimeout; }
private SortedMap<Integer, Long> dataPercentiles; + @Override public SortedMap<Integer, Long> getDataPercentiles() { return this.dataPercentiles == null ? null : new TreeMap<>(this.dataPercentiles); }
private long launchMillis = -1L; + @Override public long getLaunchMillis() { return this.launchMillis; }
private long usedAtMillis = -1L; + @Override public long getUsedAtMillis() { return this.usedAtMillis; }
private String[] path; + @Override public List<String> getPath() { return this.path == null ? null : Arrays.asList(this.path); }
private Long[] buildTimes; + @Override public List<Long> getBuildTimes() { return this.buildTimes == null ? null : Arrays.asList(this.buildTimes); }
private long timeout = -1L; + @Override public long getTimeout() { return this.timeout; }
private double quantile = -1.0; + @Override public double getQuantile() { return this.quantile; }
private int circId = -1; + @Override public int getCircId() { return this.circId; }
private int usedBy = -1; + @Override public int getUsedBy() { return this.usedBy; }