<?xml version='1.0' encoding='utf-8'?>
<?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?>
<!-- generated by https://github.com/cabo/kramdown-rfc2629 version 1.2.10 -->
<!DOCTYPE rfc SYSTEM "rfc2629-xhtml.ent">
<?rfc toc="yes"?>
<?rfc sortrefs="yes"?>
<?rfc symrefs="yes"?>
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" ipr="trust200902" docName="draft-schinazi-masque-protocol-00" category="exp" obsoletes="" updates="" submissionType="IETF" xml:lang="en" tocInclude="true" sortRefs="true" symRefs="true" version="3">
  <!-- xml2rfc v2v3 conversion 2.40.1 -->
  <front>
    <title abbrev="MASQUE">The MASQUE Protocol</title>
    <seriesInfo name="Internet-Draft" value="draft-schinazi-masque-protocol-00"/>
    <author initials="D." surname="Schinazi" fullname="David Schinazi">
      <organization>Google LLC</organization>
      <address>
        <postal>
          <street>1600 Amphitheatre Parkway</street>
          <city>Mountain View, California 94043</city>
          <country>United States of America</country>
        </postal>
        <email>dschinazi.ietf@gmail.com</email>
      </address>
    </author>
    <date year="2020" month="March" day="12"/>
    <keyword>Internet-Draft</keyword>
    <abstract>
      <t>This document describes MASQUE (Multiplexed Application Substrate over QUIC
Encryption). MASQUE is a framework that allows concurrently running multiple
networking applications inside an HTTP/3 connection. For example, MASQUE can
allow a QUIC client to negotiate proxying capability with an HTTP/3 server,
and subsequently make use of this functionality while concurrently processing
HTTP/3 requests and responses.</t>
      <t>This document is a straw-man proposal. It does not contain enough details to
implement the protocol, and is currently intended to spark discussions on
the approach it is taking. Discussion of this work is encouraged to happen on
the MASQUE IETF mailing list <eref target="mailto:masque@ietf.org">masque@ietf.org</eref> or on the GitHub repository
which contains the draft: <eref target="https://github.com/DavidSchinazi/masque-drafts">https://github.com/DavidSchinazi/masque-drafts</eref>.</t>
    </abstract>
  </front>
  <middle>
    <section anchor="introduction" numbered="true" toc="default">
      <name>Introduction</name>
      <t>This document describes MASQUE (Multiplexed Application Substrate over QUIC
Encryption). MASQUE is a framework that allows concurrently running multiple
networking applications inside an HTTP/3 connection (see
<xref target="HTTP3" format="default"/>). For example, MASQUE can allow a QUIC client to
negotiate proxying capability with an HTTP/3 server, and subsequently make use
of this functionality while concurrently processing HTTP/3 requests and
responses.</t>
      <t>MASQUE Negotiation is performed using HTTP mechanisms, but MASQUE applications
can subsequently leverage QUIC <xref target="QUIC" format="default"/> features
without using HTTP.</t>
      <t>This document is a straw-man proposal. It does not contain enough details to
implement the protocol, and is currently intended to spark discussions on
the approach it is taking. Discussion of this work is encouraged to happen on
the MASQUE IETF mailing list <eref target="mailto:masque@ietf.org">masque@ietf.org</eref> or on the GitHub repository
which contains the draft: <eref target="https://github.com/DavidSchinazi/masque-drafts">https://github.com/DavidSchinazi/masque-drafts</eref>.</t>
      <section anchor="conventions" numbered="true" toc="default">
        <name>Conventions and Definitions</name>
        <t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD",
"SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this
document are to be interpreted as described in BCP 14 <xref target="RFC2119" format="default"/> <xref target="RFC8174" format="default"/>
when, and only when, they appear in all capitals, as shown here.</t>
      </section>
    </section>
    <section anchor="negotiation" numbered="true" toc="default">
      <name>MASQUE Negotiation</name>
      <t>In order to negotiate the use of the MASQUE protocol, the client starts by
sending a MASQUE request in the HTTP data of an HTTP POST request to
"/.well-known/masque/initial". The client can use this to request specific
MASQUE applications and advertise support for MASQUE extensions. The MASQUE
server indicates support for MASQUE by sending an HTTP status code 200 response,
and can use the data to inform the client of which MASQUE applications are now
in use, and various configuration parameters.</t>
      <t>Both the MASQUE negotiation initial request and its response carry a list of
type-length-value fields. The type field is a number corresponding to a MASQUE
application, and is encoded as a QUIC variable-length integer. The length field
represents the length in bytes of the value field, encoded as a QUIC
variable-length integer. The contents of the value field or defined by its
corresponding MASQUE application. When parsing, endpoints MUST ignore unknown
MASQUE applications.</t>
    </section>
    <section anchor="applications" numbered="true" toc="default">
      <name>MASQUE Applications</name>
      <t>As soon as the server has accepted the client's MASQUE initial request, it can
