From 21c6f8d75701a1eaead78051c332f6d3747f36b2 Mon Sep 17 00:00:00 2001 From: AJ Heller Date: Tue, 26 Apr 2022 11:02:59 -0700 Subject: [PATCH] Reland: Add DNS Server address override to the EventEngine API (#29493) This reverts commit fb4b6c7776a961d0106bb46a6d2ab8832dd87c0c. --- doc/naming.md | 5 +---- include/grpc/event_engine/event_engine.h | 14 +++++++++++--- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/doc/naming.md b/doc/naming.md index f975ffc25c9..5408e3c0638 100644 --- a/doc/naming.md +++ b/doc/naming.md @@ -46,11 +46,8 @@ Most gRPC implementations support the following URI schemes: - The name has no connection with filesystem pathnames. - No permissions will apply to the socket - any process/user may access the socket. - The underlying implementation of Abstract sockets uses a null byte ('\0') - as the first character; the implementation will prepend this null. Do not include + as the first character; the implementation will prepend this null. Do not include the null in `abstract_path`. - - `abstract_path` cannot contain null bytes. - - TODO(https://github.com/grpc/grpc/issues/24638): Unix allows abstract socket names to contain null bytes, - but this is not supported by the gRPC C-core implementation. The following schemes are supported by the gRPC C-core implementation, but may not be supported in other languages: diff --git a/include/grpc/event_engine/event_engine.h b/include/grpc/event_engine/event_engine.h index 63c92bf8720..18dc8d044c7 100644 --- a/include/grpc/event_engine/event_engine.h +++ b/include/grpc/event_engine/event_engine.h @@ -261,6 +261,12 @@ class EventEngine { struct LookupTaskHandle { intptr_t key[2]; }; + /// Optional configuration for DNSResolvers. + struct ResolverOptions { + /// If empty, default DNS servers will be used. + /// Must be in the "IP:port" format as described in naming.md. + std::string dns_server; + }; /// DNS SRV record type. struct SRVRecord { std::string host; @@ -293,7 +299,7 @@ class EventEngine { /// /// If cancelled, \a on_resolve will not be executed. virtual LookupTaskHandle LookupHostname(LookupHostnameCallback on_resolve, - absl::string_view address, + absl::string_view name, absl::string_view default_port, absl::Time deadline) = 0; /// Asynchronously perform an SRV record lookup. @@ -331,8 +337,10 @@ class EventEngine { // de-experimentalize this API. virtual bool IsWorkerThread() = 0; - /// Creates and returns an instance of a DNSResolver. - virtual std::unique_ptr GetDNSResolver() = 0; + /// Creates and returns an instance of a DNSResolver, optionally configured by + /// the \a options struct. + virtual std::unique_ptr GetDNSResolver( + const DNSResolver::ResolverOptions& options) = 0; /// Asynchronously executes a task as soon as possible. ///