How to use the getdns.RRTYPE_A function in getdns

To help you get started, we’ve selected a few getdns examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github getdnsapi / getdns-node / samples / getdns-resolver-check-tls / app.js View on Github external
res1 += "<ul>";
    res1 += "<li>Target Resolver: " + resolver + "</li>";
    res1 += "<li>Recursive's Hostname in Certificate (SubjectName): " + hostname + "</li>";
    res1 += "</ul>";

    res1 += "<h2>Checking for</h2>";
    res1 += "<ol>";
    res1 += "<li>Successful TCP connection</li>";
    res1 += "<li>Successful TLS connection</li>";
    res1 += "<li>Successful TLS Authentication (Hostname match to server certificate)</li>";
    res1 += "<li>Opportunistic TLS with fallback to TCP available</li>";
    res1 += "</ol>";

    res1 += "<h2>Result</h2>";

    context.general(query, getdns.RRTYPE_A, (err0, result0) =&gt; {
        if (err0) {
            // NOTE: TLS auth error.
            context.destroy();
            context1.general(query, getdns.RRTYPE_A, (err1, result1) =&gt; {
                if (err1) {
                    // NOTE: Try TLS no auth.
                    context1.destroy();
                    context2.general(query, getdns.RRTYPE_A, (err2, result2) =&gt; {
                        if (err2) {
                            // NOTE: TCP only failed.
                            /* eslint-disable no-console */
                            console.error("Error2 = " + JSON.stringify(err2));
                            /* eslint-enable no-console */

                            res1 += "<p>❌ No TCP, no TLS!</p>";
                        } else if (result2.status === 900) {
github getdnsapi / getdns-node / samples / getdns-resolver-check-tls / app.js View on Github external
context.general(query, getdns.RRTYPE_A, (err0, result0) =&gt; {
        if (err0) {
            // NOTE: TLS auth error.
            context.destroy();
            context1.general(query, getdns.RRTYPE_A, (err1, result1) =&gt; {
                if (err1) {
                    // NOTE: Try TLS no auth.
                    context1.destroy();
                    context2.general(query, getdns.RRTYPE_A, (err2, result2) =&gt; {
                        if (err2) {
                            // NOTE: TCP only failed.
                            /* eslint-disable no-console */
                            console.error("Error2 = " + JSON.stringify(err2));
                            /* eslint-enable no-console */

                            res1 += "<p>❌ No TCP, no TLS!</p>";
                        } else if (result2.status === 900) {
                            // NOTE: TCP worked.

                            /* eslint-disable no-console */
                            console.log("In callback TCP fallback worked " + JSON.stringify(result2.replies_tree));
github getdnsapi / getdns-node / samples / getdns-node-sample-console-pretty / index.js View on Github external
"8.8.8.8",
    ],
    // Always return dnssec status.
    return_dnssec_status: true,
};

// Create the context with the above options.
// When done with a context, it must be explicitly destroyed, for example in a callback.
const context = getdns.createContext(options);

// Getdns general.
// Third argument may be a dictionary for extensions.
// Last argument must be a callback.
// Returns a transaction id, which may be used to cancel the request.
/* eslint-disable no-unused-vars */
const transactionId = context.general("labs.verisigninc.com", getdns.RRTYPE_A, generalCallback);
/* eslint-enable no-unused-vars */

// Cancel a request.
//context.cancel(transactionId);

// Other getdns context methods.
// NOTE: don't destroy context in callback so it can be reused.
// Extensions are passed as dictionaries where the value for on/off are normal booleans.
context.address("nlnetlabs.nl", { dnssec_return_only_secure: true }, addressCallback);
context.service("dnssec-name-and-shame.com", serviceCallback);
context.hostname("8.8.8.8", hostnameCallback);

process.on("beforeExit", () => {
    // NOTE: remember to explicitly destroy the context after being done with lookups.
    context.destroy();
});

getdns

getdns bindings for Node.js. getdns is a modern asynchronous DNS API. It implements DNS entry points from a design developed and vetted by application developers, in an API specification.

BSD-3-Clause
Latest version published 4 years ago

Package Health Score

49 / 100
Full package analysis