DNSCrypt / dnscrypt-proxy

dnscrypt-proxy 2 - A flexible DNS proxy, with support for encrypted DNS protocols.
https://dnscrypt.info
ISC License
11.38k stars 1.01k forks source link

Stamps discussion #39

Closed pequalsmp closed 6 years ago

pequalsmp commented 6 years ago

Hi,

Thank you for all of your work on this project, its amazing how fast-paced the development is.

I would like to ask a few question around the newest change - stamps.

We can see some stamps using the _ character which is invalid as per the original RFC and as a result, base64 will fail to decode the stamps. While there are variants allowing this, its certainly not the default option.

Its unlikely (due to the potential for adding rogue servers without the user knowing) that dnscrypt servers will end up as browser links, which you click, to add them to your static list. And it doesn't seem to serve any purpose during stamp processing either.

jedisct1 commented 6 years ago

1) It's the URL-safe base64 variant.

2) Probably not. The previous "format", which wasn't really one, is compatible with nothing but itself. It can't be used to describe a non-encrypted DNS service, a DNS-over-HTTP2 service or a future revision of the DNSCrypt protocol.

3) The prefix serves different purposes:

pequalsmp commented 6 years ago

I was wondering what your thoughts are on something much simpler, like base64-encoding JSON:

DNSCrypt

{
   "type":"dnscrypt",
   "address":"127.0.0.1",
   "publickey":"FFFF:::FFFF",
   "features":[
      "dnssec",
      "nolog",
      "nofilter"
   ]
}

and DoH respectively

{
   "type":"dnsohttp",
   "address":"127.0.0.1",
   "hostname": "google.com",
   "path": "/",
   "certs": [
        "EEEE",
        "FFFF"
   ],
   "features":[
      "dnssec",
      "nolog",
      "nofilter"
   ]
}

Pros

Cons

jedisct1 commented 6 years ago

For keys and hashes, that would be binary-encoded-as-hexadecimal-encoded-as-JSON-encoded-as-base64. Not very efficient :)

pequalsmp commented 6 years ago

Its definitely Matryoshka-esque, still this are operations where realtime performance is not critical.

There is also BSON. Its similar to the current format (length followed by data), but its "standardized" and there are multiple libraries for almost every language/platform.

jedisct1 commented 6 years ago

BSON is old and was never standardized. CBOR is, but the current format is super simple. Really, I don't think it's worth importing a generic parser just to parse length-prefixed byte vectors.