blob: 96ac521a91b6c7880284138e739fb1380553554a [file] [log] [blame]
Craig Tillercd29c582015-06-24 09:15:15 -07001/*
2 *
Craig Tiller6169d5f2016-03-31 07:46:18 -07003 * Copyright 2015, Google Inc.
Craig Tillercd29c582015-06-24 09:15:15 -07004 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met:
9 *
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above
13 * copyright notice, this list of conditions and the following disclaimer
14 * in the documentation and/or other materials provided with the
15 * distribution.
16 * * Neither the name of Google Inc. nor the names of its
17 * contributors may be used to endorse or promote products derived from
18 * this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 *
32 */
33
Craig Tiller3bc8ebd2015-06-24 15:41:15 -070034#include <string.h>
35
36#include <grpc/support/alloc.h>
Craig Tiller6b9f5c62015-07-29 18:47:35 -070037#include <grpc/support/host_port.h>
Craig Tiller3bc8ebd2015-06-24 15:41:15 -070038#include <grpc/support/string_util.h>
39
Mark D. Roth2137cd82016-09-14 09:04:00 -070040#include "src/core/ext/client_channel/lb_policy_registry.h"
41#include "src/core/ext/client_channel/resolver_registry.h"
Mark D. Roth98abfd32016-10-21 08:10:51 -070042#include "src/core/lib/channel/channel_args.h"
Craig Tiller972470b2017-02-09 15:05:36 -080043#include "src/core/lib/iomgr/combiner.h"
Craig Tiller9533d042016-03-25 17:11:06 -070044#include "src/core/lib/iomgr/resolve_address.h"
45#include "src/core/lib/iomgr/timer.h"
46#include "src/core/lib/support/backoff.h"
47#include "src/core/lib/support/string.h"
Craig Tiller3bc8ebd2015-06-24 15:41:15 -070048
David Garcia Quintas1edfb952016-11-22 17:15:34 -080049#define GRPC_DNS_MIN_CONNECT_TIMEOUT_SECONDS 1
50#define GRPC_DNS_INITIAL_CONNECT_BACKOFF_SECONDS 1
51#define GRPC_DNS_RECONNECT_BACKOFF_MULTIPLIER 1.6
52#define GRPC_DNS_RECONNECT_MAX_BACKOFF_SECONDS 120
53#define GRPC_DNS_RECONNECT_JITTER 0.2
Craig Tiller476bb3b2016-03-11 12:54:40 -080054
Craig Tillera82950e2015-09-22 12:33:20 -070055typedef struct {
Craig Tiller3bc8ebd2015-06-24 15:41:15 -070056 /** base class: must be first */
57 grpc_resolver base;
Mark D. Rothaf842452016-10-21 15:05:15 -070058 /** name to resolve */
Mark D. Roth28ea7e22016-07-25 11:06:22 -070059 char *name_to_resolve;
Craig Tiller3bc8ebd2015-06-24 15:41:15 -070060 /** default port to use */
61 char *default_port;
Mark D. Roth98abfd32016-10-21 08:10:51 -070062 /** channel args. */
63 grpc_channel_args *channel_args;
Yuchen Zeng63e3e3b2016-12-15 12:06:33 -080064 /** pollset_set to drive the name resolution process */
65 grpc_pollset_set *interested_parties;
Craig Tiller3bc8ebd2015-06-24 15:41:15 -070066
Craig Tiller3bc8ebd2015-06-24 15:41:15 -070067 /** are we currently resolving? */
Mark D. Rothe273b032016-07-22 13:24:21 -070068 bool resolving;
Mark D. Rothff4df062016-08-22 15:02:49 -070069 /** which version of the result have we published? */
Craig Tiller3bc8ebd2015-06-24 15:41:15 -070070 int published_version;
Mark D. Rothff4df062016-08-22 15:02:49 -070071 /** which version of the result is current? */
Craig Tiller3bc8ebd2015-06-24 15:41:15 -070072 int resolved_version;
73 /** pending next completion, or NULL */
Craig Tiller33825112015-09-18 07:44:19 -070074 grpc_closure *next_completion;
Mark D. Rothff4df062016-08-22 15:02:49 -070075 /** target result address for next completion */
Mark D. Rothaf842452016-10-21 15:05:15 -070076 grpc_channel_args **target_result;
Mark D. Rothff4df062016-08-22 15:02:49 -070077 /** current (fully resolved) result */
Mark D. Rothaf842452016-10-21 15:05:15 -070078 grpc_channel_args *resolved_result;
Craig Tiller1e55bd42016-03-11 09:47:43 -080079 /** retry timer */
80 bool have_retry_timer;
81 grpc_timer retry_timer;
Masood Malekghassemib5b43722017-01-05 15:07:26 -080082 grpc_closure on_retry;
Craig Tiller476bb3b2016-03-11 12:54:40 -080083 /** retry backoff state */
84 gpr_backoff backoff_state;
Craig Tiller804ff712016-05-05 16:25:40 -070085
86 /** currently resolving addresses */
87 grpc_resolved_addresses *addresses;
Craig Tiller3bc8ebd2015-06-24 15:41:15 -070088} dns_resolver;
89
Craig Tillera82950e2015-09-22 12:33:20 -070090static void dns_destroy(grpc_exec_ctx *exec_ctx, grpc_resolver *r);
Craig Tiller3bc8ebd2015-06-24 15:41:15 -070091
Craig Tiller24d687e2016-04-13 19:47:27 -070092static void dns_start_resolving_locked(grpc_exec_ctx *exec_ctx,
93 dns_resolver *r);
Craig Tillera82950e2015-09-22 12:33:20 -070094static void dns_maybe_finish_next_locked(grpc_exec_ctx *exec_ctx,
95 dns_resolver *r);
Craig Tiller3bc8ebd2015-06-24 15:41:15 -070096
Craig Tiller972470b2017-02-09 15:05:36 -080097static void dns_shutdown_locked(grpc_exec_ctx *exec_ctx, grpc_resolver *r);
98static void dns_channel_saw_error_locked(grpc_exec_ctx *exec_ctx,
99 grpc_resolver *r);
100static void dns_next_locked(grpc_exec_ctx *exec_ctx, grpc_resolver *r,
101 grpc_channel_args **target_result,
102 grpc_closure *on_complete);
Craig Tiller3bc8ebd2015-06-24 15:41:15 -0700103
104static const grpc_resolver_vtable dns_resolver_vtable = {
Craig Tiller972470b2017-02-09 15:05:36 -0800105 dns_destroy, dns_shutdown_locked, dns_channel_saw_error_locked,
106 dns_next_locked};
Craig Tiller3bc8ebd2015-06-24 15:41:15 -0700107
Craig Tiller972470b2017-02-09 15:05:36 -0800108static void dns_shutdown_locked(grpc_exec_ctx *exec_ctx,
109 grpc_resolver *resolver) {
Craig Tillera82950e2015-09-22 12:33:20 -0700110 dns_resolver *r = (dns_resolver *)resolver;
Craig Tillere2327db2016-03-11 09:52:42 -0800111 if (r->have_retry_timer) {
112 grpc_timer_cancel(exec_ctx, &r->retry_timer);
113 }
Craig Tillera82950e2015-09-22 12:33:20 -0700114 if (r->next_completion != NULL) {
Mark D. Rothff4df062016-08-22 15:02:49 -0700115 *r->target_result = NULL;
Craig Tiller91031da2016-12-28 15:44:25 -0800116 grpc_closure_sched(exec_ctx, r->next_completion,
117 GRPC_ERROR_CREATE("Resolver Shutdown"));
Craig Tillera82950e2015-09-22 12:33:20 -0700118 r->next_completion = NULL;
119 }
Craig Tiller3bc8ebd2015-06-24 15:41:15 -0700120}
121
Craig Tiller972470b2017-02-09 15:05:36 -0800122static void dns_channel_saw_error_locked(grpc_exec_ctx *exec_ctx,
123 grpc_resolver *resolver) {
Craig Tillera82950e2015-09-22 12:33:20 -0700124 dns_resolver *r = (dns_resolver *)resolver;
Craig Tillera82950e2015-09-22 12:33:20 -0700125 if (!r->resolving) {
Craig Tiller476bb3b2016-03-11 12:54:40 -0800126 gpr_backoff_reset(&r->backoff_state);
Craig Tiller24d687e2016-04-13 19:47:27 -0700127 dns_start_resolving_locked(exec_ctx, r);
Craig Tillera82950e2015-09-22 12:33:20 -0700128 }
Craig Tiller3bc8ebd2015-06-24 15:41:15 -0700129}
130
Craig Tiller972470b2017-02-09 15:05:36 -0800131static void dns_next_locked(grpc_exec_ctx *exec_ctx, grpc_resolver *resolver,
132 grpc_channel_args **target_result,
133 grpc_closure *on_complete) {
Craig Tillera82950e2015-09-22 12:33:20 -0700134 dns_resolver *r = (dns_resolver *)resolver;
Craig Tillera82950e2015-09-22 12:33:20 -0700135 GPR_ASSERT(!r->next_completion);
Craig Tiller3bc8ebd2015-06-24 15:41:15 -0700136 r->next_completion = on_complete;
Mark D. Rothff4df062016-08-22 15:02:49 -0700137 r->target_result = target_result;
Craig Tillera82950e2015-09-22 12:33:20 -0700138 if (r->resolved_version == 0 && !r->resolving) {
Craig Tiller476bb3b2016-03-11 12:54:40 -0800139 gpr_backoff_reset(&r->backoff_state);
Craig Tiller24d687e2016-04-13 19:47:27 -0700140 dns_start_resolving_locked(exec_ctx, r);
Craig Tillera82950e2015-09-22 12:33:20 -0700141 } else {
142 dns_maybe_finish_next_locked(exec_ctx, r);
143 }
Craig Tiller3bc8ebd2015-06-24 15:41:15 -0700144}
145
Craig Tiller972470b2017-02-09 15:05:36 -0800146static void dns_on_retry_timer_locked(grpc_exec_ctx *exec_ctx, void *arg,
147 grpc_error *error) {
Craig Tiller1e55bd42016-03-11 09:47:43 -0800148 dns_resolver *r = arg;
149
Craig Tillere2327db2016-03-11 09:52:42 -0800150 r->have_retry_timer = false;
Craig Tiller804ff712016-05-05 16:25:40 -0700151 if (error == GRPC_ERROR_NONE) {
Craig Tiller1e55bd42016-03-11 09:47:43 -0800152 if (!r->resolving) {
Craig Tiller24d687e2016-04-13 19:47:27 -0700153 dns_start_resolving_locked(exec_ctx, r);
Craig Tiller1e55bd42016-03-11 09:47:43 -0800154 }
Craig Tiller1e55bd42016-03-11 09:47:43 -0800155 }
156
157 GRPC_RESOLVER_UNREF(exec_ctx, &r->base, "retry-timer");
158}
159
Craig Tiller972470b2017-02-09 15:05:36 -0800160static void dns_on_resolved_locked(grpc_exec_ctx *exec_ctx, void *arg,
161 grpc_error *error) {
Craig Tiller3bc8ebd2015-06-24 15:41:15 -0700162 dns_resolver *r = arg;
Mark D. Rothaf842452016-10-21 15:05:15 -0700163 grpc_channel_args *result = NULL;
Craig Tiller1e55bd42016-03-11 09:47:43 -0800164 GPR_ASSERT(r->resolving);
Mark D. Rothe273b032016-07-22 13:24:21 -0700165 r->resolving = false;
Mark D. Rothe011b1e2016-09-07 08:28:00 -0700166 if (r->addresses != NULL) {
Mark D. Roth16883a32016-10-21 10:30:58 -0700167 grpc_lb_addresses *addresses = grpc_lb_addresses_create(
168 r->addresses->naddrs, NULL /* user_data_vtable */);
Mark D. Rothe011b1e2016-09-07 08:28:00 -0700169 for (size_t i = 0; i < r->addresses->naddrs; ++i) {
Mark D. Rothc5c38782016-09-16 08:51:01 -0700170 grpc_lb_addresses_set_address(
Mark D. Rothee5173f2016-09-16 10:14:18 -0700171 addresses, i, &r->addresses->addrs[i].addr,
Mark D. Rothc5c38782016-09-16 08:51:01 -0700172 r->addresses->addrs[i].len, false /* is_balancer */,
173 NULL /* balancer_name */, NULL /* user_data */);
David Garcia Quintas331b9c02016-09-12 18:37:05 -0700174 }
Mark D. Roth36869962016-10-21 10:43:45 -0700175 grpc_arg new_arg = grpc_lb_addresses_create_channel_arg(addresses);
Mark D. Rothaf842452016-10-21 15:05:15 -0700176 result = grpc_channel_args_copy_and_add(r->channel_args, &new_arg, 1);
Mark D. Rothe011b1e2016-09-07 08:28:00 -0700177 grpc_resolved_addresses_destroy(r->addresses);
Craig Tiller4cc1c352016-12-27 08:48:01 -0800178 grpc_lb_addresses_destroy(exec_ctx, addresses);
Craig Tiller1e55bd42016-03-11 09:47:43 -0800179 } else {
Craig Tiller476bb3b2016-03-11 12:54:40 -0800180 gpr_timespec now = gpr_now(GPR_CLOCK_MONOTONIC);
181 gpr_timespec next_try = gpr_backoff_step(&r->backoff_state, now);
182 gpr_timespec timeout = gpr_time_sub(next_try, now);
Craig Tiller7c70b6c2017-01-23 07:48:42 -0800183 gpr_log(GPR_INFO, "dns resolution failed (will retry): %s",
184 grpc_error_string(error));
Craig Tiller1e55bd42016-03-11 09:47:43 -0800185 GPR_ASSERT(!r->have_retry_timer);
186 r->have_retry_timer = true;
Craig Tiller1e55bd42016-03-11 09:47:43 -0800187 GRPC_RESOLVER_REF(&r->base, "retry-timer");
David Garcia Quintas8c2e8b42016-10-30 15:13:04 +0100188 if (gpr_time_cmp(timeout, gpr_time_0(timeout.clock_type)) > 0) {
Craig Tiller13c09402016-06-15 09:41:33 -0700189 gpr_log(GPR_DEBUG, "retrying in %" PRId64 ".%09d seconds", timeout.tv_sec,
Craig Tillerdf30bc52016-06-01 14:08:50 -0700190 timeout.tv_nsec);
Craig Tiller8cdc4e52016-06-01 14:03:28 -0700191 } else {
192 gpr_log(GPR_DEBUG, "retrying immediately");
193 }
Craig Tiller972470b2017-02-09 15:05:36 -0800194 grpc_closure_init(&r->on_retry, dns_on_retry_timer_locked, r,
Craig Tiller0bfad142017-02-17 16:01:08 -0800195 grpc_combiner_scheduler(r->base.combiner, false));
Masood Malekghassemib5b43722017-01-05 15:07:26 -0800196 grpc_timer_init(exec_ctx, &r->retry_timer, next_try, &r->on_retry, now);
Craig Tillera82950e2015-09-22 12:33:20 -0700197 }
Mark D. Rothaf842452016-10-21 15:05:15 -0700198 if (r->resolved_result != NULL) {
Craig Tiller4cc1c352016-12-27 08:48:01 -0800199 grpc_channel_args_destroy(exec_ctx, r->resolved_result);
Craig Tillera82950e2015-09-22 12:33:20 -0700200 }
Mark D. Rothff4df062016-08-22 15:02:49 -0700201 r->resolved_result = result;
Craig Tiller3bc8ebd2015-06-24 15:41:15 -0700202 r->resolved_version++;
Craig Tillera82950e2015-09-22 12:33:20 -0700203 dns_maybe_finish_next_locked(exec_ctx, r);
Craig Tillerd7b68e72015-06-28 11:41:09 -0700204
Craig Tillera82950e2015-09-22 12:33:20 -0700205 GRPC_RESOLVER_UNREF(exec_ctx, &r->base, "dns-resolving");
Craig Tiller3bc8ebd2015-06-24 15:41:15 -0700206}
207
Craig Tiller24d687e2016-04-13 19:47:27 -0700208static void dns_start_resolving_locked(grpc_exec_ctx *exec_ctx,
209 dns_resolver *r) {
Craig Tillera82950e2015-09-22 12:33:20 -0700210 GRPC_RESOLVER_REF(&r->base, "dns-resolving");
211 GPR_ASSERT(!r->resolving);
Mark D. Rothe273b032016-07-22 13:24:21 -0700212 r->resolving = true;
Craig Tillerd0397222016-05-12 16:53:27 -0700213 r->addresses = NULL;
Craig Tiller91031da2016-12-28 15:44:25 -0800214 grpc_resolve_address(
215 exec_ctx, r->name_to_resolve, r->default_port, r->interested_parties,
Craig Tiller972470b2017-02-09 15:05:36 -0800216 grpc_closure_create(dns_on_resolved_locked, r,
Craig Tiller0bfad142017-02-17 16:01:08 -0800217 grpc_combiner_scheduler(r->base.combiner, false)),
Craig Tiller91031da2016-12-28 15:44:25 -0800218 &r->addresses);
Craig Tiller3bc8ebd2015-06-24 15:41:15 -0700219}
220
Craig Tillera82950e2015-09-22 12:33:20 -0700221static void dns_maybe_finish_next_locked(grpc_exec_ctx *exec_ctx,
222 dns_resolver *r) {
223 if (r->next_completion != NULL &&
224 r->resolved_version != r->published_version) {
Mark D. Rothb367c1b2016-10-24 12:59:07 -0700225 *r->target_result = r->resolved_result == NULL
226 ? NULL
227 : grpc_channel_args_copy(r->resolved_result);
Craig Tiller91031da2016-12-28 15:44:25 -0800228 grpc_closure_sched(exec_ctx, r->next_completion, GRPC_ERROR_NONE);
Craig Tillera82950e2015-09-22 12:33:20 -0700229 r->next_completion = NULL;
230 r->published_version = r->resolved_version;
231 }
Craig Tiller3bc8ebd2015-06-24 15:41:15 -0700232}
233
Craig Tillera82950e2015-09-22 12:33:20 -0700234static void dns_destroy(grpc_exec_ctx *exec_ctx, grpc_resolver *gr) {
235 dns_resolver *r = (dns_resolver *)gr;
Mark D. Rothaf842452016-10-21 15:05:15 -0700236 if (r->resolved_result != NULL) {
Craig Tiller4cc1c352016-12-27 08:48:01 -0800237 grpc_channel_args_destroy(exec_ctx, r->resolved_result);
Craig Tillera82950e2015-09-22 12:33:20 -0700238 }
Craig Tiller9e5ac1b2017-02-14 22:25:50 -0800239 grpc_pollset_set_destroy(exec_ctx, r->interested_parties);
Mark D. Roth28ea7e22016-07-25 11:06:22 -0700240 gpr_free(r->name_to_resolve);
Craig Tillera82950e2015-09-22 12:33:20 -0700241 gpr_free(r->default_port);
Craig Tiller4cc1c352016-12-27 08:48:01 -0800242 grpc_channel_args_destroy(exec_ctx, r->channel_args);
Craig Tillera82950e2015-09-22 12:33:20 -0700243 gpr_free(r);
Craig Tiller3bc8ebd2015-06-24 15:41:15 -0700244}
245
Yuchen Zeng63e3e3b2016-12-15 12:06:33 -0800246static grpc_resolver *dns_create(grpc_exec_ctx *exec_ctx,
247 grpc_resolver_args *args,
Mark D. Roth88405f72016-10-03 08:24:52 -0700248 const char *default_port) {
Craig Tillera82950e2015-09-22 12:33:20 -0700249 if (0 != strcmp(args->uri->authority, "")) {
250 gpr_log(GPR_ERROR, "authority based dns uri's not supported");
251 return NULL;
252 }
Mark D. Roth39b58712016-09-06 12:50:42 -0700253 // Get name from args.
Mark D. Roth37225c42017-01-18 07:23:36 -0800254 char *path = args->uri->path;
Craig Tillera82950e2015-09-22 12:33:20 -0700255 if (path[0] == '/') ++path;
Mark D. Roth28ea7e22016-07-25 11:06:22 -0700256 // Create resolver.
257 dns_resolver *r = gpr_malloc(sizeof(dns_resolver));
Craig Tillera82950e2015-09-22 12:33:20 -0700258 memset(r, 0, sizeof(*r));
Craig Tiller0bfad142017-02-17 16:01:08 -0800259 grpc_resolver_init(&r->base, &dns_resolver_vtable, args->combiner);
Mark D. Rothd58a9852017-01-18 08:28:57 -0800260 r->name_to_resolve = gpr_strdup(path);
Craig Tillera82950e2015-09-22 12:33:20 -0700261 r->default_port = gpr_strdup(default_port);
Mark D. Roth201db7d2016-12-12 09:36:02 -0800262 r->channel_args = grpc_channel_args_copy(args->args);
Yuchen Zeng63e3e3b2016-12-15 12:06:33 -0800263 r->interested_parties = grpc_pollset_set_create();
264 if (args->pollset_set != NULL) {
265 grpc_pollset_set_add_pollset_set(exec_ctx, r->interested_parties,
266 args->pollset_set);
267 }
David Garcia Quintas1edfb952016-11-22 17:15:34 -0800268 gpr_backoff_init(&r->backoff_state, GRPC_DNS_INITIAL_CONNECT_BACKOFF_SECONDS,
269 GRPC_DNS_RECONNECT_BACKOFF_MULTIPLIER,
270 GRPC_DNS_RECONNECT_JITTER,
271 GRPC_DNS_MIN_CONNECT_TIMEOUT_SECONDS * 1000,
272 GRPC_DNS_RECONNECT_MAX_BACKOFF_SECONDS * 1000);
Craig Tiller3bc8ebd2015-06-24 15:41:15 -0700273 return &r->base;
274}
275
276/*
277 * FACTORY
278 */
279
Craig Tillera82950e2015-09-22 12:33:20 -0700280static void dns_factory_ref(grpc_resolver_factory *factory) {}
281
282static void dns_factory_unref(grpc_resolver_factory *factory) {}
283
284static grpc_resolver *dns_factory_create_resolver(
Yuchen Zeng63e3e3b2016-12-15 12:06:33 -0800285 grpc_exec_ctx *exec_ctx, grpc_resolver_factory *factory,
286 grpc_resolver_args *args) {
287 return dns_create(exec_ctx, args, "https");
Craig Tiller3bc8ebd2015-06-24 15:41:15 -0700288}
289
Craig Tiller65938df2016-03-31 13:08:49 -0700290static char *dns_factory_get_default_host_name(grpc_resolver_factory *factory,
291 grpc_uri *uri) {
Craig Tillerbc85be12015-08-24 10:36:39 -0700292 const char *path = uri->path;
Craig Tillera82950e2015-09-22 12:33:20 -0700293 if (path[0] == '/') ++path;
294 return gpr_strdup(path);
Craig Tillerbc85be12015-08-24 10:36:39 -0700295}
296
Craig Tiller3bc8ebd2015-06-24 15:41:15 -0700297static const grpc_resolver_factory_vtable dns_factory_vtable = {
Craig Tillera82950e2015-09-22 12:33:20 -0700298 dns_factory_ref, dns_factory_unref, dns_factory_create_resolver,
299 dns_factory_get_default_host_name, "dns"};
300static grpc_resolver_factory dns_resolver_factory = {&dns_factory_vtable};
Craig Tiller3bc8ebd2015-06-24 15:41:15 -0700301
Craig Tiller65938df2016-03-31 13:08:49 -0700302static grpc_resolver_factory *dns_resolver_factory_create() {
Craig Tillereb3b12e2015-06-26 14:42:49 -0700303 return &dns_resolver_factory;
Craig Tiller3bc8ebd2015-06-24 15:41:15 -0700304}
Craig Tiller65938df2016-03-31 13:08:49 -0700305
306void grpc_resolver_dns_native_init(void) {
307 grpc_register_resolver_type(dns_resolver_factory_create());
308}
309
310void grpc_resolver_dns_native_shutdown(void) {}