@reptilestyle/grpc-js 1.9.14-compression.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (436) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +79 -0
  3. package/build/src/admin.d.ts +11 -0
  4. package/build/src/admin.js +30 -0
  5. package/build/src/admin.js.map +1 -0
  6. package/build/src/backoff-timeout.d.ts +90 -0
  7. package/build/src/backoff-timeout.js +174 -0
  8. package/build/src/backoff-timeout.js.map +1 -0
  9. package/build/src/call-credentials.d.ts +56 -0
  10. package/build/src/call-credentials.js +153 -0
  11. package/build/src/call-credentials.js.map +1 -0
  12. package/build/src/call-interface.d.ts +85 -0
  13. package/build/src/call-interface.js +84 -0
  14. package/build/src/call-interface.js.map +1 -0
  15. package/build/src/call-number.d.ts +1 -0
  16. package/build/src/call-number.js +24 -0
  17. package/build/src/call-number.js.map +1 -0
  18. package/build/src/call.d.ts +80 -0
  19. package/build/src/call.js +136 -0
  20. package/build/src/call.js.map +1 -0
  21. package/build/src/channel-credentials.d.ts +81 -0
  22. package/build/src/channel-credentials.js +177 -0
  23. package/build/src/channel-credentials.js.map +1 -0
  24. package/build/src/channel-options.d.ts +72 -0
  25. package/build/src/channel-options.js +69 -0
  26. package/build/src/channel-options.js.map +1 -0
  27. package/build/src/channel.d.ts +76 -0
  28. package/build/src/channel.js +68 -0
  29. package/build/src/channel.js.map +1 -0
  30. package/build/src/channelz.d.ts +108 -0
  31. package/build/src/channelz.js +637 -0
  32. package/build/src/channelz.js.map +1 -0
  33. package/build/src/client-interceptors.d.ts +120 -0
  34. package/build/src/client-interceptors.js +428 -0
  35. package/build/src/client-interceptors.js.map +1 -0
  36. package/build/src/client.d.ts +74 -0
  37. package/build/src/client.js +431 -0
  38. package/build/src/client.js.map +1 -0
  39. package/build/src/compression-algorithms.d.ts +5 -0
  40. package/build/src/compression-algorithms.js +26 -0
  41. package/build/src/compression-algorithms.js.map +1 -0
  42. package/build/src/compression-filter.d.ts +26 -0
  43. package/build/src/compression-filter.js +257 -0
  44. package/build/src/compression-filter.js.map +1 -0
  45. package/build/src/connectivity-state.d.ts +7 -0
  46. package/build/src/connectivity-state.js +28 -0
  47. package/build/src/connectivity-state.js.map +1 -0
  48. package/build/src/constants.d.ts +38 -0
  49. package/build/src/constants.js +64 -0
  50. package/build/src/constants.js.map +1 -0
  51. package/build/src/control-plane-status.d.ts +5 -0
  52. package/build/src/control-plane-status.js +42 -0
  53. package/build/src/control-plane-status.js.map +1 -0
  54. package/build/src/deadline.d.ts +14 -0
  55. package/build/src/deadline.js +97 -0
  56. package/build/src/deadline.js.map +1 -0
  57. package/build/src/duration.d.ts +7 -0
  58. package/build/src/duration.js +34 -0
  59. package/build/src/duration.js.map +1 -0
  60. package/build/src/error.d.ts +2 -0
  61. package/build/src/error.js +40 -0
  62. package/build/src/error.js.map +1 -0
  63. package/build/src/events.d.ts +9 -0
  64. package/build/src/events.js +19 -0
  65. package/build/src/events.js.map +1 -0
  66. package/build/src/experimental.d.ts +16 -0
  67. package/build/src/experimental.js +39 -0
  68. package/build/src/experimental.js.map +1 -0
  69. package/build/src/filter-stack.d.ts +21 -0
  70. package/build/src/filter-stack.js +82 -0
  71. package/build/src/filter-stack.js.map +1 -0
  72. package/build/src/filter.d.ts +25 -0
  73. package/build/src/filter.js +38 -0
  74. package/build/src/filter.js.map +1 -0
  75. package/build/src/generated/channelz.d.ts +72 -0
  76. package/build/src/generated/channelz.js +3 -0
  77. package/build/src/generated/channelz.js.map +1 -0
  78. package/build/src/generated/google/protobuf/Any.d.ts +9 -0
  79. package/build/src/generated/google/protobuf/Any.js +4 -0
  80. package/build/src/generated/google/protobuf/Any.js.map +1 -0
  81. package/build/src/generated/google/protobuf/BoolValue.d.ts +6 -0
  82. package/build/src/generated/google/protobuf/BoolValue.js +4 -0
  83. package/build/src/generated/google/protobuf/BoolValue.js.map +1 -0
  84. package/build/src/generated/google/protobuf/BytesValue.d.ts +6 -0
  85. package/build/src/generated/google/protobuf/BytesValue.js +4 -0
  86. package/build/src/generated/google/protobuf/BytesValue.js.map +1 -0
  87. package/build/src/generated/google/protobuf/DoubleValue.d.ts +6 -0
  88. package/build/src/generated/google/protobuf/DoubleValue.js +4 -0
  89. package/build/src/generated/google/protobuf/DoubleValue.js.map +1 -0
  90. package/build/src/generated/google/protobuf/Duration.d.ts +9 -0
  91. package/build/src/generated/google/protobuf/Duration.js +4 -0
  92. package/build/src/generated/google/protobuf/Duration.js.map +1 -0
  93. package/build/src/generated/google/protobuf/FloatValue.d.ts +6 -0
  94. package/build/src/generated/google/protobuf/FloatValue.js +4 -0
  95. package/build/src/generated/google/protobuf/FloatValue.js.map +1 -0
  96. package/build/src/generated/google/protobuf/Int32Value.d.ts +6 -0
  97. package/build/src/generated/google/protobuf/Int32Value.js +4 -0
  98. package/build/src/generated/google/protobuf/Int32Value.js.map +1 -0
  99. package/build/src/generated/google/protobuf/Int64Value.d.ts +7 -0
  100. package/build/src/generated/google/protobuf/Int64Value.js +4 -0
  101. package/build/src/generated/google/protobuf/Int64Value.js.map +1 -0
  102. package/build/src/generated/google/protobuf/StringValue.d.ts +6 -0
  103. package/build/src/generated/google/protobuf/StringValue.js +4 -0
  104. package/build/src/generated/google/protobuf/StringValue.js.map +1 -0
  105. package/build/src/generated/google/protobuf/Timestamp.d.ts +9 -0
  106. package/build/src/generated/google/protobuf/Timestamp.js +4 -0
  107. package/build/src/generated/google/protobuf/Timestamp.js.map +1 -0
  108. package/build/src/generated/google/protobuf/UInt32Value.d.ts +6 -0
  109. package/build/src/generated/google/protobuf/UInt32Value.js +4 -0
  110. package/build/src/generated/google/protobuf/UInt32Value.js.map +1 -0
  111. package/build/src/generated/google/protobuf/UInt64Value.d.ts +7 -0
  112. package/build/src/generated/google/protobuf/UInt64Value.js +4 -0
  113. package/build/src/generated/google/protobuf/UInt64Value.js.map +1 -0
  114. package/build/src/generated/grpc/channelz/v1/Address.d.ts +79 -0
  115. package/build/src/generated/grpc/channelz/v1/Address.js +4 -0
  116. package/build/src/generated/grpc/channelz/v1/Address.js.map +1 -0
  117. package/build/src/generated/grpc/channelz/v1/Channel.d.ts +64 -0
  118. package/build/src/generated/grpc/channelz/v1/Channel.js +4 -0
  119. package/build/src/generated/grpc/channelz/v1/Channel.js.map +1 -0
  120. package/build/src/generated/grpc/channelz/v1/ChannelConnectivityState.d.ts +24 -0
  121. package/build/src/generated/grpc/channelz/v1/ChannelConnectivityState.js +14 -0
  122. package/build/src/generated/grpc/channelz/v1/ChannelConnectivityState.js.map +1 -0
  123. package/build/src/generated/grpc/channelz/v1/ChannelData.d.ts +72 -0
  124. package/build/src/generated/grpc/channelz/v1/ChannelData.js +4 -0
  125. package/build/src/generated/grpc/channelz/v1/ChannelData.js.map +1 -0
  126. package/build/src/generated/grpc/channelz/v1/ChannelRef.d.ts +27 -0
  127. package/build/src/generated/grpc/channelz/v1/ChannelRef.js +4 -0
  128. package/build/src/generated/grpc/channelz/v1/ChannelRef.js.map +1 -0
  129. package/build/src/generated/grpc/channelz/v1/ChannelTrace.d.ts +41 -0
  130. package/build/src/generated/grpc/channelz/v1/ChannelTrace.js +4 -0
  131. package/build/src/generated/grpc/channelz/v1/ChannelTrace.js.map +1 -0
  132. package/build/src/generated/grpc/channelz/v1/ChannelTraceEvent.d.ts +74 -0
  133. package/build/src/generated/grpc/channelz/v1/ChannelTraceEvent.js +15 -0
  134. package/build/src/generated/grpc/channelz/v1/ChannelTraceEvent.js.map +1 -0
  135. package/build/src/generated/grpc/channelz/v1/Channelz.d.ts +159 -0
  136. package/build/src/generated/grpc/channelz/v1/Channelz.js +4 -0
  137. package/build/src/generated/grpc/channelz/v1/Channelz.js.map +1 -0
  138. package/build/src/generated/grpc/channelz/v1/GetChannelRequest.d.ts +13 -0
  139. package/build/src/generated/grpc/channelz/v1/GetChannelRequest.js +4 -0
  140. package/build/src/generated/grpc/channelz/v1/GetChannelRequest.js.map +1 -0
  141. package/build/src/generated/grpc/channelz/v1/GetChannelResponse.d.ts +15 -0
  142. package/build/src/generated/grpc/channelz/v1/GetChannelResponse.js +4 -0
  143. package/build/src/generated/grpc/channelz/v1/GetChannelResponse.js.map +1 -0
  144. package/build/src/generated/grpc/channelz/v1/GetServerRequest.d.ts +13 -0
  145. package/build/src/generated/grpc/channelz/v1/GetServerRequest.js +4 -0
  146. package/build/src/generated/grpc/channelz/v1/GetServerRequest.js.map +1 -0
  147. package/build/src/generated/grpc/channelz/v1/GetServerResponse.d.ts +15 -0
  148. package/build/src/generated/grpc/channelz/v1/GetServerResponse.js +4 -0
  149. package/build/src/generated/grpc/channelz/v1/GetServerResponse.js.map +1 -0
  150. package/build/src/generated/grpc/channelz/v1/GetServerSocketsRequest.d.ts +35 -0
  151. package/build/src/generated/grpc/channelz/v1/GetServerSocketsRequest.js +4 -0
  152. package/build/src/generated/grpc/channelz/v1/GetServerSocketsRequest.js.map +1 -0
  153. package/build/src/generated/grpc/channelz/v1/GetServerSocketsResponse.d.ts +29 -0
  154. package/build/src/generated/grpc/channelz/v1/GetServerSocketsResponse.js +4 -0
  155. package/build/src/generated/grpc/channelz/v1/GetServerSocketsResponse.js.map +1 -0
  156. package/build/src/generated/grpc/channelz/v1/GetServersRequest.d.ts +33 -0
  157. package/build/src/generated/grpc/channelz/v1/GetServersRequest.js +4 -0
  158. package/build/src/generated/grpc/channelz/v1/GetServersRequest.js.map +1 -0
  159. package/build/src/generated/grpc/channelz/v1/GetServersResponse.d.ts +29 -0
  160. package/build/src/generated/grpc/channelz/v1/GetServersResponse.js +4 -0
  161. package/build/src/generated/grpc/channelz/v1/GetServersResponse.js.map +1 -0
  162. package/build/src/generated/grpc/channelz/v1/GetSocketRequest.d.ts +25 -0
  163. package/build/src/generated/grpc/channelz/v1/GetSocketRequest.js +4 -0
  164. package/build/src/generated/grpc/channelz/v1/GetSocketRequest.js.map +1 -0
  165. package/build/src/generated/grpc/channelz/v1/GetSocketResponse.d.ts +15 -0
  166. package/build/src/generated/grpc/channelz/v1/GetSocketResponse.js +4 -0
  167. package/build/src/generated/grpc/channelz/v1/GetSocketResponse.js.map +1 -0
  168. package/build/src/generated/grpc/channelz/v1/GetSubchannelRequest.d.ts +13 -0
  169. package/build/src/generated/grpc/channelz/v1/GetSubchannelRequest.js +4 -0
  170. package/build/src/generated/grpc/channelz/v1/GetSubchannelRequest.js.map +1 -0
  171. package/build/src/generated/grpc/channelz/v1/GetSubchannelResponse.d.ts +15 -0
  172. package/build/src/generated/grpc/channelz/v1/GetSubchannelResponse.js +4 -0
  173. package/build/src/generated/grpc/channelz/v1/GetSubchannelResponse.js.map +1 -0
  174. package/build/src/generated/grpc/channelz/v1/GetTopChannelsRequest.d.ts +33 -0
  175. package/build/src/generated/grpc/channelz/v1/GetTopChannelsRequest.js +4 -0
  176. package/build/src/generated/grpc/channelz/v1/GetTopChannelsRequest.js.map +1 -0
  177. package/build/src/generated/grpc/channelz/v1/GetTopChannelsResponse.d.ts +29 -0
  178. package/build/src/generated/grpc/channelz/v1/GetTopChannelsResponse.js +4 -0
  179. package/build/src/generated/grpc/channelz/v1/GetTopChannelsResponse.js.map +1 -0
  180. package/build/src/generated/grpc/channelz/v1/Security.d.ts +79 -0
  181. package/build/src/generated/grpc/channelz/v1/Security.js +4 -0
  182. package/build/src/generated/grpc/channelz/v1/Security.js.map +1 -0
  183. package/build/src/generated/grpc/channelz/v1/Server.d.ts +41 -0
  184. package/build/src/generated/grpc/channelz/v1/Server.js +4 -0
  185. package/build/src/generated/grpc/channelz/v1/Server.js.map +1 -0
  186. package/build/src/generated/grpc/channelz/v1/ServerData.d.ts +53 -0
  187. package/build/src/generated/grpc/channelz/v1/ServerData.js +4 -0
  188. package/build/src/generated/grpc/channelz/v1/ServerData.js.map +1 -0
  189. package/build/src/generated/grpc/channelz/v1/ServerRef.d.ts +27 -0
  190. package/build/src/generated/grpc/channelz/v1/ServerRef.js +4 -0
  191. package/build/src/generated/grpc/channelz/v1/ServerRef.js.map +1 -0
  192. package/build/src/generated/grpc/channelz/v1/Socket.d.ts +66 -0
  193. package/build/src/generated/grpc/channelz/v1/Socket.js +4 -0
  194. package/build/src/generated/grpc/channelz/v1/Socket.js.map +1 -0
  195. package/build/src/generated/grpc/channelz/v1/SocketData.d.ts +146 -0
  196. package/build/src/generated/grpc/channelz/v1/SocketData.js +4 -0
  197. package/build/src/generated/grpc/channelz/v1/SocketData.js.map +1 -0
  198. package/build/src/generated/grpc/channelz/v1/SocketOption.d.ts +43 -0
  199. package/build/src/generated/grpc/channelz/v1/SocketOption.js +4 -0
  200. package/build/src/generated/grpc/channelz/v1/SocketOption.js.map +1 -0
  201. package/build/src/generated/grpc/channelz/v1/SocketOptionLinger.d.ts +29 -0
  202. package/build/src/generated/grpc/channelz/v1/SocketOptionLinger.js +4 -0
  203. package/build/src/generated/grpc/channelz/v1/SocketOptionLinger.js.map +1 -0
  204. package/build/src/generated/grpc/channelz/v1/SocketOptionTcpInfo.d.ts +70 -0
  205. package/build/src/generated/grpc/channelz/v1/SocketOptionTcpInfo.js +4 -0
  206. package/build/src/generated/grpc/channelz/v1/SocketOptionTcpInfo.js.map +1 -0
  207. package/build/src/generated/grpc/channelz/v1/SocketOptionTimeout.d.ts +15 -0
  208. package/build/src/generated/grpc/channelz/v1/SocketOptionTimeout.js +4 -0
  209. package/build/src/generated/grpc/channelz/v1/SocketOptionTimeout.js.map +1 -0
  210. package/build/src/generated/grpc/channelz/v1/SocketRef.d.ts +27 -0
  211. package/build/src/generated/grpc/channelz/v1/SocketRef.js +4 -0
  212. package/build/src/generated/grpc/channelz/v1/SocketRef.js.map +1 -0
  213. package/build/src/generated/grpc/channelz/v1/Subchannel.d.ts +66 -0
  214. package/build/src/generated/grpc/channelz/v1/Subchannel.js +4 -0
  215. package/build/src/generated/grpc/channelz/v1/Subchannel.js.map +1 -0
  216. package/build/src/generated/grpc/channelz/v1/SubchannelRef.d.ts +27 -0
  217. package/build/src/generated/grpc/channelz/v1/SubchannelRef.js +4 -0
  218. package/build/src/generated/grpc/channelz/v1/SubchannelRef.js.map +1 -0
  219. package/build/src/http_proxy.d.ts +15 -0
  220. package/build/src/http_proxy.js +259 -0
  221. package/build/src/http_proxy.js.map +1 -0
  222. package/build/src/index.d.ts +76 -0
  223. package/build/src/index.js +140 -0
  224. package/build/src/index.js.map +1 -0
  225. package/build/src/internal-channel.d.ts +118 -0
  226. package/build/src/internal-channel.js +535 -0
  227. package/build/src/internal-channel.js.map +1 -0
  228. package/build/src/load-balancer-child-handler.d.ts +24 -0
  229. package/build/src/load-balancer-child-handler.js +151 -0
  230. package/build/src/load-balancer-child-handler.js.map +1 -0
  231. package/build/src/load-balancer-outlier-detection.d.ts +61 -0
  232. package/build/src/load-balancer-outlier-detection.js +608 -0
  233. package/build/src/load-balancer-outlier-detection.js.map +1 -0
  234. package/build/src/load-balancer-pick-first.d.ts +97 -0
  235. package/build/src/load-balancer-pick-first.js +393 -0
  236. package/build/src/load-balancer-pick-first.js.map +1 -0
  237. package/build/src/load-balancer-round-robin.d.ts +21 -0
  238. package/build/src/load-balancer-round-robin.js +174 -0
  239. package/build/src/load-balancer-round-robin.js.map +1 -0
  240. package/build/src/load-balancer.d.ts +97 -0
  241. package/build/src/load-balancer.js +102 -0
  242. package/build/src/load-balancer.js.map +1 -0
  243. package/build/src/load-balancing-call.d.ts +44 -0
  244. package/build/src/load-balancing-call.js +269 -0
  245. package/build/src/load-balancing-call.js.map +1 -0
  246. package/build/src/logging.d.ts +7 -0
  247. package/build/src/logging.js +114 -0
  248. package/build/src/logging.js.map +1 -0
  249. package/build/src/make-client.d.ts +71 -0
  250. package/build/src/make-client.js +143 -0
  251. package/build/src/make-client.js.map +1 -0
  252. package/build/src/max-message-size-filter.d.ts +15 -0
  253. package/build/src/max-message-size-filter.js +86 -0
  254. package/build/src/max-message-size-filter.js.map +1 -0
  255. package/build/src/metadata.d.ts +84 -0
  256. package/build/src/metadata.js +249 -0
  257. package/build/src/metadata.js.map +1 -0
  258. package/build/src/object-stream.d.ts +27 -0
  259. package/build/src/object-stream.js +19 -0
  260. package/build/src/object-stream.js.map +1 -0
  261. package/build/src/picker.d.ts +91 -0
  262. package/build/src/picker.js +78 -0
  263. package/build/src/picker.js.map +1 -0
  264. package/build/src/resolver-dns.d.ts +13 -0
  265. package/build/src/resolver-dns.js +328 -0
  266. package/build/src/resolver-dns.js.map +1 -0
  267. package/build/src/resolver-ip.d.ts +1 -0
  268. package/build/src/resolver-ip.js +104 -0
  269. package/build/src/resolver-ip.js.map +1 -0
  270. package/build/src/resolver-uds.d.ts +1 -0
  271. package/build/src/resolver-uds.js +50 -0
  272. package/build/src/resolver-uds.js.map +1 -0
  273. package/build/src/resolver.d.ts +105 -0
  274. package/build/src/resolver.js +87 -0
  275. package/build/src/resolver.js.map +1 -0
  276. package/build/src/resolving-call.d.ts +44 -0
  277. package/build/src/resolving-call.js +273 -0
  278. package/build/src/resolving-call.js.map +1 -0
  279. package/build/src/resolving-load-balancer.d.ts +67 -0
  280. package/build/src/resolving-load-balancer.js +304 -0
  281. package/build/src/resolving-load-balancer.js.map +1 -0
  282. package/build/src/retrying-call.d.ts +94 -0
  283. package/build/src/retrying-call.js +639 -0
  284. package/build/src/retrying-call.js.map +1 -0
  285. package/build/src/server-call.d.ts +159 -0
  286. package/build/src/server-call.js +700 -0
  287. package/build/src/server-call.js.map +1 -0
  288. package/build/src/server-credentials.d.ts +11 -0
  289. package/build/src/server-credentials.js +81 -0
  290. package/build/src/server-credentials.js.map +1 -0
  291. package/build/src/server.d.ts +56 -0
  292. package/build/src/server.js +892 -0
  293. package/build/src/server.js.map +1 -0
  294. package/build/src/service-config.d.ts +56 -0
  295. package/build/src/service-config.js +416 -0
  296. package/build/src/service-config.js.map +1 -0
  297. package/build/src/status-builder.d.ts +28 -0
  298. package/build/src/status-builder.js +68 -0
  299. package/build/src/status-builder.js.map +1 -0
  300. package/build/src/stream-decoder.d.ts +10 -0
  301. package/build/src/stream-decoder.js +96 -0
  302. package/build/src/stream-decoder.js.map +1 -0
  303. package/build/src/subchannel-address.d.ts +18 -0
  304. package/build/src/subchannel-address.js +65 -0
  305. package/build/src/subchannel-address.js.map +1 -0
  306. package/build/src/subchannel-call.d.ts +61 -0
  307. package/build/src/subchannel-call.js +461 -0
  308. package/build/src/subchannel-call.js.map +1 -0
  309. package/build/src/subchannel-interface.d.ts +49 -0
  310. package/build/src/subchannel-interface.js +59 -0
  311. package/build/src/subchannel-interface.js.map +1 -0
  312. package/build/src/subchannel-pool.d.ts +40 -0
  313. package/build/src/subchannel-pool.js +137 -0
  314. package/build/src/subchannel-pool.js.map +1 -0
  315. package/build/src/subchannel.d.ts +119 -0
  316. package/build/src/subchannel.js +353 -0
  317. package/build/src/subchannel.js.map +1 -0
  318. package/build/src/tls-helpers.d.ts +2 -0
  319. package/build/src/tls-helpers.js +34 -0
  320. package/build/src/tls-helpers.js.map +1 -0
  321. package/build/src/transport.d.ts +130 -0
  322. package/build/src/transport.js +640 -0
  323. package/build/src/transport.js.map +1 -0
  324. package/build/src/uri-parser.d.ts +12 -0
  325. package/build/src/uri-parser.js +110 -0
  326. package/build/src/uri-parser.js.map +1 -0
  327. package/package.json +85 -0
  328. package/proto/channelz.proto +564 -0
  329. package/src/admin.ts +45 -0
  330. package/src/backoff-timeout.ts +196 -0
  331. package/src/call-credentials.ts +226 -0
  332. package/src/call-interface.ts +173 -0
  333. package/src/call-number.ts +22 -0
  334. package/src/call.ts +200 -0
  335. package/src/channel-credentials.ts +267 -0
  336. package/src/channel-options.ts +119 -0
  337. package/src/channel.ts +174 -0
  338. package/src/channelz.ts +886 -0
  339. package/src/client-interceptors.ts +577 -0
  340. package/src/client.ts +715 -0
  341. package/src/compression-algorithms.ts +22 -0
  342. package/src/compression-filter.ts +315 -0
  343. package/src/connectivity-state.ts +24 -0
  344. package/src/constants.ts +66 -0
  345. package/src/control-plane-status.ts +43 -0
  346. package/src/deadline.ts +95 -0
  347. package/src/duration.ts +36 -0
  348. package/src/error.ts +37 -0
  349. package/src/events.ts +26 -0
  350. package/src/experimental.ts +48 -0
  351. package/src/filter-stack.ts +100 -0
  352. package/src/filter.ts +63 -0
  353. package/src/generated/channelz.ts +73 -0
  354. package/src/generated/google/protobuf/Any.ts +13 -0
  355. package/src/generated/google/protobuf/BoolValue.ts +10 -0
  356. package/src/generated/google/protobuf/BytesValue.ts +10 -0
  357. package/src/generated/google/protobuf/DoubleValue.ts +10 -0
  358. package/src/generated/google/protobuf/Duration.ts +13 -0
  359. package/src/generated/google/protobuf/FloatValue.ts +10 -0
  360. package/src/generated/google/protobuf/Int32Value.ts +10 -0
  361. package/src/generated/google/protobuf/Int64Value.ts +11 -0
  362. package/src/generated/google/protobuf/StringValue.ts +10 -0
  363. package/src/generated/google/protobuf/Timestamp.ts +13 -0
  364. package/src/generated/google/protobuf/UInt32Value.ts +10 -0
  365. package/src/generated/google/protobuf/UInt64Value.ts +11 -0
  366. package/src/generated/grpc/channelz/v1/Address.ts +89 -0
  367. package/src/generated/grpc/channelz/v1/Channel.ts +68 -0
  368. package/src/generated/grpc/channelz/v1/ChannelConnectivityState.ts +45 -0
  369. package/src/generated/grpc/channelz/v1/ChannelData.ts +76 -0
  370. package/src/generated/grpc/channelz/v1/ChannelRef.ts +31 -0
  371. package/src/generated/grpc/channelz/v1/ChannelTrace.ts +45 -0
  372. package/src/generated/grpc/channelz/v1/ChannelTraceEvent.ts +91 -0
  373. package/src/generated/grpc/channelz/v1/Channelz.ts +178 -0
  374. package/src/generated/grpc/channelz/v1/GetChannelRequest.ts +17 -0
  375. package/src/generated/grpc/channelz/v1/GetChannelResponse.ts +19 -0
  376. package/src/generated/grpc/channelz/v1/GetServerRequest.ts +17 -0
  377. package/src/generated/grpc/channelz/v1/GetServerResponse.ts +19 -0
  378. package/src/generated/grpc/channelz/v1/GetServerSocketsRequest.ts +39 -0
  379. package/src/generated/grpc/channelz/v1/GetServerSocketsResponse.ts +33 -0
  380. package/src/generated/grpc/channelz/v1/GetServersRequest.ts +37 -0
  381. package/src/generated/grpc/channelz/v1/GetServersResponse.ts +33 -0
  382. package/src/generated/grpc/channelz/v1/GetSocketRequest.ts +29 -0
  383. package/src/generated/grpc/channelz/v1/GetSocketResponse.ts +19 -0
  384. package/src/generated/grpc/channelz/v1/GetSubchannelRequest.ts +17 -0
  385. package/src/generated/grpc/channelz/v1/GetSubchannelResponse.ts +19 -0
  386. package/src/generated/grpc/channelz/v1/GetTopChannelsRequest.ts +37 -0
  387. package/src/generated/grpc/channelz/v1/GetTopChannelsResponse.ts +33 -0
  388. package/src/generated/grpc/channelz/v1/Security.ts +87 -0
  389. package/src/generated/grpc/channelz/v1/Server.ts +45 -0
  390. package/src/generated/grpc/channelz/v1/ServerData.ts +57 -0
  391. package/src/generated/grpc/channelz/v1/ServerRef.ts +31 -0
  392. package/src/generated/grpc/channelz/v1/Socket.ts +70 -0
  393. package/src/generated/grpc/channelz/v1/SocketData.ts +150 -0
  394. package/src/generated/grpc/channelz/v1/SocketOption.ts +47 -0
  395. package/src/generated/grpc/channelz/v1/SocketOptionLinger.ts +33 -0
  396. package/src/generated/grpc/channelz/v1/SocketOptionTcpInfo.ts +74 -0
  397. package/src/generated/grpc/channelz/v1/SocketOptionTimeout.ts +19 -0
  398. package/src/generated/grpc/channelz/v1/SocketRef.ts +31 -0
  399. package/src/generated/grpc/channelz/v1/Subchannel.ts +70 -0
  400. package/src/generated/grpc/channelz/v1/SubchannelRef.ts +31 -0
  401. package/src/http_proxy.ts +311 -0
  402. package/src/index.ts +284 -0
  403. package/src/internal-channel.ts +832 -0
  404. package/src/load-balancer-child-handler.ts +169 -0
  405. package/src/load-balancer-outlier-detection.ts +882 -0
  406. package/src/load-balancer-pick-first.ts +487 -0
  407. package/src/load-balancer-round-robin.ts +249 -0
  408. package/src/load-balancer.ts +230 -0
  409. package/src/load-balancing-call.ts +351 -0
  410. package/src/logging.ts +123 -0
  411. package/src/make-client.ts +238 -0
  412. package/src/max-message-size-filter.ts +88 -0
  413. package/src/metadata.ts +298 -0
  414. package/src/object-stream.ts +66 -0
  415. package/src/picker.ts +146 -0
  416. package/src/resolver-dns.ts +412 -0
  417. package/src/resolver-ip.ts +120 -0
  418. package/src/resolver-uds.ts +63 -0
  419. package/src/resolver.ts +180 -0
  420. package/src/resolving-call.ts +331 -0
  421. package/src/resolving-load-balancer.ts +403 -0
  422. package/src/retrying-call.ts +821 -0
  423. package/src/server-call.ts +1033 -0
  424. package/src/server-credentials.ts +108 -0
  425. package/src/server.ts +1300 -0
  426. package/src/service-config.ts +542 -0
  427. package/src/status-builder.ts +80 -0
  428. package/src/stream-decoder.ts +105 -0
  429. package/src/subchannel-address.ts +88 -0
  430. package/src/subchannel-call.ts +539 -0
  431. package/src/subchannel-interface.ts +97 -0
  432. package/src/subchannel-pool.ts +176 -0
  433. package/src/subchannel.ts +482 -0
  434. package/src/tls-helpers.ts +35 -0
  435. package/src/transport.ts +824 -0
  436. package/src/uri-parser.ts +114 -0
