Util: Add ability to force using IPv6 for SSLEepGet

This commit is contained in:
zzz
2025-04-25 07:05:47 -04:00
parent 5a4752e4df
commit c60e748a24
2 changed files with 18 additions and 4 deletions

View File

@ -573,7 +573,18 @@ public class SSLEepGet extends EepGet {
* @since 0.9.49
*/
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
@ -768,7 +779,7 @@ public class SSLEepGet extends EepGet {
boolean useDNSOverHTTPS;
if (_forceDoH == 1 || _shouldProxy)
useDNSOverHTTPS = false;
else if (_forceDoH == 2)
else if (_forceDoH >= 2)
useDNSOverHTTPS = true;
else
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;
if (useDNSOverHTTPS && !host.equals("dns.google") && !Addresses.isIPAddress(host)) {
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) {
// will be used below
if (_log.shouldDebug())

View File

@ -20,7 +20,7 @@ public class RouterVersion {
public final static String VERSION = CoreVersion.VERSION;
/** for example: "beta", "alpha", "rc" */
public final static String QUALIFIER = "";
public final static long BUILD = 5;
public final static long BUILD = 6;
/** for example "-test" */
public final static String EXTRA = "";
public final static String FULL_VERSION = VERSION + "-" + BUILD + QUALIFIER + EXTRA;