grpc/cpp/md_doc_naming.html

144 lines
7.8 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.17"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>GRPC C++: gRPC Name Resolution</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">GRPC C++
&#160;<span id="projectnumber">1.64.0</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.17 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
</div><!-- top -->
<div class="PageDoc"><div class="header">
<div class="headertitle">
<div class="title">gRPC Name Resolution </div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><h1><a class="anchor" id="autotoc_md183"></a>
Overview</h1>
<p>gRPC supports DNS as the default name-system. A number of alternative name-systems are used in various deployments. We support an API that is general enough to support a range of name-systems and the corresponding syntax for names. The gRPC client library in various languages will provide a plugin mechanism so resolvers for different name-systems can be plugged in.</p>
<h1><a class="anchor" id="autotoc_md184"></a>
Detailed Design</h1>
<h2><a class="anchor" id="autotoc_md185"></a>
Name Syntax</h2>
<p>A fully qualified, self contained name used for gRPC channel construction uses URI syntax as defined in <a href="https://tools.ietf.org/html/rfc3986">RFC 3986</a>.</p>
<p>The URI scheme indicates what resolver plugin to use. If no scheme prefix is specified or the scheme is unknown, the <code>dns</code> scheme is used by default.</p>
<p>The URI path indicates the name to be resolved.</p>
<p>Most gRPC implementations support the following URI schemes:</p>
<ul>
<li><code>dns:[//authority/]host[:port]</code> &ndash; DNS (default)<ul>
<li><code>host</code> is the host to resolve via DNS.</li>
<li><code>port</code> is the port to return for each address. If not specified, 443 is used (but some implementations default to 80 for insecure channels).</li>
<li><code>authority</code> indicates the DNS server to use, although this is only supported by some implementations. (In C-core, the default DNS resolver does not support this, but the c-ares based resolver supports specifying this in the form "IP:port".)</li>
</ul>
</li>
<li><code>unix:path</code>, <code>unix://absolute_path</code> &ndash; Unix domain sockets (Unix systems only)<ul>
<li><code>path</code> indicates the location of the desired socket.</li>
<li>In the first form, the path may be relative or absolute; in the second form, the path must be absolute (i.e., there will actually be three slashes, two prior to the path and another to begin the absolute path).</li>
</ul>
</li>
<li><code>unix-abstract:abstract_path</code> &ndash; Unix domain socket in abstract namespace (Unix systems only)<ul>
<li><code>abstract_path</code> indicates a name in the abstract namespace.</li>
<li>The name has no connection with filesystem pathnames.</li>
<li>No permissions will apply to the socket - any process/user may access the socket.</li>
<li>The underlying implementation of Abstract sockets uses a null byte ('\0') as the first character; the implementation will prepend this null. Do not include the null in <code>abstract_path</code>.</li>
</ul>
</li>
<li><code>vsock:cid:port</code> &ndash; VSOCK (Linux systems only)<ul>
<li><code>cid</code> is 32-bit Context Identifier (CID). It indicates the source or destination, which is either a virtual machine or the host.</li>
<li><code>port</code> is a 32-bit port number. It differentiates between multiple services running on a single machine.</li>
</ul>
</li>
</ul>
<p>The following schemes are supported by the gRPC C-core implementation, but may not be supported in other languages:</p>
<ul>
<li><code>ipv4:address[:port][,address[:port],...]</code> &ndash; IPv4 addresses<ul>
<li>Can specify multiple comma-delimited addresses of the form <code>address[:port]</code>:<ul>
<li><code>address</code> is the IPv4 address to use.</li>
<li><code>port</code> is the port to use. If not specified, 443 is used.</li>
</ul>
</li>
</ul>
</li>
<li><code>ipv6:address[:port][,address[:port],...]</code> &ndash; IPv6 addresses<ul>
<li>Can specify multiple comma-delimited addresses of the form <code>address[:port]</code>:<ul>
<li><code>address</code> is the IPv6 address to use. To use with a <code>port</code> the <code>address</code> must enclosed in literal square brackets (<code>[</code> and <code>]</code>). Example: <code>ipv6:[2607:f8b0:400e:c00::ef]:443</code> or <code>ipv6:[::]:1234</code></li>
<li><code>port</code> is the port to use. If not specified, 443 is used.</li>
</ul>
</li>
</ul>
</li>
</ul>
<p>In the future, additional schemes such as <code>etcd</code> could be added.</p>
<h2><a class="anchor" id="autotoc_md186"></a>
Resolver Plugins</h2>
<p>The gRPC client library will use the specified scheme to pick the right resolver plugin and pass it the fully qualified name string.</p>
<p>Resolvers should be able to contact the authority and get a resolution that they return back to the gRPC client library. The returned contents include:</p>
<ul>
<li>A list of resolved addresses (both IP address and port). Each address may have a set of arbitrary attributes (key/value pairs) associated with it, which can be used to communicate information from the resolver to the <a class="el" href="load-balancing_8md.html">load balancing</a> policy.</li>
<li>A <a class="el" href="service__config_8md.html">service config</a>.</li>
</ul>
<p>The plugin API allows the resolvers to continuously watch an endpoint and return updated resolutions as needed. </p>
</div></div><!-- contents -->
</div><!-- PageDoc -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Fri May 17 2024 01:17:16 for GRPC C++ by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.17
</small></address>
</body>
</html>