gecko-dev/netwerk/dns/nsIDNSRecord.idl
Daniel Stenberg e5d3226694 bug 1434852 - introducing TRR (DOH); r=mcmanus,valentin
Provides an optional resolver mechanism for Firefox that allows running
together with or instead of the native resolver.

TRR offers resolving of host names using a dedicated DNS-over-HTTPS server
(HTTPS is required, HTTP/2 is preferable).

DNS-over-HTTPS (DOH) allows DNS resolves with enhanced privacy, secure
transfers and improved performance.

To keep the failure rate at a minimum, the TRR system manages a dynamic
persistent blacklist for host names that can't be resolved with DOH but works
with the native resolver. Blacklisted entries will not be retried over DOH for
a couple of days. "localhost" and names in the ".local" TLD will not be
resolved via DOH.

TRR is preffed OFF by default and you need to set a URI for an available DOH
server to be able to use it. Since the URI for DOH is set with a name itself,
it may have to use the native resolver for bootstrapping. (Optionally, the
user can set the IP address of the DOH server in a pref to avoid the required
initial native resolve.)

When TRR starts up, it will first verify that it works by checking a
"confirmation" domain name. This confirmation domain is a pref by default set
to "example.com". TRR will also by default await the captive-portal detection
to raise its green flag before getting activated.

All prefs for TRR are under the "network.trr" hierarchy.

The DNS-over-HTTPS spec: https://tools.ietf.org/html/draft-ietf-doh-dns-over-https-03

MozReview-Commit-ID: GuuU6vjTjlm

--HG--
extra : rebase_source : 53fcca757334090ac05fec540ef29d109d5ceed3
2018-02-01 10:20:49 +01:00

106 lines
3.1 KiB
Plaintext

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsISupports.idl"
%{ C++
namespace mozilla {
namespace net {
union NetAddr;
}
}
#include "nsTArrayForwardDeclare.h"
%}
native NetAddr(mozilla::net::NetAddr);
[ref] native nsNetAddrTArrayRef(nsTArray<mozilla::net::NetAddr>);
interface nsINetAddr;
/**
* nsIDNSRecord
*
* this interface represents the result of a DNS lookup. since a DNS
* query may return more than one resolved IP address, the record acts
* like an enumerator, allowing the caller to easily step through the
* list of IP addresses.
*/
[scriptable, uuid(f92228ae-c417-4188-a604-0830a95e7eb9)]
interface nsIDNSRecord : nsISupports
{
/**
* @return the canonical hostname for this record. this value is empty if
* the record was not fetched with the RESOLVE_CANONICAL_NAME flag.
*
* e.g., www.mozilla.org --> rheet.mozilla.org
*/
readonly attribute ACString canonicalName;
/**
* this function copies the value of the next IP address into the
* given NetAddr struct and increments the internal address iterator.
*
* @param aPort
* A port number to initialize the NetAddr with.
*
* @throws NS_ERROR_NOT_AVAILABLE if there is not another IP address in
* the record.
*/
[noscript] NetAddr getNextAddr(in uint16_t aPort);
/**
* this function copies the value of all working members of the RR
* set into the output array.
*
* @param aAddressArray
* The result set
*/
[noscript] void getAddresses(out nsNetAddrTArrayRef aAddressArray);
/**
* this function returns the value of the next IP address as a
* scriptable address and increments the internal address iterator.
*
* @param aPort
* A port number to initialize the nsINetAddr with.
*
* @throws NS_ERROR_NOT_AVAILABLE if there is not another IP address in
* the record.
*/
nsINetAddr getScriptableNextAddr(in uint16_t aPort);
/**
* this function returns the value of the next IP address as a
* string and increments the internal address iterator.
*
* @throws NS_ERROR_NOT_AVAILABLE if there is not another IP address in
* the record.
*/
ACString getNextAddrAsString();
/**
* this function returns true if there is another address in the record.
*/
boolean hasMore();
/**
* this function resets the internal address iterator to the first
* address in the record.
*/
void rewind();
/**
* This function indicates that the last address obtained via getNextAddr*()
* was not usuable and should be skipped in future uses of this
* record if other addresses are available.
*
* @param aPort is the port number associated with the failure, if any.
* It may be zero if not applicable.
*/
void reportUnusable(in uint16_t aPort);
/**
* Record retreived with TRR.
*/
bool IsTRR();
};