Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoyee Cheung <joyeec9h3@gmail.com>2022-09-14 10:08:26 +0300
committerJoyee Cheung <joyeec9h3@gmail.com>2022-09-28 20:58:21 +0300
commit8821860f11a94e69ba642d874d3226480a68fc1b (patch)
treefe58fbf1bbaa791753d1a0076c24a2c1b63d3ba5 /src/cares_wrap.cc
parent7b368552743a713268a5a1b5c9d72eb82c1c8895 (diff)
dns: support dns module in the snapshot
For the initial iteration, only the default resolver can be serialized/deserialized. If `dns.setServers()` has been called, we'll preserve the configured DNS servers in the snapshot. We can consider exposing the serialization method if it becomes necessary for user-land snapshots. PR-URL: https://github.com/nodejs/node/pull/44633 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Diffstat (limited to 'src/cares_wrap.cc')
-rw-r--r--src/cares_wrap.cc36
1 files changed, 33 insertions, 3 deletions
diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc
index d19705f94e7..eb3ebceeca6 100644
--- a/src/cares_wrap.cc
+++ b/src/cares_wrap.cc
@@ -19,18 +19,19 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
+#include "cares_wrap.h"
#include "async_wrap-inl.h"
-#include "base_object-inl.h"
#include "base64-inl.h"
-#include "cares_wrap.h"
+#include "base_object-inl.h"
#include "env-inl.h"
#include "memory_tracker-inl.h"
#include "node.h"
#include "node_errors.h"
+#include "node_external_reference.h"
#include "req_wrap-inl.h"
#include "util-inl.h"
-#include "v8.h"
#include "uv.h"
+#include "v8.h"
#include <cerrno>
#include <cstring>
@@ -1955,7 +1956,36 @@ void Initialize(Local<Object> target,
SetConstructorFunction(context, target, "ChannelWrap", channel_wrap);
}
+void RegisterExternalReferences(ExternalReferenceRegistry* registry) {
+ registry->Register(GetAddrInfo);
+ registry->Register(GetNameInfo);
+ registry->Register(CanonicalizeIP);
+ registry->Register(StrError);
+ registry->Register(ChannelWrap::New);
+
+ registry->Register(Query<QueryAnyWrap>);
+ registry->Register(Query<QueryAWrap>);
+ registry->Register(Query<QueryAaaaWrap>);
+ registry->Register(Query<QueryCaaWrap>);
+ registry->Register(Query<QueryCnameWrap>);
+ registry->Register(Query<QueryMxWrap>);
+ registry->Register(Query<QueryNsWrap>);
+ registry->Register(Query<QueryTxtWrap>);
+ registry->Register(Query<QuerySrvWrap>);
+ registry->Register(Query<QueryPtrWrap>);
+ registry->Register(Query<QueryNaptrWrap>);
+ registry->Register(Query<QuerySoaWrap>);
+ registry->Register(Query<GetHostByAddrWrap>);
+
+ registry->Register(GetServers);
+ registry->Register(SetServers);
+ registry->Register(SetLocalAddress);
+ registry->Register(Cancel);
+}
+
} // namespace cares_wrap
} // namespace node
NODE_MODULE_CONTEXT_AWARE_INTERNAL(cares_wrap, node::cares_wrap::Initialize)
+NODE_MODULE_EXTERNAL_REFERENCE(cares_wrap,
+ node::cares_wrap::RegisterExternalReferences)