advertise support for MASQUE Applications, which will be multiplexed over this
HTTP/3 connection.</t>
      <section anchor="http-proxy" numbered="true" toc="default">
        <name>HTTP Proxy</name>
        <t>The client can make proxied HTTP requests through the server to other
servers. In practice this will mean using the CONNECT method to establish a
stream over which to run TLS to a different remote destination. The proxy
applies back-pressure to streams in both directions.</t>
      </section>
      <section anchor="doh" numbered="true" toc="default">
        <name>DNS over HTTPS</name>
        <t>The client can send DNS queries using DNS over HTTPS <xref target="DOH" format="default"/> to the
MASQUE server.</t>
      </section>
      <section anchor="quic-proxy" numbered="true" toc="default">
        <name>QUIC Proxying</name>
        <t>By leveraging QUIC client connection IDs, a MASQUE server can act as a QUIC
proxy while only using one UDP port. The server informs the client of a
scheme for client connection IDs (for example, random of a minimum length or
vended by the MASQUE server) and then the server can forward those packets to
further web servers.</t>
        <t>This mechanism can elide the connection IDs on the link between the client
and MASQUE server by negotiating a mapping between DATAGRAM_IDs and the tuple
(client connection ID, server connection ID, server IP address, server port).</t>
        <t>Compared to UDP proxying, this mode has the advantage of only requiring one UDP
port to be open on the MASQUE server, and can lower the overhead on the link
between client and MASQUE server by compressing connection IDs.</t>
      </section>
      <section anchor="udp-proxy" numbered="true" toc="default">
        <name>UDP Proxying</name>
        <t>In order to support WebRTC or QUIC to further servers, clients need a way to
relay UDP onwards to a remote server. In practice for most widely deployed
protocols other than DNS, this involves many datagrams over the same ports.
Therefore this mechanism implements that efficiently: clients can use the
MASQUE protocol stream to request an UDP association to an IP address and
UDP port pair. In QUIC, the server would reply with a DATAGRAM_ID that the
client can then use to have UDP datagrams sent to this remote server.
Datagrams are then simply transferred between the DATAGRAMs with this ID and
the outer server. There will also be a message on the MASQUE protocol stream
to request shutdown of a UDP association to save resources when it is no
longer needed.</t>
      </section>
      <section anchor="ip-proxy" numbered="true" toc="default">
        <name>IP Proxying</name>
        <t>For the rare cases where the previous mechanisms are not sufficient, proxying
can be performed at the IP layer. This would use a different DATAGRAM_ID and
IP datagrams would be encoded inside it without framing.</t>
      </section>
      <section anchor="service-registration" numbered="true" toc="default">
        <name>Service Registration</name>
        <t>MASQUE can be used to make a home server accessible on the wide area. The home
server authenticates to the MASQUE server and registers a domain name it wishes
to serve. The MASQUE server can then forward any traffic it receives for that
domain name (by inspecting the TLS Server Name Indication (SNI) extension) to
the home server. This received traffic is not authenticated and it allows
non-modified clients to communicate with the home server without knowing it is
not colocated with the MASQUE server.</t>
        <t>To help obfuscate the home server, deployments can use Encrypted Server Name
Indication <xref target="ESNI" format="default"/>. That will require the MASQUE server
sending the cleartext SNI to the home server.</t>
      </section>
    </section>
    <section anchor="security" numbered="true" toc="default">
      <name>Security Considerations</name>
      <t>Here be dragons. TODO: slay the dragons.</t>
    </section>
    <section anchor="iana" numbered="true" toc="default">
      <name>IANA Considerations</name>
      <t>This document will request IANA to register the "/.well-known/masque/" URI
(expert review)
<eref target="https://www.iana.org/assignments/well-known-uris/well-known-uris.xhtml">https://www.iana.org/assignments/well-known-uris/well-known-uris.xhtml</eref>.</t>
      <t>This document will request IANA to create a new MASQUE Applications registry
