MCPcopy Index your code
hub / github.com/MiniDNS/minidns

github.com/MiniDNS/minidns @1.1.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release 1.1.1 ↗ · + Follow
1,335 symbols 4,103 edges 173 files 182 documented · 14%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

MiniDNS - A DNSSEC enabled DNS library

Build Status Coverage Status

MiniDNS ("Modular Internet Name Informer for DNS") is a DNS library for Android and Java SE. It can parse resource records (A, AAAA, NS, SRV, …) and is easy to use and extend. MiniDNS aims to be secure, modular, efficient and as simple as possible. It also provides support for DNSSEC and DANE, and is thus the ideal resolver if you want to bring DNSSEC close to your application.

It comes with a pluggable cache mechanism, a pre-configured cache and an easy to use high-level API (minidns-hla) for those who just want to perform a reliable lookup of a domain name.

Notice: DNSSEC/DANE support has not yet undergo a security audit. If you find the project useful and if you are able to provide the resources for a security audit, then please contact us.

If you are looking for a DNSSEC-enabled resolver in C (and/or Lua) then hava a look at the Knot Resolver. Also this library is not intended to be used as a DNS server. You might want to look into dnsjava for such functionality.

MiniDNS release resources (javadoc, …) an be found at https://minidns.org/releases

Quickstart

The easiest way to use MiniDNS is by its high-level API provided by the minidns-hla Maven artifact. Simply add the artifact to your projects dependencies. For example with gradle

compile "org.minidns:minidns-hla:$minidnsVersion"

Then you can use the ResolverApi or DnssecResolverApi class to perform DNS lookups and check if the result was authenticated via DNSSEC. The following example shows a lookup of A records of 'verteiltesysteme.net'.

ResolverResult<A> result = DnssecResolverApi.INSTANCE.resolve("verteiltesysteme.net", A.class);
if (!result.wasSuccessful()) {
    RESPONSE_CODE responseCode = result.getResponseCode();
    // Perform error handling.
    …
    return;
}
if (!result.isAuthenticData()) {
    // Response was not secured with DNSSEC.
    …
    return;
}
Set<A> answers = result.getAnswers();
for (A a : answers) {
  InetAddress inetAddress = a.getInetAddress();
  // Do someting with the InetAddress, e.g. connect to.
  …
}

MiniDNS also provides full support for SRV resource records and their handling.

SrvResolverResult result = DnssecResolverApi.INSTANCE.resolveSrv(SrvType.xmpp_client, "example.org")
if (!result.wasSuccessful()) {
    RESPONSE_CODE responseCode = result.getResponseCode();
    // Perform error handling.
    …
    return;
}
if (!result.isAuthenticData()) {
    // Response was not secured with DNSSEC.
    …
    return;
}
List<ResolvedSrvRecord> srvRecords = result.getSortedSrvResolvedAddresses();
// Loop over the domain names pointed by the SRV RR. MiniDNS will return the list
// correctly sorted by the priority and weight of the related SRV RR.
for (ResolvedSrvRecord srvRecord : srvRecord) {
    // Loop over the Internet Address RRs resolved for the SRV RR. The order of
    // the list depends on the prefered IP version setting of MiniDNS.
    for (InternetAddressRR inetAddressRR : srvRecord.addresses) {
        InetAddress inetAddress = inetAddressRR.getInetAddress();
        int port = srvAddresses.port;
        // Try to connect to inetAddress at port.
        …
    }
}

REPL

MiniDNS comes with a REPL which can be used to perform DNS lookups and to test the library. Simple use ./repl to start the REPL. The loaded REPL comes with some predefined variables that you can use to perform lookups. For example c is a simple DNS client. See minidns-repl/scala.repl for more.

minidns $ ./repl
...
scala> c query ("measite.de", TYPE.A)
res0: dnsqueryresult.DnsQueryResult = DnsMessage@54653(QUERY NO_ERROR qr rd ra) { \
  [Q: measite.de.   IN  A] \
  [A: measite.de.   3599    IN  A   85.10.226.249] \
  [X: EDNS: version: 0, flags:; udp: 512]
}

Extension points exported contracts — how you extend this code

SignatureVerifier (Interface)
(no doc) [6 implementers]
minidns-dnssec/src/main/java/org/minidns/dnssec/SignatureVerifier.java
PreparedResponse (Interface)
(no doc) [5 implementers]
minidns-client/src/test/java/org/minidns/DnsWorld.java
IdnaTransformator (Interface)
(no doc) [3 implementers]
minidns-core/src/main/java/org/minidns/idna/IdnaTransformator.java
DigestCalculator (Interface)
(no doc) [2 implementers]
minidns-dnssec/src/main/java/org/minidns/dnssec/DigestCalculator.java
DnsDataSource (Interface)
(no doc) [2 implementers]
minidns-client/src/main/java/org/minidns/source/DnsDataSource.java
CallbackRecipient (Interface)
A recipient of success and exception callbacks. @param the type of the success value. @param the type of the ex [1 implementers]
minidns-core/src/main/java/org/minidns/util/CallbackRecipient.java
MiniDnsCacheFactory (Interface)
(no doc) [1 implementers]
minidns-client/src/main/java/org/minidns/cache/MiniDnsCacheFactory.java
ExceptionCallback (Interface)
(no doc) [1 implementers]
minidns-core/src/main/java/org/minidns/util/ExceptionCallback.java

Core symbols most depended-on inside this repo

size
called by 139
minidns-core/src/main/java/org/minidns/dnsname/DnsName.java
get
called by 130
minidns-client/src/main/java/org/minidns/DnsCache.java
from
called by 106
minidns-core/src/main/java/org/minidns/dnsname/DnsName.java
put
called by 47
minidns-client/src/main/java/org/minidns/DnsCache.java
toString
called by 37
minidns-core/src/main/java/org/minidns/record/A.java
toByteArray
called by 34
minidns-core/src/main/java/org/minidns/record/Data.java
queryDnssec
called by 29
minidns-dnssec/src/main/java/org/minidns/dnssec/DnssecClient.java
getName
called by 26
minidns-client/src/main/java/org/minidns/dnsserverlookup/DnsServerLookupMechanism.java

Shape

Method 1,086
Class 216
Enum 21
Interface 12

Languages

Java100%

Modules by API surface

minidns-core/src/main/java/org/minidns/dnsmessage/DnsMessage.java75 symbols
minidns-client/src/test/java/org/minidns/DnsWorld.java60 symbols
minidns-dnssec/src/main/java/org/minidns/dnssec/DnssecUnverifiedReason.java33 symbols
minidns-core/src/main/java/org/minidns/dnsname/DnsName.java33 symbols
minidns-async/src/main/java/org/minidns/source/async/AsyncDnsRequest.java32 symbols
minidns-dnssec/src/test/java/org/minidns/dnssec/DnssecWorld.java30 symbols
minidns-core/src/test/java/org/minidns/dnsmessage/DnsMessageTest.java27 symbols
minidns-core/src/main/java/org/minidns/record/Record.java26 symbols
minidns-dnssec/src/main/java/org/minidns/dnssec/DnssecClient.java24 symbols
minidns-client/src/main/java/org/minidns/AbstractDnsClient.java24 symbols
minidns-client/src/main/java/org/minidns/MiniDnsFuture.java23 symbols
minidns-core/src/main/java/org/minidns/dnslabel/DnsLabel.java22 symbols

For agents

$ claude mcp add minidns \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact