forked from I2P_Developers/i2p.i2p
Util: Add ability to force using IPv6 for SSLEepGet
This commit is contained in:
@ -573,7 +573,18 @@ public class SSLEepGet extends EepGet {
|
|||||||
* @since 0.9.49
|
* @since 0.9.49
|
||||||
*/
|
*/
|
||||||
public void forceDNSOverHTTPS(boolean on) {
|
public void forceDNSOverHTTPS(boolean on) {
|
||||||
_forceDoH = on ? 2 : 1;
|
forceDNSOverHTTPS(on, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Override the config setting, force DNSoverHTTPS on or off
|
||||||
|
* Call before the fetch.
|
||||||
|
* @param forceIPv6 use IPv6 for BOTH the connection to the DoH server
|
||||||
|
* AND for the queried address. on must be true.
|
||||||
|
* @since 0.9.66
|
||||||
|
*/
|
||||||
|
public void forceDNSOverHTTPS(boolean on, boolean forceIPv6) {
|
||||||
|
_forceDoH = on ? (forceIPv6 ? 3 : 2) : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
///// end of all the SSL stuff
|
///// end of all the SSL stuff
|
||||||
@ -768,7 +779,7 @@ public class SSLEepGet extends EepGet {
|
|||||||
boolean useDNSOverHTTPS;
|
boolean useDNSOverHTTPS;
|
||||||
if (_forceDoH == 1 || _shouldProxy)
|
if (_forceDoH == 1 || _shouldProxy)
|
||||||
useDNSOverHTTPS = false;
|
useDNSOverHTTPS = false;
|
||||||
else if (_forceDoH == 2)
|
else if (_forceDoH >= 2)
|
||||||
useDNSOverHTTPS = true;
|
useDNSOverHTTPS = true;
|
||||||
else
|
else
|
||||||
useDNSOverHTTPS = _context.getProperty(PROP_USE_DNS_OVER_HTTPS, DEFAULT_USE_DNS_OVER_HTTPS);
|
useDNSOverHTTPS = _context.getProperty(PROP_USE_DNS_OVER_HTTPS, DEFAULT_USE_DNS_OVER_HTTPS);
|
||||||
@ -777,7 +788,10 @@ public class SSLEepGet extends EepGet {
|
|||||||
String ip = null;
|
String ip = null;
|
||||||
if (useDNSOverHTTPS && !host.equals("dns.google") && !Addresses.isIPAddress(host)) {
|
if (useDNSOverHTTPS && !host.equals("dns.google") && !Addresses.isIPAddress(host)) {
|
||||||
DNSOverHTTPS doh = new DNSOverHTTPS(_context, getSSLState());
|
DNSOverHTTPS doh = new DNSOverHTTPS(_context, getSSLState());
|
||||||
ip = doh.lookup(host);
|
if (_forceDoH == 3)
|
||||||
|
ip = doh.lookup(host, DNSOverHTTPS.Type.V6_ONLY);
|
||||||
|
else
|
||||||
|
ip = doh.lookup(host);
|
||||||
if (ip != null) {
|
if (ip != null) {
|
||||||
// will be used below
|
// will be used below
|
||||||
if (_log.shouldDebug())
|
if (_log.shouldDebug())
|
||||||
|
@ -20,7 +20,7 @@ public class RouterVersion {
|
|||||||
public final static String VERSION = CoreVersion.VERSION;
|
public final static String VERSION = CoreVersion.VERSION;
|
||||||
/** for example: "beta", "alpha", "rc" */
|
/** for example: "beta", "alpha", "rc" */
|
||||||
public final static String QUALIFIER = "";
|
public final static String QUALIFIER = "";
|
||||||
public final static long BUILD = 5;
|
public final static long BUILD = 6;
|
||||||
/** for example "-test" */
|
/** for example "-test" */
|
||||||
public final static String EXTRA = "";
|
public final static String EXTRA = "";
|
||||||
public final static String FULL_VERSION = VERSION + "-" + BUILD + QUALIFIER + EXTRA;
|
public final static String FULL_VERSION = VERSION + "-" + BUILD + QUALIFIER + EXTRA;
|
||||||
|
Reference in New Issue
Block a user