public class DNSOverHTTPS extends Object implements EepGet.StatusListener
| Modifier and Type | Class and Description |
|---|---|
static class |
DNSOverHTTPS.Type
DNS query type for IPv4/IPv6 preference.
|
| Modifier and Type | Field and Description |
|---|---|
static String |
UA_CLEARNET
ESR version of Firefox, same as Tor Browser
|
| Constructor and Description |
|---|
DNSOverHTTPS(I2PAppContext context) |
DNSOverHTTPS(I2PAppContext context,
SSLEepGet.SSLState sslState) |
| Modifier and Type | Method and Description |
|---|---|
void |
attemptFailed(String url,
long bytesTransferred,
long bytesRemaining,
int currentAttempt,
int numRetries,
Exception cause) |
void |
attempting(String url) |
void |
bytesTransferred(long alreadyTransferred,
int currentWrite,
long bytesTransferred,
long bytesRemaining,
String url)
Total length should be == alreadyTransferred + currentWrite + bytesRemaining for all calls
|
static void |
clearCaches() |
void |
headerReceived(String url,
int attemptNum,
String key,
String val)
Use the Date header as a backup time source.
|
String |
lookup(String host)
V4_ONLY unless we have only IPv6 address, then V6_ONLY
|
String |
lookup(String host,
DNSOverHTTPS.Type type)
Lookup in cache, then query servers
|
static void |
main(String[] args) |
void |
transferComplete(long alreadyTransferred,
long bytesTransferred,
long bytesRemaining,
String url,
String outputFile,
boolean notModified) |
void |
transferFailed(String url,
long bytesTransferred,
long bytesRemaining,
int currentAttempt) |
public static final String UA_CLEARNET
public DNSOverHTTPS(I2PAppContext context)
public DNSOverHTTPS(I2PAppContext context, SSLEepGet.SSLState sslState)
public void attemptFailed(String url, long bytesTransferred, long bytesRemaining, int currentAttempt, int numRetries, Exception cause)
attemptFailed in interface EepGet.StatusListenerEepGet.StatusListener.bytesTransferred(long, int, long, long, java.lang.String)public void attempting(String url)
attempting in interface EepGet.StatusListenerpublic void bytesTransferred(long alreadyTransferred,
int currentWrite,
long bytesTransferred,
long bytesRemaining,
String url)
EepGet.StatusListenerbytesTransferred in interface EepGet.StatusListeneralreadyTransferred - total of all attempts, not including currentWrite
If nonzero on the first call, a partial file of that length was found,
_and_ the server supports resume.
If zero on a subsequent call after some bytes are transferred
(and presumably after an attemptFailed), the server does _not_
support resume and we had to start over.
To track _actual_ transfer if the output file could already exist,
the listener should keep its own counter,
or subtract the initial alreadyTransferred value.
And watch out for alreadyTransferred resetting if a resume failed...currentWrite - since last call to the listenerbytesTransferred - includes headers, retries, redirects, discarded partial downloads, ...bytesRemaining - on this attempt only, currentWrite already subtracted -
or -1 if chunked encoding or server does not return a lengthpublic static void clearCaches()
public void headerReceived(String url, int attemptNum, String key, String val)
headerReceived in interface EepGet.StatusListenerpublic String lookup(String host)
public String lookup(String host, DNSOverHTTPS.Type type)
public static void main(String[] args)
public void transferComplete(long alreadyTransferred,
long bytesTransferred,
long bytesRemaining,
String url,
String outputFile,
boolean notModified)
transferComplete in interface EepGet.StatusListeneroutputFile - null if unknown (output stream constructor)EepGet.StatusListener.bytesTransferred(long, int, long, long, java.lang.String)public void transferFailed(String url, long bytesTransferred, long bytesRemaining, int currentAttempt)
transferFailed in interface EepGet.StatusListenerEepGet.StatusListener.bytesTransferred(long, int, long, long, java.lang.String)