зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1652106 - Rename esniconfig to echconfig and add HTTPS RR type r=kershaw,necko-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D85836
This commit is contained in:
Родитель
5a005b7b24
Коммит
6680c6fb12
|
@ -165,8 +165,8 @@ struct IPDLParamTraits<mozilla::net::SvcParamIpv4Hint> {
|
|||
};
|
||||
|
||||
template <>
|
||||
struct IPDLParamTraits<mozilla::net::SvcParamEsniConfig> {
|
||||
typedef mozilla::net::SvcParamEsniConfig paramType;
|
||||
struct IPDLParamTraits<mozilla::net::SvcParamEchConfig> {
|
||||
typedef mozilla::net::SvcParamEchConfig paramType;
|
||||
static void Write(IPC::Message* aMsg, IProtocol* aActor,
|
||||
const paramType& aParam) {
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mValue);
|
||||
|
@ -218,4 +218,4 @@ struct IPDLParamTraits<mozilla::net::SvcFieldValue> {
|
|||
} // namespace ipc
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // DNSByTypeRecord_h__
|
||||
#endif // DNSByTypeRecord_h__
|
||||
|
|
|
@ -16,7 +16,7 @@ class SvcParam : public nsISVCParam,
|
|||
public nsISVCParamNoDefaultAlpn,
|
||||
public nsISVCParamPort,
|
||||
public nsISVCParamIPv4Hint,
|
||||
public nsISVCParamEsniConfig,
|
||||
public nsISVCParamEchConfig,
|
||||
public nsISVCParamIPv6Hint {
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
NS_DECL_NSISVCPARAM
|
||||
|
@ -24,7 +24,7 @@ class SvcParam : public nsISVCParam,
|
|||
NS_DECL_NSISVCPARAMNODEFAULTALPN
|
||||
NS_DECL_NSISVCPARAMPORT
|
||||
NS_DECL_NSISVCPARAMIPV4HINT
|
||||
NS_DECL_NSISVCPARAMESNICONFIG
|
||||
NS_DECL_NSISVCPARAMECHCONFIG
|
||||
NS_DECL_NSISVCPARAMIPV6HINT
|
||||
public:
|
||||
explicit SvcParam(const SvcParamType& value) : mValue(value){};
|
||||
|
@ -45,8 +45,8 @@ NS_INTERFACE_MAP_BEGIN(SvcParam)
|
|||
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsISVCParamPort, mValue.is<SvcParamPort>())
|
||||
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsISVCParamIPv4Hint,
|
||||
mValue.is<SvcParamIpv4Hint>())
|
||||
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsISVCParamEsniConfig,
|
||||
mValue.is<SvcParamEsniConfig>())
|
||||
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsISVCParamEchConfig,
|
||||
mValue.is<SvcParamEchConfig>())
|
||||
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsISVCParamIPv6Hint,
|
||||
mValue.is<SvcParamIpv6Hint>())
|
||||
NS_INTERFACE_MAP_END
|
||||
|
@ -59,7 +59,7 @@ SvcParam::GetType(uint16_t* aType) {
|
|||
[](SvcParamNoDefaultAlpn&) { return SvcParamKeyNoDefaultAlpn; },
|
||||
[](SvcParamPort&) { return SvcParamKeyPort; },
|
||||
[](SvcParamIpv4Hint&) { return SvcParamKeyIpv4Hint; },
|
||||
[](SvcParamEsniConfig&) { return SvcParamKeyEsniConfig; },
|
||||
[](SvcParamEchConfig&) { return SvcParamKeyEchConfig; },
|
||||
[](SvcParamIpv6Hint&) { return SvcParamKeyIpv6Hint; });
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -85,12 +85,12 @@ SvcParam::GetPort(uint16_t* aPort) {
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
SvcParam::GetEsniConfig(nsACString& aEsniConfig) {
|
||||
if (!mValue.is<SvcParamEsniConfig>()) {
|
||||
SvcParam::GetEchconfig(nsACString& aEchConfig) {
|
||||
if (!mValue.is<SvcParamEchConfig>()) {
|
||||
MOZ_ASSERT(false, "Unexpected type for variant");
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
aEsniConfig = mValue.as<SvcParamEsniConfig>().mValue;
|
||||
aEchConfig = mValue.as<SvcParamEchConfig>().mValue;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ enum SvcParamKey : uint16_t {
|
|||
SvcParamKeyNoDefaultAlpn = 2,
|
||||
SvcParamKeyPort = 3,
|
||||
SvcParamKeyIpv4Hint = 4,
|
||||
SvcParamKeyEsniConfig = 5,
|
||||
SvcParamKeyEchConfig = 5,
|
||||
SvcParamKeyIpv6Hint = 6,
|
||||
|
||||
SvcParamKeyLast = SvcParamKeyIpv6Hint
|
||||
|
@ -50,8 +50,8 @@ struct SvcParamIpv4Hint {
|
|||
CopyableTArray<mozilla::net::NetAddr> mValue;
|
||||
};
|
||||
|
||||
struct SvcParamEsniConfig {
|
||||
bool operator==(const SvcParamEsniConfig& aOther) const {
|
||||
struct SvcParamEchConfig {
|
||||
bool operator==(const SvcParamEchConfig& aOther) const {
|
||||
return mValue == aOther.mValue;
|
||||
}
|
||||
nsCString mValue;
|
||||
|
@ -66,7 +66,7 @@ struct SvcParamIpv6Hint {
|
|||
|
||||
using SvcParamType =
|
||||
mozilla::Variant<Nothing, SvcParamAlpn, SvcParamNoDefaultAlpn, SvcParamPort,
|
||||
SvcParamIpv4Hint, SvcParamEsniConfig, SvcParamIpv6Hint>;
|
||||
SvcParamIpv4Hint, SvcParamEchConfig, SvcParamIpv6Hint>;
|
||||
|
||||
struct SvcFieldValue {
|
||||
bool operator==(const SvcFieldValue& aOther) const {
|
||||
|
|
|
@ -1233,8 +1233,8 @@ nsresult TRR::ParseSvcParam(unsigned int svcbIndex, uint16_t key,
|
|||
}
|
||||
break;
|
||||
}
|
||||
case SvcParamKeyEsniConfig: {
|
||||
field.mValue = AsVariant(SvcParamEsniConfig{
|
||||
case SvcParamKeyEchConfig: {
|
||||
field.mValue = AsVariant(SvcParamEchConfig{
|
||||
.mValue = nsCString((const char*)(&mResponse[svcbIndex]), length)});
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ enum TrrType {
|
|||
TRRTYPE_CNAME = 5,
|
||||
TRRTYPE_AAAA = 28,
|
||||
TRRTYPE_TXT = 16,
|
||||
TRRTYPE_HTTPSSVC = 65345,
|
||||
TRRTYPE_HTTPSSVC = nsIDNSService::RESOLVE_TYPE_HTTPSSVC, // 65
|
||||
};
|
||||
|
||||
class DOHaddr : public LinkedListElement<DOHaddr> {
|
||||
|
|
|
@ -73,8 +73,8 @@ interface nsISVCParamIPv4Hint : nsISupports {
|
|||
};
|
||||
|
||||
[scriptable, uuid(1f31e41d-b6d8-4796-b12a-82ef8d2b0e43)]
|
||||
interface nsISVCParamEsniConfig : nsISupports {
|
||||
readonly attribute ACString esniConfig;
|
||||
interface nsISVCParamEchConfig : nsISupports {
|
||||
readonly attribute ACString echconfig;
|
||||
};
|
||||
|
||||
[scriptable, uuid(5100bce4-9d3b-42e1-a3c9-0f386bbc9dad)]
|
||||
|
|
|
@ -411,13 +411,13 @@ interface nsIDNSService : nsISupports
|
|||
const unsigned long RESOLVE_IGNORE_SOCKS_DNS = 1 << 13;
|
||||
|
||||
/**
|
||||
* This ure dns request types that are currently supported.
|
||||
* These are the dns request types that are currently supported.
|
||||
* RESOLVE_TYPE_DEFAULT is standard A/AAAA lookup
|
||||
* The others (currently only TXT supported) are wireformat types
|
||||
*/
|
||||
const unsigned long RESOLVE_TYPE_DEFAULT = 0;
|
||||
const unsigned long RESOLVE_TYPE_TXT = 16;
|
||||
const unsigned long RESOLVE_TYPE_HTTPSSVC = 65345;
|
||||
const unsigned long RESOLVE_TYPE_HTTPSSVC = 65;
|
||||
};
|
||||
|
||||
%{C++
|
||||
|
|
|
@ -195,6 +195,6 @@ add_task(async function testEsniHTTPSSVC() {
|
|||
Assert.equal(inRequest, request, "correct request was used");
|
||||
Assert.equal(inStatus, Cr.NS_OK, "status OK");
|
||||
let answer = inRecord.QueryInterface(Ci.nsIDNSHTTPSSVCRecord).records;
|
||||
let esni = answer[0].values[0].QueryInterface(Ci.nsISVCParamEsniConfig);
|
||||
Assert.equal(esni.esniConfig, "testytestystringstring", "got correct answer");
|
||||
let esni = answer[0].values[0].QueryInterface(Ci.nsISVCParamEchConfig);
|
||||
Assert.equal(esni.echconfig, "testytestystringstring", "got correct answer");
|
||||
});
|
||||
|
|
|
@ -154,7 +154,7 @@ add_task(async function testHTTPSSVC() {
|
|||
"got correct answer"
|
||||
);
|
||||
Assert.equal(
|
||||
answer[0].values[4].QueryInterface(Ci.nsISVCParamEsniConfig).esniConfig,
|
||||
answer[0].values[4].QueryInterface(Ci.nsISVCParamEchConfig).echconfig,
|
||||
"123...",
|
||||
"got correct answer"
|
||||
);
|
||||
|
@ -185,7 +185,7 @@ add_task(async function testHTTPSSVC() {
|
|||
"got correct answer"
|
||||
);
|
||||
Assert.equal(
|
||||
answer[1].values[2].QueryInterface(Ci.nsISVCParamEsniConfig).esniConfig,
|
||||
answer[1].values[2].QueryInterface(Ci.nsISVCParamEchConfig).echconfig,
|
||||
"abc...",
|
||||
"got correct answer"
|
||||
);
|
||||
|
@ -228,7 +228,7 @@ add_task(async function test_aliasform() {
|
|||
{
|
||||
name: "test.com",
|
||||
ttl: 55,
|
||||
type: "HTTPSSVC",
|
||||
type: "HTTPS",
|
||||
flush: false,
|
||||
data: {
|
||||
priority: 0,
|
||||
|
@ -254,7 +254,7 @@ add_task(async function test_aliasform() {
|
|||
{
|
||||
name: "x.com",
|
||||
ttl: 55,
|
||||
type: "HTTPSSVC",
|
||||
type: "HTTPS",
|
||||
flush: false,
|
||||
data: {
|
||||
priority: 0,
|
||||
|
@ -277,7 +277,7 @@ add_task(async function test_aliasform() {
|
|||
{
|
||||
name: "z.com",
|
||||
ttl: 55,
|
||||
type: "HTTPSSVC",
|
||||
type: "HTTPS",
|
||||
flush: false,
|
||||
data: {
|
||||
priority: 0,
|
||||
|
@ -303,7 +303,7 @@ add_task(async function test_aliasform() {
|
|||
{
|
||||
name: "no-ip-host.com",
|
||||
ttl: 55,
|
||||
type: "HTTPSSVC",
|
||||
type: "HTTPS",
|
||||
flush: false,
|
||||
data: {
|
||||
priority: 1,
|
||||
|
@ -313,7 +313,7 @@ add_task(async function test_aliasform() {
|
|||
{ key: "no-default-alpn" },
|
||||
{ key: "port", value: 8888 },
|
||||
{ key: "ipv4hint", value: "1.2.3.4" },
|
||||
{ key: "esniconfig", value: "123..." },
|
||||
{ key: "echconfig", value: "123..." },
|
||||
{ key: "ipv6hint", value: "::1" },
|
||||
],
|
||||
},
|
||||
|
@ -345,7 +345,7 @@ add_task(async function test_aliasform() {
|
|||
{
|
||||
name: "loop2.com",
|
||||
ttl: 55,
|
||||
type: "HTTPSSVC",
|
||||
type: "HTTPS",
|
||||
flush: false,
|
||||
data: {
|
||||
priority: 0,
|
||||
|
@ -366,7 +366,7 @@ add_task(async function test_aliasform() {
|
|||
{
|
||||
name: "empty.com",
|
||||
ttl: 55,
|
||||
type: "HTTPSSVC",
|
||||
type: "HTTPS",
|
||||
flush: false,
|
||||
data: {
|
||||
priority: 0,
|
||||
|
@ -383,11 +383,11 @@ add_task(async function test_aliasform() {
|
|||
);
|
||||
|
||||
// We should ignore ServiceForm if an AliasForm record is also present
|
||||
await trrServer.registerDoHAnswers("multi.com", "HTTPSSVC", [
|
||||
await trrServer.registerDoHAnswers("multi.com", "HTTPS", [
|
||||
{
|
||||
name: "multi.com",
|
||||
ttl: 55,
|
||||
type: "HTTPSSVC",
|
||||
type: "HTTPS",
|
||||
flush: false,
|
||||
data: {
|
||||
priority: 1,
|
||||
|
@ -397,7 +397,7 @@ add_task(async function test_aliasform() {
|
|||
{ key: "no-default-alpn" },
|
||||
{ key: "port", value: 8888 },
|
||||
{ key: "ipv4hint", value: "1.2.3.4" },
|
||||
{ key: "esniconfig", value: "123..." },
|
||||
{ key: "echconfig", value: "123..." },
|
||||
{ key: "ipv6hint", value: "::1" },
|
||||
],
|
||||
},
|
||||
|
@ -405,7 +405,7 @@ add_task(async function test_aliasform() {
|
|||
{
|
||||
name: "multi.com",
|
||||
ttl: 55,
|
||||
type: "HTTPSSVC",
|
||||
type: "HTTPS",
|
||||
flush: false,
|
||||
data: {
|
||||
priority: 0,
|
||||
|
|
|
@ -69,6 +69,6 @@ add_task(async function testEsniHTTPSSVC() {
|
|||
Assert.equal(inRequest, request, "correct request was used");
|
||||
Assert.equal(inStatus, Cr.NS_OK, "status OK");
|
||||
let answer = inRecord.QueryInterface(Ci.nsIDNSHTTPSSVCRecord).records;
|
||||
let esni = answer[0].values[0].QueryInterface(Ci.nsISVCParamEsniConfig);
|
||||
Assert.equal(esni.esniConfig, "testytestystringstring", "got correct answer");
|
||||
let esni = answer[0].values[0].QueryInterface(Ci.nsISVCParamEchConfig);
|
||||
Assert.equal(esni.echconfig, "testytestystringstring", "got correct answer");
|
||||
});
|
||||
|
|
|
@ -1280,7 +1280,7 @@ svcparam.keyToNumber = function(keyName) {
|
|||
case 'no-default-alpn' : return 2
|
||||
case 'port' : return 3
|
||||
case 'ipv4hint' : return 4
|
||||
case 'esniconfig' : return 5
|
||||
case 'echconfig' : return 5
|
||||
case 'ipv6hint' : return 6
|
||||
case 'key65535' : return 65535
|
||||
}
|
||||
|
@ -1298,7 +1298,7 @@ svcparam.numberToKeyName = function(number) {
|
|||
case 2 : return 'no-default-alpn'
|
||||
case 3 : return 'port'
|
||||
case 4 : return 'ipv4hint'
|
||||
case 5 : return 'esniconfig'
|
||||
case 5 : return 'echconfig'
|
||||
case 6 : return 'ipv6hint'
|
||||
}
|
||||
|
||||
|
@ -1349,7 +1349,7 @@ svcparam.encode = function(param, buf, offset) {
|
|||
offset += 4;
|
||||
svcparam.encode.bytes += 4;
|
||||
}
|
||||
} else if (key == 5) { //esniconfig
|
||||
} else if (key == 5) { //echconfig
|
||||
// TODO: base64 presentation format
|
||||
buf.writeUInt16BE(param.value.length, offset);
|
||||
offset += 2;
|
||||
|
@ -1408,7 +1408,7 @@ svcparam.encodingLength = function (param) {
|
|||
case 'no-default-alpn' : return 4
|
||||
case 'port' : return 4 + 2
|
||||
case 'ipv4hint' : return 4+4 * (Array.isArray(param.value) ? param.value.length : 1)
|
||||
case 'esniconfig' : return 4 + param.value.length
|
||||
case 'echconfig' : return 4 + param.value.length
|
||||
case 'ipv6hint' : return 4 + 16 * (Array.isArray(param.value) ? param.value.length : 1)
|
||||
case 'key65535' : return 4
|
||||
default: return 4 // unknown option
|
||||
|
@ -1501,7 +1501,7 @@ const renc = exports.record = function (type) {
|
|||
case 'NSEC': return rnsec
|
||||
case 'NSEC3': return rnsec3
|
||||
case 'DS': return rds
|
||||
case 'HTTPSSVC': return rhttpssvc
|
||||
case 'HTTPS': return rhttpssvc
|
||||
}
|
||||
return runknown
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ exports.toString = function (type) {
|
|||
case 251: return 'IXFR'
|
||||
case 41: return 'OPT'
|
||||
case 255: return 'ANY'
|
||||
case 65345: return 'HTTPSSVC' // TODO
|
||||
case 65: return 'HTTPS'
|
||||
}
|
||||
return 'UNKNOWN_' + type
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ exports.toType = function (name) {
|
|||
case 'IXFR': return 251
|
||||
case 'OPT': return 41
|
||||
case 'ANY': return 255
|
||||
case 'HTTPSSVC': return 65345 // TODO
|
||||
case 'HTTPS': return 65
|
||||
case '*': return 255
|
||||
}
|
||||
if (name.toUpperCase().startsWith('UNKNOWN_')) return parseInt(name.slice(8))
|
||||
|
|
|
@ -725,7 +725,7 @@ function handleRequest(req, res) {
|
|||
"hex"
|
||||
),
|
||||
});
|
||||
} else if (packet.questions[0].type == "HTTPSSVC") {
|
||||
} else if (packet.questions[0].type == "HTTPS") {
|
||||
answers.push({
|
||||
name: packet.questions[0].name,
|
||||
type: packet.questions[0].type,
|
||||
|
@ -735,7 +735,7 @@ function handleRequest(req, res) {
|
|||
data: {
|
||||
priority: 1,
|
||||
name: "some.domain.stuff.",
|
||||
values: [{ key: "esniconfig", value: "testytestystringstring" }],
|
||||
values: [{ key: "echconfig", value: "testytestystringstring" }],
|
||||
},
|
||||
});
|
||||
}
|
||||
|
@ -843,7 +843,7 @@ function handleRequest(req, res) {
|
|||
{ key: "no-default-alpn" },
|
||||
{ key: "port", value: 8888 },
|
||||
{ key: "ipv4hint", value: "1.2.3.4" },
|
||||
{ key: "esniconfig", value: "123..." },
|
||||
{ key: "echconfig", value: "123..." },
|
||||
{ key: "ipv6hint", value: "::1" },
|
||||
{ key: 30, value: "somelargestring" },
|
||||
],
|
||||
|
@ -861,7 +861,7 @@ function handleRequest(req, res) {
|
|||
values: [
|
||||
{ key: "alpn", value: "h2" },
|
||||
{ key: "ipv4hint", value: ["1.2.3.4", "5.6.7.8"] },
|
||||
{ key: "esniconfig", value: "abc..." },
|
||||
{ key: "echconfig", value: "abc..." },
|
||||
{ key: "ipv6hint", value: ["::1", "fe80::794f:6d2c:3d5e:7836"] },
|
||||
],
|
||||
},
|
||||
|
|
Загрузка…
Ссылка в новой задаче