md_doc_naming.html 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
  5. <meta http-equiv="X-UA-Compatible" content="IE=9"/>
  6. <meta name="generator" content="Doxygen 1.8.17"/>
  7. <meta name="viewport" content="width=device-width, initial-scale=1"/>
  8. <title>GRPC C++: gRPC Name Resolution</title>
  9. <link href="tabs.css" rel="stylesheet" type="text/css"/>
  10. <script type="text/javascript" src="jquery.js"></script>
  11. <script type="text/javascript" src="dynsections.js"></script>
  12. <link href="search/search.css" rel="stylesheet" type="text/css"/>
  13. <script type="text/javascript" src="search/searchdata.js"></script>
  14. <script type="text/javascript" src="search/search.js"></script>
  15. <link href="doxygen.css" rel="stylesheet" type="text/css" />
  16. </head>
  17. <body>
  18. <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
  19. <div id="titlearea">
  20. <table cellspacing="0" cellpadding="0">
  21. <tbody>
  22. <tr style="height: 56px;">
  23. <td id="projectalign" style="padding-left: 0.5em;">
  24. <div id="projectname">GRPC C++
  25. &#160;<span id="projectnumber">1.36.1</span>
  26. </div>
  27. </td>
  28. </tr>
  29. </tbody>
  30. </table>
  31. </div>
  32. <!-- end header part -->
  33. <!-- Generated by Doxygen 1.8.17 -->
  34. <script type="text/javascript">
  35. /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
  36. var searchBox = new SearchBox("searchBox", "search",false,'Search');
  37. /* @license-end */
  38. </script>
  39. <script type="text/javascript" src="menudata.js"></script>
  40. <script type="text/javascript" src="menu.js"></script>
  41. <script type="text/javascript">
  42. /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
  43. $(function() {
  44. initMenu('',true,false,'search.php','Search');
  45. $(document).ready(function() { init_search(); });
  46. });
  47. /* @license-end */</script>
  48. <div id="main-nav"></div>
  49. <!-- window showing the filter options -->
  50. <div id="MSearchSelectWindow"
  51. onmouseover="return searchBox.OnSearchSelectShow()"
  52. onmouseout="return searchBox.OnSearchSelectHide()"
  53. onkeydown="return searchBox.OnSearchSelectKey(event)">
  54. </div>
  55. <!-- iframe showing the search results (closed by default) -->
  56. <div id="MSearchResultsWindow">
  57. <iframe src="javascript:void(0)" frameborder="0"
  58. name="MSearchResults" id="MSearchResults">
  59. </iframe>
  60. </div>
  61. </div><!-- top -->
  62. <div class="PageDoc"><div class="header">
  63. <div class="headertitle">
  64. <div class="title">gRPC Name Resolution </div> </div>
  65. </div><!--header-->
  66. <div class="contents">
  67. <div class="textblock"><h1><a class="anchor" id="autotoc_md184"></a>
  68. Overview</h1>
  69. <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>
  70. <h1><a class="anchor" id="autotoc_md185"></a>
  71. Detailed Design</h1>
  72. <h2><a class="anchor" id="autotoc_md186"></a>
  73. Name Syntax</h2>
  74. <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>
  75. <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>
  76. <p>The URI path indicates the name to be resolved.</p>
  77. <p>Most gRPC implementations support the following URI schemes:</p>
  78. <ul>
  79. <li><code>dns:[//authority/]host[:port]</code> &ndash; DNS (default)<ul>
  80. <li><code>host</code> is the host to resolve via DNS.</li>
  81. <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>
  82. <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>
  83. </ul>
  84. </li>
  85. <li><code>unix:path</code>, <code>unix://absolute_path</code> &ndash; Unix domain sockets (Unix systems only)<ul>
  86. <li><code>path</code> indicates the location of the desired socket.</li>
  87. <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>
  88. </ul>
  89. </li>
  90. <li><code>unix-abstract:abstract_path</code> &ndash; Unix domain socket in abstract namespace (Unix systems only)<ul>
  91. <li><code>abstract_path</code> indicates a name in the abstract namespace.</li>
  92. <li>The name has no connection with filesystem pathnames.</li>
  93. <li>No permissions will apply to the socket - any process/user may access the socket.</li>
  94. <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>
  95. <li><code>abstract_path</code> cannot contain null bytes.<ul>
  96. <li>TODO(<a href="https://github.com/grpc/grpc/issues/24638">https://github.com/grpc/grpc/issues/24638</a>): Unix allows abstract socket names to contain null bytes, but this is not supported by the gRPC C-core implementation.</li>
  97. </ul>
  98. </li>
  99. </ul>
  100. </li>
  101. </ul>
  102. <p>The following schemes are supported by the gRPC C-core implementation, but may not be supported in other languages:</p>
  103. <ul>
  104. <li><code>ipv4:address[:port][,address[:port],...]</code> &ndash; IPv4 addresses<ul>
  105. <li>Can specify multiple comma-delimited addresses of the form <code>address[:port]</code>:<ul>
  106. <li><code>address</code> is the IPv4 address to use.</li>
  107. <li><code>port</code> is the port to use. If not specified, 443 is used.</li>
  108. </ul>
  109. </li>
  110. </ul>
  111. </li>
  112. <li><code>ipv6:address[:port][,address[:port],...]</code> &ndash; IPv6 addresses<ul>
  113. <li>Can specify multiple comma-delimited addresses of the form <code>address[:port]</code>:<ul>
  114. <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>
  115. <li><code>port</code> is the port to use. If not specified, 443 is used.</li>
  116. </ul>
  117. </li>
  118. </ul>
  119. </li>
  120. </ul>
  121. <p>In the future, additional schemes such as <code>etcd</code> could be added.</p>
  122. <h2><a class="anchor" id="autotoc_md187"></a>
  123. Resolver Plugins</h2>
  124. <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>
  125. <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>
  126. <ul>
  127. <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>
  128. <li>A <a class="el" href="service__config_8md.html">service config</a>.</li>
  129. </ul>
  130. <p>The plugin API allows the resolvers to continuously watch an endpoint and return updated resolutions as needed. </p>
  131. </div></div><!-- contents -->
  132. </div><!-- PageDoc -->
  133. <!-- start footer part -->
  134. <hr class="footer"/><address class="footer"><small>
  135. Generated on Wed Mar 3 2021 19:17:23 for GRPC C++ by &#160;<a href="http://www.doxygen.org/index.html">
  136. <img class="footer" src="doxygen.png" alt="doxygen"/>
  137. </a> 1.8.17
  138. </small></address>
  139. </body>
  140. </html>