@@ -0,0 +1,328 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright 2019 gRPC authors.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.DEFAULT_PORT = void 0;
19
+ exports.setup = setup;
20
+ const resolver_1 = require("./resolver");
21
+ const dns = require("dns");
22
+ const util = require("util");
23
+ const service_config_1 = require("./service-config");
24
+ const constants_1 = require("./constants");
25
+ const metadata_1 = require("./metadata");
26
+ const logging = require("./logging");
27
+ const constants_2 = require("./constants");
28
+ const uri_parser_1 = require("./uri-parser");
29
+ const net_1 = require("net");
30
+ const backoff_timeout_1 = require("./backoff-timeout");
31
+ const TRACER_NAME = 'dns_resolver';
32
+ function trace(text) {
33
+ logging.trace(constants_2.LogVerbosity.DEBUG, TRACER_NAME, text);
34
+ }
35
+ /**
36
+ * The default TCP port to connect to if not explicitly specified in the target.
37
+ */
38
+ exports.DEFAULT_PORT = 443;
39
+ const DEFAULT_MIN_TIME_BETWEEN_RESOLUTIONS_MS = 30000;
40
+ const resolveTxtPromise = util.promisify(dns.resolveTxt);
41
+ const dnsLookupPromise = util.promisify(dns.lookup);
42
+ /**
43
+ * Merge any number of arrays into a single alternating array
44
+ * @param arrays
45
+ */
46
+ function mergeArrays(...arrays) {
47
+ const result = [];
48
+ for (let i = 0; i <
49
+ Math.max.apply(null, arrays.map(array => array.length)); i++) {
50
+ for (const array of arrays) {
51
+ if (i < array.length) {
52
+ result.push(array[i]);
53
+ }
54
+ }
55
+ }
56
+ return result;
57
+ }
58
+ /**
59
+ * Resolver implementation that handles DNS names and IP addresses.
60
+ */
61
+ class DnsResolver {
62
+ constructor(target, listener, channelOptions) {
63
+ var _a, _b, _c;
64
+ this.target = target;
65
+ this.listener = listener;
66
+ this.pendingLookupPromise = null;
67
+ this.pendingTxtPromise = null;
68
+ this.latestLookupResult = null;
69
+ this.latestServiceConfig = null;
70
+ this.latestServiceConfigError = null;
71
+ this.continueResolving = false;
72
+ this.isNextResolutionTimerRunning = false;
73
+ this.isServiceConfigEnabled = true;
74
+ this.returnedIpResult = false;
75
+ trace('Resolver constructed for target ' + (0, uri_parser_1.uriToString)(target));
76
+ const hostPort = (0, uri_parser_1.splitHostPort)(target.path);
77
+ if (hostPort === null) {
78
+ this.ipResult = null;
79
+ this.dnsHostname = null;
80
+ this.port = null;
81
+ }
82
+ else {
83
+ if ((0, net_1.isIPv4)(hostPort.host) || (0, net_1.isIPv6)(hostPort.host)) {
84
+ this.ipResult = [
85
+ {
86
+ host: hostPort.host,
87
+ port: (_a = hostPort.port) !== null && _a !== void 0 ? _a : exports.DEFAULT_PORT,
88
+ },
89
+ ];
90
+ this.dnsHostname = null;
91
+ this.port = null;
92
+ }
93
+ else {
94
+ this.ipResult = null;
95
+ this.dnsHostname = hostPort.host;
96
+ this.port = (_b = hostPort.port) !== null && _b !== void 0 ? _b : exports.DEFAULT_PORT;
97
+ }
98
+ }
99
+ this.percentage = Math.random() * 100;
100
+ if (channelOptions['grpc.service_config_disable_resolution'] === 1) {
101
+ this.isServiceConfigEnabled = false;
102
+ }
103
+ this.defaultResolutionError = {
104
+ code: constants_1.Status.UNAVAILABLE,
105
+ details: `Name resolution failed for target ${(0, uri_parser_1.uriToString)(this.target)}`,
106
+ metadata: new metadata_1.Metadata(),
107
+ };
108
+ const backoffOptions = {
109
+ initialDelay: channelOptions['grpc.initial_reconnect_backoff_ms'],
110
+ maxDelay: channelOptions['grpc.max_reconnect_backoff_ms'],
111
+ };
112
+ this.backoff = new backoff_timeout_1.BackoffTimeout(() => {
113
+ if (this.continueResolving) {
114
+ this.startResolutionWithBackoff();
115
+ }
116
+ }, backoffOptions);
117
+ this.backoff.unref();
118
+ this.minTimeBetweenResolutionsMs =
119
+ (_c = channelOptions['grpc.dns_min_time_between_resolutions_ms']) !== null && _c !== void 0 ? _c : DEFAULT_MIN_TIME_BETWEEN_RESOLUTIONS_MS;
120
+ this.nextResolutionTimer = setTimeout(() => { }, 0);
121
+ clearTimeout(this.nextResolutionTimer);
122
+ }
123
+ /**
124
+ * If the target is an IP address, just provide that address as a result.
125
+ * Otherwise, initiate A, AAAA, and TXT lookups
126
+ */
127
+ startResolution() {
128
+ if (this.ipResult !== null) {
129
+ if (!this.returnedIpResult) {
130
+ trace('Returning IP address for target ' + (0, uri_parser_1.uriToString)(this.target));
131
+ setImmediate(() => {
132
+ this.listener.onSuccessfulResolution(this.ipResult, null, null, null, {});
133
+ });
134
+ this.returnedIpResult = true;
135
+ }
136
+ this.backoff.stop();
137
+ this.backoff.reset();
138
+ this.stopNextResolutionTimer();
139
+ return;
140
+ }
141
+ if (this.dnsHostname === null) {
142
+ trace('Failed to parse DNS address ' + (0, uri_parser_1.uriToString)(this.target));
143
+ setImmediate(() => {
144
+ this.listener.onError({
145
+ code: constants_1.Status.UNAVAILABLE,
146
+ details: `Failed to parse DNS address ${(0, uri_parser_1.uriToString)(this.target)}`,
147
+ metadata: new metadata_1.Metadata(),
148
+ });
149
+ });
150
+ this.stopNextResolutionTimer();
151
+ }
152
+ else {
153
+ if (this.pendingLookupPromise !== null) {
154
+ return;
155
+ }
156
+ trace('Looking up DNS hostname ' + this.dnsHostname);
157
+ /* We clear out latestLookupResult here to ensure that it contains the
158
+ * latest result since the last time we started resolving. That way, the
159
+ * TXT resolution handler can use it, but only if it finishes second. We
160
+ * don't clear out any previous service config results because it's
161
+ * better to use a service config that's slightly out of date than to
162
+ * revert to an effectively blank one. */
163
+ this.latestLookupResult = null;
164
+ const hostname = this.dnsHostname;
165
+ /* We lookup both address families here and then split them up later
166
+ * because when looking up a single family, dns.lookup outputs an error
167
+ * if the name exists but there are no records for that family, and that
168
+ * error is indistinguishable from other kinds of errors */
169
+ this.pendingLookupPromise = dnsLookupPromise(hostname, { all: true });
170
+ this.pendingLookupPromise.then(addressList => {
171
+ if (this.pendingLookupPromise === null) {
172
+ return;
173
+ }
174
+ this.pendingLookupPromise = null;
175
+ this.backoff.reset();
176
+ this.backoff.stop();
177
+ const ip4Addresses = addressList.filter(addr => addr.family === 4);
178
+ const ip6Addresses = addressList.filter(addr => addr.family === 6);
179
+ this.latestLookupResult = mergeArrays(ip6Addresses, ip4Addresses).map(addr => ({ host: addr.address, port: +this.port }));
180
+ const allAddressesString = '[' +
181
+ this.latestLookupResult
182
+ .map(addr => addr.host + ':' + addr.port)
183
+ .join(',') +
184
+ ']';
185
+ trace('Resolved addresses for target ' +
186
+ (0, uri_parser_1.uriToString)(this.target) +
187
+ ': ' +
188
+ allAddressesString);
189
+ if (this.latestLookupResult.length === 0) {
190
+ this.listener.onError(this.defaultResolutionError);
191
+ return;
192
+ }
193
+ /* If the TXT lookup has not yet finished, both of the last two
194
+ * arguments will be null, which is the equivalent of getting an
195
+ * empty TXT response. When the TXT lookup does finish, its handler
196
+ * can update the service config by using the same address list */
197
+ this.listener.onSuccessfulResolution(this.latestLookupResult, this.latestServiceConfig, this.latestServiceConfigError, null, {});
198
+ }, err => {
199
+ if (this.pendingLookupPromise === null) {
200
+ return;
201
+ }
202
+ trace('Resolution error for target ' +
203
+ (0, uri_parser_1.uriToString)(this.target) +
204
+ ': ' +
205
+ err.message);
206
+ this.pendingLookupPromise = null;
207
+ this.stopNextResolutionTimer();
208
+ this.listener.onError(this.defaultResolutionError);
209
+ });
210
+ /* If there already is a still-pending TXT resolution, we can just use
211
+ * that result when it comes in */
212
+ if (this.isServiceConfigEnabled && this.pendingTxtPromise === null) {
213
+ /* We handle the TXT query promise differently than the others because
214
+ * the name resolution attempt as a whole is a success even if the TXT
215
+ * lookup fails */
216
+ this.pendingTxtPromise = resolveTxtPromise(hostname);
217
+ this.pendingTxtPromise.then(txtRecord => {
218
+ if (this.pendingTxtPromise === null) {
219
+ return;
220
+ }
221
+ this.pendingTxtPromise = null;
222
+ try {
223
+ this.latestServiceConfig = (0, service_config_1.extractAndSelectServiceConfig)(txtRecord, this.percentage);
224
+ }
225
+ catch (err) {
226
+ this.latestServiceConfigError = {
227
+ code: constants_1.Status.UNAVAILABLE,
228
+ details: `Parsing service config failed with error ${err.message}`,
229
+ metadata: new metadata_1.Metadata(),
230
+ };
231
+ }
232
+ if (this.latestLookupResult !== null) {
233
+ /* We rely here on the assumption that calling this function with
234
+ * identical parameters will be essentialy idempotent, and calling
235
+ * it with the same address list and a different service config
236
+ * should result in a fast and seamless switchover. */
237
+ this.listener.onSuccessfulResolution(this.latestLookupResult, this.latestServiceConfig, this.latestServiceConfigError, null, {});
238
+ }
239
+ }, err => {
240
+ /* If TXT lookup fails we should do nothing, which means that we
241
+ * continue to use the result of the most recent successful lookup,
242
+ * or the default null config object if there has never been a
243
+ * successful lookup. We do not set the latestServiceConfigError
244
+ * here because that is specifically used for response validation
245
+ * errors. We still need to handle this error so that it does not
246
+ * bubble up as an unhandled promise rejection. */
247
+ });
248
+ }
249
+ }
250
+ }
251
+ startNextResolutionTimer() {
252
+ var _a, _b;
253
+ clearTimeout(this.nextResolutionTimer);
254
+ this.nextResolutionTimer = (_b = (_a = setTimeout(() => {
255
+ this.stopNextResolutionTimer();
256
+ if (this.continueResolving) {
257
+ this.startResolutionWithBackoff();
258
+ }
259
+ }, this.minTimeBetweenResolutionsMs)).unref) === null || _b === void 0 ? void 0 : _b.call(_a);
260
+ this.isNextResolutionTimerRunning = true;
261
+ }
262
+ stopNextResolutionTimer() {
263
+ clearTimeout(this.nextResolutionTimer);
264
+ this.isNextResolutionTimerRunning = false;
265
+ }
266
+ startResolutionWithBackoff() {
267
+ if (this.pendingLookupPromise === null) {
268
+ this.continueResolving = false;
269
+ this.backoff.runOnce();
270
+ this.startNextResolutionTimer();
271
+ this.startResolution();
272
+ }
273
+ }
274
+ updateResolution() {
275
+ /* If there is a pending lookup, just let it finish. Otherwise, if the
276
+ * nextResolutionTimer or backoff timer is running, set the
277
+ * continueResolving flag to resolve when whichever of those timers
278
+ * fires. Otherwise, start resolving immediately. */
279
+ if (this.pendingLookupPromise === null) {
280
+ if (this.isNextResolutionTimerRunning || this.backoff.isRunning()) {
281
+ if (this.isNextResolutionTimerRunning) {
282
+ trace('resolution update delayed by "min time between resolutions" rate limit');
283
+ }
284
+ else {
285
+ trace('resolution update delayed by backoff timer until ' + this.backoff.getEndTime().toISOString());
286
+ }
287
+ this.continueResolving = true;
288
+ }
289
+ else {
290
+ this.startResolutionWithBackoff();
291
+ }
292
+ }
293
+ }
294
+ /**
295
+ * Reset the resolver to the same state it had when it was created. In-flight
296
+ * DNS requests cannot be cancelled, but they are discarded and their results
297
+ * will be ignored.
298
+ */
299
+ destroy() {
300
+ this.continueResolving = false;
301
+ this.backoff.reset();
302
+ this.backoff.stop();
303
+ this.stopNextResolutionTimer();
304
+ this.pendingLookupPromise = null;
305
+ this.pendingTxtPromise = null;
306
+ this.latestLookupResult = null;
307
+ this.latestServiceConfig = null;
308
+ this.latestServiceConfigError = null;
309
+ this.returnedIpResult = false;
310
+ }
311
+ /**
312
+ * Get the default authority for the given target. For IP targets, that is
313
+ * the IP address. For DNS targets, it is the hostname.
314
+ * @param target
315
+ */
316
+ static getDefaultAuthority(target) {
317
+ return target.path;
318
+ }
319
+ }
320
+ /**
321
+ * Set up the DNS resolver class by registering it as the handler for the
322
+ * "dns:" prefix and as the default resolver.
323
+ */
324
+ function setup() {
325
+ (0, resolver_1.registerResolver)('dns', DnsResolver);
326
+ (0, resolver_1.registerDefaultScheme)('dns');
327
+ }
328
+ //# sourceMappingURL=resolver-dns.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolver-dns.js","sourceRoot":"","sources":["../../src/resolver-dns.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAqYH,sBAGC;AAtYD,yCAKoB;AACpB,2BAA2B;AAC3B,6BAA6B;AAC7B,qDAAgF;AAChF,2CAAqC;AAErC,yCAAsC;AACtC,qCAAqC;AACrC,2CAA2C;AAE3C,6CAAmE;AACnE,6BAAqC;AAErC,uDAAmE;AAEnE,MAAM,WAAW,GAAG,cAAc,CAAC;AAEnC,SAAS,KAAK,CAAC,IAAY;IACzB,OAAO,CAAC,KAAK,CAAC,wBAAY,CAAC,KAAK,EAAE,WAAW,EAAE,IAAI,CAAC,CAAC;AACvD,CAAC;AAED;;GAEG;AACU,QAAA,YAAY,GAAG,GAAG,CAAC;AAEhC,MAAM,uCAAuC,GAAG,KAAM,CAAC;AAEvD,MAAM,iBAAiB,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;AACzD,MAAM,gBAAgB,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AAEpD;;;GAGG;AACH,SAAS,WAAW,CAAI,GAAG,MAAa;IACtC,MAAM,MAAM,GAAQ,EAAE,CAAC;IACvB,KACE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,KAAK,EAAE,CAAC;QACrB,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QACpB,IAAI,CAAC,uBAAuB,EAAE,CAAC;QAC/B,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC;QACjC,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;QAC9B,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC;QAC/B,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC;QAChC,IAAI,CAAC,wBAAwB,GAAG,IAAI,CAAC;QACrC,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC;IAChC,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,mBAAmB,CAAC,MAAe;QACxC,OAAO,MAAM,CAAC,IAAI,CAAC;IACrB,CAAC;CACF;AAED;;;GAGG;AACH,SAAgB,KAAK;IACnB,IAAA,2BAAgB,EAAC,KAAK,EAAE,WAAW,CAAC,CAAC;IACrC,IAAA,gCAAqB,EAAC,KAAK,CAAC,CAAC;AAC/B,CAAC"}
@@ -0,0 +1 @@
1
+ export declare function setup(): void;
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright 2021 gRPC authors.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.setup = setup;
19
+ const net_1 = require("net");
20
+ const constants_1 = require("./constants");
21
+ const metadata_1 = require("./metadata");
22
+ const resolver_1 = require("./resolver");
23
+ const uri_parser_1 = require("./uri-parser");
24
+ const logging = require("./logging");
25
+ const TRACER_NAME = 'ip_resolver';
26
+ function trace(text) {
27
+ logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, text);
28
+ }
29
+ const IPV4_SCHEME = 'ipv4';
30
+ const IPV6_SCHEME = 'ipv6';
31
+ /**
32
+ * The default TCP port to connect to if not explicitly specified in the target.
33
+ */
34
+ const DEFAULT_PORT = 443;
35
+ class IpResolver {
36
+ constructor(target, listener, channelOptions) {
37
+ var _a;
38
+ this.listener = listener;
39
+ this.addresses = [];
40
+ this.error = null;
41
+ this.hasReturnedResult = false;
42
+ trace('Resolver constructed for target ' + (0, uri_parser_1.uriToString)(target));
43
+ const addresses = [];
44
+ if (!(target.scheme === IPV4_SCHEME || target.scheme === IPV6_SCHEME)) {
45
+ this.error = {
46
+ code: constants_1.Status.UNAVAILABLE,
47
+ details: `Unrecognized scheme ${target.scheme} in IP resolver`,
48
+ metadata: new metadata_1.Metadata(),
49
+ };
50
+ return;
51
+ }
52
+ const pathList = target.path.split(',');
53
+ for (const path of pathList) {
54
+ const hostPort = (0, uri_parser_1.splitHostPort)(path);
55
+ if (hostPort === null) {
56
+ this.error = {
57
+ code: constants_1.Status.UNAVAILABLE,
58
+ details: `Failed to parse ${target.scheme} address ${path}`,
59
+ metadata: new metadata_1.Metadata(),
60
+ };
61
+ return;
62
+ }
63
+ if ((target.scheme === IPV4_SCHEME && !(0, net_1.isIPv4)(hostPort.host)) ||
64
+ (target.scheme === IPV6_SCHEME && !(0, net_1.isIPv6)(hostPort.host))) {
65
+ this.error = {
66
+ code: constants_1.Status.UNAVAILABLE,
67
+ details: `Failed to parse ${target.scheme} address ${path}`,
68
+ metadata: new metadata_1.Metadata(),
69
+ };
70
+ return;
71
+ }
72
+ addresses.push({
73
+ host: hostPort.host,
74
+ port: (_a = hostPort.port) !== null && _a !== void 0 ? _a : DEFAULT_PORT,
75
+ });
76
+ }
77
+ this.addresses = addresses;
78
+ trace('Parsed ' + target.scheme + ' address list ' + this.addresses);
79
+ }
80
+ updateResolution() {
81
+ if (!this.hasReturnedResult) {
82
+ this.hasReturnedResult = true;
83
+ process.nextTick(() => {
84
+ if (this.error) {
85
+ this.listener.onError(this.error);
86
+ }
87
+ else {
88
+ this.listener.onSuccessfulResolution(this.addresses, null, null, null, {});
89
+ }
90
+ });
91
+ }
92
+ }
93
+ destroy() {
94
+ this.hasReturnedResult = false;
95
+ }
96
+ static getDefaultAuthority(target) {
97
+ return target.path.split(',')[0];
98
+ }
99
+ }
100
+ function setup() {
101
+ (0, resolver_1.registerResolver)(IPV4_SCHEME, IpResolver);
102
+ (0, resolver_1.registerResolver)(IPV6_SCHEME, IpResolver);
103
+ }
104
+ //# sourceMappingURL=resolver-ip.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolver-ip.js","sourceRoot":"","sources":["../../src/resolver-ip.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;AAsGH,sBAGC;AAvGD,6BAAqC;AAGrC,2CAAmD;AACnD,yCAAsC;AACtC,yCAA0E;AAE1E,6CAAmE;AACnE,qCAAqC;AAErC,MAAM,WAAW,GAAG,aAAa,CAAC;AAElC,SAAS,KAAK,CAAC,IAAY;IACzB,OAAO,CAAC,KAAK,CAAC,wBAAY,CAAC,KAAK,EAAE,WAAW,EAAE,IAAI,CAAC,CAAC;AACvD,CAAC;AAED,MAAM,WAAW,GAAG,MAAM,CAAC;AAC3B,MAAM,WAAW,GAAG,MAAM,CAAC;AAE3B;;GAEG;AACH,MAAM,YAAY,GAAG,GAAG,CAAC;AAEzB,MAAM,UAAU;IAId,YACE,MAAe,EACP,QAA0B,EAClC,cAA8B;;QADtB,aAAQ,GAAR,QAAQ,CAAkB;QAL5B,cAAS,GAAwB,EAAE,CAAC;QACpC,UAAK,GAAwB,IAAI,CAAC;QAClC,sBAAiB,GAAG,KAAK,CAAC;QAMhC,KAAK,CAAC,kCAAkC,GAAG,IAAA,wBAAW,EAAC,MAAM,CAAC,CAAC,CAAC;QAChE,MAAM,SAAS,GAAwB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0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.setup = setup;
19
+ const resolver_1 = require("./resolver");
20
+ class UdsResolver {
21
+ constructor(target, listener, channelOptions) {
22
+ this.listener = listener;
23
+ this.addresses = [];
24
+ this.hasReturnedResult = false;
25
+ let path;
26
+ if (target.authority === '') {
27
+ path = '/' + target.path;
28
+ }
29
+ else {
30
+ path = target.path;
31
+ }
32
+ this.addresses = [{ path }];
33
+ }
34
+ updateResolution() {
35
+ if (!this.hasReturnedResult) {
36
+ this.hasReturnedResult = true;
37
+ process.nextTick(this.listener.onSuccessfulResolution, this.addresses, null, null, null, {});
38
+ }
39
+ }
40
+ destroy() {
41
+ // This resolver owns no resources, so we do nothing here.
42
+ }
43
+ static getDefaultAuthority(target) {
44
+ return 'localhost';
45
+ }
46
+ }
47
+ function setup() {
48
+ (0, resolver_1.registerResolver)('unix', UdsResolver);
49
+ }
50
+ //# sourceMappingURL=resolver-uds.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolver-uds.js","sourceRoot":"","sources":["../../src/resolver-uds.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;AA8CH,sBAEC;AA9CD,yCAA0E;AAK1E,MAAM,WAAW;IAGf,YACE,MAAe,EACP,QAA0B,EAClC,cAA8B;QADtB,aAAQ,GAAR,QAAQ,CAAkB;QAJ5B,cAAS,GAAwB,EAAE,CAAC;QACpC,sBAAiB,GAAG,KAAK,CAAC;QAMhC,IAAI,IAAY,CAAC;QACjB,IAAI,MAAM,CAAC,SAAS,KAAK,EAAE,EAAE,CAAC;YAC5B,IAAI,GAAG,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC;QAC3B,CAAC;aAAM,CAAC;YACN,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;QACrB,CAAC;QACD,IAAI,CAAC,SAAS,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9B,CAAC;IACD,gBAAgB;QACd,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC;YAC5B,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;YAC9B,OAAO,CAAC,QAAQ,CACd,IAAI,CAAC,QAAQ,CAAC,sBAAsB,EACpC,IAAI,CAAC,SAAS,EACd,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,EAAE,CACH,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO;QACL,0DAA0D;IAC5D,CAAC;IAED,MAAM,CAAC,mBAAmB,CAAC,MAAe;QACxC,OAAO,WAAW,CAAC;IACrB,CAAC;CACF;AAED,SAAgB,KAAK;IACnB,IAAA,2BAAgB,EAAC,MAAM,EAAE,WAAW,CAAC,CAAC;AACxC,CAAC"}
@@ -0,0 +1,105 @@
1
+ import { MethodConfig, ServiceConfig } from './service-config';
2
+ import { StatusObject } from './call-interface';
3
+ import { SubchannelAddress } from './subchannel-address';
4
+ import { GrpcUri } from './uri-parser';
5
+ import { ChannelOptions } from './channel-options';
6
+ import { Metadata } from './metadata';
7
+ import { Status } from './constants';
8
+ import { Filter, FilterFactory } from './filter';
9
+ export interface CallConfig {
10
+ methodConfig: MethodConfig;
11
+ onCommitted?: () => void;
12
+ pickInformation: {
13
+ [key: string]: string;
14
+ };
15
+ status: Status;
16
+ dynamicFilterFactories: FilterFactory<Filter>[];
17
+ }
18
+ /**
19
+ * Selects a configuration for a method given the name and metadata. Defined in
20
+ * https://github.com/grpc/proposal/blob/master/A31-xds-timeout-support-and-config-selector.md#new-functionality-in-grpc
21
+ */
22
+ export interface ConfigSelector {
23
+ (methodName: string, metadata: Metadata): CallConfig;
24
+ }
25
+ /**
26
+ * A listener object passed to the resolver's constructor that provides name
27
+ * resolution updates back to the resolver's owner.
28
+ */
29
+ export interface ResolverListener {
30
+ /**
31
+ * Called whenever the resolver has new name resolution results to report
32
+ * @param addressList The new list of backend addresses
33
+ * @param serviceConfig The new service configuration corresponding to the
34
+ * `addressList`. Will be `null` if no service configuration was
35
+ * retrieved or if the service configuration was invalid
36
+ * @param serviceConfigError If non-`null`, indicates that the retrieved
37
+ * service configuration was invalid
38
+ */
39
+ onSuccessfulResolution(addressList: SubchannelAddress[], serviceConfig: ServiceConfig | null, serviceConfigError: StatusObject | null, configSelector: ConfigSelector | null, attributes: {
40
+ [key: string]: unknown;
41
+ }): void;
42
+ /**
43
+ * Called whenever a name resolution attempt fails.
44
+ * @param error Describes how resolution failed
45
+ */
46
+ onError(error: StatusObject): void;
47
+ }
48
+ /**
49
+ * A resolver class that handles one or more of the name syntax schemes defined
50
+ * in the [gRPC Name Resolution document](https://github.com/grpc/grpc/blob/master/doc/naming.md)
51
+ */
52
+ export interface Resolver {
53
+ /**
54
+ * Indicates that the caller wants new name resolution data. Calling this
55
+ * function may eventually result in calling one of the `ResolverListener`
56
+ * functions, but that is not guaranteed. Those functions will never be
57
+ * called synchronously with the constructor or updateResolution.
58
+ */
59
+ updateResolution(): void;
60
+ /**
61
+ * Discard all resources owned by the resolver. A later call to
62
+ * `updateResolution` should reinitialize those resources. No
63
+ * `ResolverListener` callbacks should be called after `destroy` is called
64
+ * until `updateResolution` is called again.
65
+ */
66
+ destroy(): void;
67
+ }
68
+ export interface ResolverConstructor {
69
+ new (target: GrpcUri, listener: ResolverListener, channelOptions: ChannelOptions): Resolver;
70
+ /**
71
+ * Get the default authority for a target. This loosely corresponds to that
72
+ * target's hostname. Throws an error if this resolver class cannot parse the
73
+ * `target`.
74
+ * @param target
75
+ */
76
+ getDefaultAuthority(target: GrpcUri): string;
77
+ }
78
+ /**
79
+ * Register a resolver class to handle target names prefixed with the `prefix`
80
+ * string. This prefix should correspond to a URI scheme name listed in the
81
+ * [gRPC Name Resolution document](https://github.com/grpc/grpc/blob/master/doc/naming.md)
82
+ * @param prefix
83
+ * @param resolverClass
84
+ */
85
+ export declare function registerResolver(scheme: string, resolverClass: ResolverConstructor): void;
86
+ /**
87
+ * Register a default resolver to handle target names that do not start with
88
+ * any registered prefix.
89
+ * @param resolverClass
90
+ */
91
+ export declare function registerDefaultScheme(scheme: string): void;
92
+ /**
93
+ * Create a name resolver for the specified target, if possible. Throws an
94
+ * error if no such name resolver can be created.
95
+ * @param target
96
+ * @param listener
97
+ */
98
+ export declare function createResolver(target: GrpcUri, listener: ResolverListener, options: ChannelOptions): Resolver;
99
+ /**
100
+ * Get the default authority for the specified target, if possible. Throws an
101
+ * error if no registered name resolver can parse that target string.
102
+ * @param target
103
+ */
104
+ export declare function getDefaultAuthority(target: GrpcUri): string;
105
+ export declare function mapUriDefaultScheme(target: GrpcUri): GrpcUri | null;