which governs a 62-bit space of MASQUE application types.</t>
    </section>
  </middle>
  <back>
    <references>
      <name>References</name>
      <references>
        <name>Normative References</name>
        <reference anchor="HTTP3" target="http://www.ietf.org/internet-drafts/draft-ietf-quic-http-27.txt">
          <front>
            <title>Hypertext Transfer Protocol Version 3 (HTTP/3)</title>
            <seriesInfo name="Internet-Draft" value="draft-ietf-quic-http-27"/>
            <author initials="M" surname="Bishop" fullname="Mike Bishop">
              <organization/>
            </author>
            <date month="February" day="21" year="2020"/>
            <abstract>
              <t>The QUIC transport protocol has several features that are desirable in a transport for HTTP, such as stream multiplexing, per-stream flow control, and low-latency connection establishment.  This document describes a mapping of HTTP semantics over QUIC.  This document also identifies HTTP/2 features that are subsumed by QUIC, and describes how HTTP/2 extensions can be ported to HTTP/3.</t>
            </abstract>
          </front>
        </reference>
        <reference anchor="QUIC" target="http://www.ietf.org/internet-drafts/draft-ietf-quic-transport-27.txt">
          <front>
            <title>QUIC: A UDP-Based Multiplexed and Secure Transport</title>
            <seriesInfo name="Internet-Draft" value="draft-ietf-quic-transport-27"/>
            <author initials="J" surname="Iyengar" fullname="Jana Iyengar">
              <organization/>
            </author>
            <author initials="M" surname="Thomson" fullname="Martin Thomson">
              <organization/>
            </author>
            <date month="February" day="21" year="2020"/>
            <abstract>
              <t>This document defines the core of the QUIC transport protocol. Accompanying documents describe QUIC's loss detection and congestion control and the use of TLS for key negotiation.  Note to Readers  Discussion of this draft takes place on the QUIC working group mailing list (quic@ietf.org), which is archived at &lt;https://mailarchive.ietf.org/arch/search/?email_list=quic&gt;.  Working Group information can be found at &lt;https://github.com/ quicwg&gt;; source code and issues list for this draft can be found at &lt;https://github.com/quicwg/base-drafts/labels/-transport&gt;.</t>
            </abstract>
          </front>
        </reference>
        <reference anchor="RFC2119" target="https://www.rfc-editor.org/info/rfc2119">
          <front>
            <title>Key words for use in RFCs to Indicate Requirement Levels</title>
            <seriesInfo name="DOI" value="10.17487/RFC2119"/>
            <seriesInfo name="RFC" value="2119"/>
            <seriesInfo name="BCP" value="14"/>
            <author initials="S." surname="Bradner" fullname="S. Bradner">
              <organization/>
            </author>
            <date year="1997" month="March"/>
            <abstract>
              <t>In many standards track documents several words are used to signify the requirements in the specification.  These words are often capitalized. This document defines these words as they should be interpreted in IETF documents.  This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.</t>
            </abstract>
          </front>
        </reference>
        <reference anchor="RFC8174" target="https://www.rfc-editor.org/info/rfc8174">
          <front>
            <title>Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words</title>
            <seriesInfo name="DOI" value="10.17487/RFC8174"/>
            <seriesInfo name="RFC" value="8174"/>
            <seriesInfo name="BCP" value="14"/>
            <author initials="B." surname="Leiba" fullname="B. Leiba">
              <organization/>
            </author>
            <date year="2017" month="May"/>
            <abstract>
              <t>RFC 2119 specifies common key words that may be used in protocol  specifications.  This document aims to reduce the ambiguity by clarifying that only UPPERCASE usage of the key words have the  defined special meanings.</t>
            </abstract>
          </front>
        </reference>
        <reference anchor="DOH" target="https://www.rfc-editor.org/info/rfc8484">
          <front>
            <title>DNS Queries over HTTPS (DoH)</title>
            <seriesInfo name="DOI" value="10.17487/RFC8484"/>
            <seriesInfo name="RFC" value="8484"/>
            <author initials="P." surname="Hoffman" fullname="P. Hoffman">
              <organization/>
            </author>
            <author initials="P." surname="McManus" fullname="P. McManus">
              <organization/>
            </author>
            <date year="2018" month="October"/>
            <abstract>
              <t>This document defines a protocol for sending DNS queries and getting DNS responses over HTTPS.  Each DNS query-response pair is mapped into an HTTP exchange.</t>
            </abstract>
          </front>
        </reference>
      </references>
      <references>
        <name>Informative References</name>
        <reference anchor="ESNI" target="http://www.ietf.org/internet-drafts/draft-ietf-tls-esni-06.txt">
          <front>
            <title>Encrypted Server Name Indication for TLS 1.3</title>
            <seriesInfo name="Internet-Draft" value="draft-ietf-tls-esni-06"/>
            <author initials="E" surname="Rescorla" fullname="Eric Rescorla">
              <organization/>
            </author>
            <author initials="K" surname="Oku" fullname="Kazuho Oku">
              <organization/>
            </author>
            <author initials="N" surname="Sullivan" fullname="Nick Sullivan">
              <organization/>
            </author>
            <author initials="C" surname="Wood" fullname="Christopher Wood">
              <organization/>
            </author>
            <date month="March" day="9" year="2020"/>
            <abstract>
              <t>This document defines a simple mechanism for encrypting the Server Name Indication for TLS 1.3.</t>
            </abstract>
          </front>
        </reference>
      </references>
    </references>
    <section numbered="false" anchor="acknowledgments" toc="default">
      <name>Acknowledgments</name>
      <t>This proposal was inspired directly or indirectly by prior work from many
people. The author would like to thank
Nick Harper,
Christian Huitema,
Marcus Ihlar,
Eric Kinnear,
Mirja Kuehlewind,
Brendan Moran,
Lucas Pardue,
Tommy Pauly,
Zaheduzzaman Sarker,
Ben Schwartz,
and
Christopher A. Wood
for their input.</t>
    </section>
  </back>
  <!-- ##markdown-source:
H4sIAArkal4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