All Projects → 256dpi → newdns

256dpi / newdns

Licence: MIT license
A library for building custom DNS servers in Go.

Programming Languages

go
31211 projects - #10 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to newdns

Dnsguide
A guide to writing a DNS Server from scratch in Rust
Stars: ✭ 2,226 (+5465%)
Mutual labels:  dns, dns-server
xip.name
Simple wildcard DNS inspired by xip.io
Stars: ✭ 143 (+257.5%)
Mutual labels:  dns, dns-server
Dcompass
[WIP] High-performance programmable DNS server aiming at robustness, speed, and flexibility
Stars: ✭ 174 (+335%)
Mutual labels:  dns, dns-server
Unbound Docker
Unbound DNS Server Docker Image
Stars: ✭ 147 (+267.5%)
Mutual labels:  dns, dns-server
Secureoperator
A DNS-protocol proxy for DNS-over-HTTPS providers, such as Google and Cloudflare
Stars: ✭ 241 (+502.5%)
Mutual labels:  dns, dns-server
Routedns
DNS stub resolver, proxy and router with support for DoT, DoH, DoQ, and DTLS
Stars: ✭ 153 (+282.5%)
Mutual labels:  dns, dns-server
afdns
Ad free DNS server. A docker container with a DNS server configured to block advertisement hosts.
Stars: ✭ 27 (-32.5%)
Mutual labels:  dns, dns-server
Tor Router
A SOCKS, HTTP and DNS proxy for distributing traffic across multiple instances of Tor
Stars: ✭ 69 (+72.5%)
Mutual labels:  dns, dns-server
Blahdns
A small hobby ads block dns project with doh, dot, dnscrypt support.
Stars: ✭ 228 (+470%)
Mutual labels:  dns, dns-server
Nativepayload dns
C# code for Transferring Backdoor Payloads by DNS Traffic and Bypassing Anti-viruses
Stars: ✭ 228 (+470%)
Mutual labels:  dns, dns-server
Trust Dns
A Rust based DNS client, server, and resolver
Stars: ✭ 2,155 (+5287.5%)
Mutual labels:  dns, dns-server
docker-nxfilter
🐳 Run NxFilter in Docker!
Stars: ✭ 28 (-30%)
Mutual labels:  dns, dns-server
Knot
A mirrored repository
Stars: ✭ 138 (+245%)
Mutual labels:  dns, dns-server
Pihole Unbound
Guide to setup Unbound recursive DNS resolver with Pi-Hole. With additional configs for speed and security!! 🚀🔒
Stars: ✭ 165 (+312.5%)
Mutual labels:  dns, dns-server
Sliver
Adversary Simulation Framework
Stars: ✭ 1,348 (+3270%)
Mutual labels:  dns, dns-server
Bind9
Mirror of https://gitlab.isc.org/isc-projects/bind9, please submit issues and PR/MRs in the GitLab.
Stars: ✭ 197 (+392.5%)
Mutual labels:  dns, dns-server
Simpledns
A very simple and small DNS Server to help understanding the protocol basics.
Stars: ✭ 62 (+55%)
Mutual labels:  dns, dns-server
Ioc2rpz
ioc2rpz is a place where threat intelligence meets DNS.
Stars: ✭ 67 (+67.5%)
Mutual labels:  dns, dns-server
Pdns
PowerDNS Authoritative, PowerDNS Recursor, dnsdist
Stars: ✭ 2,575 (+6337.5%)
Mutual labels:  dns, dns-server
fastdns
Fast DNS package for Go. Tuned for high performance. Zero memory allocations in almost paths. Up to 1M QPS on a single host.
Stars: ✭ 67 (+67.5%)
Mutual labels:  dns, dns-server

newdns

Test GoDoc Release

A library for building custom DNS servers in Go.

The newdns library wraps the widely used, but low-level github.com/miekg/dns package with a simple interface to quickly build custom DNS servers. The implemented server only supports a subset of record types (A, AAAA, CNAME, MX, TXT) and is intended to be used as a leaf authoritative name server only. It supports UDP and TCP as transport protocols and implements EDNS0. Conformance is tested by issuing a corpus of tests against a zone in AWS Route53 and comparing the response and behavior.

The intention of this project is not to build a feature-complete alternative to "managed zone" offerings by major cloud platforms. However, some projects may require frequent synchronization of many records between a custom database and a cloud-hosted "managed zone". In this scenario, a custom DNS server that queries the own database might be a lot simpler to manage and operate. Also, the distributed nature of the DNS system offers interesting qualities that could be leveraged by future applications.

Example

// create zone
zone := &newdns.Zone{
    Name:             "example.com.",
    MasterNameServer: "ns1.hostmaster.com.",
    AllNameServers: []string{
        "ns1.hostmaster.com.",
        "ns2.hostmaster.com.",
        "ns3.hostmaster.com.",
    },
    Handler: func(name string) ([]newdns.Set, error) {
        // return apex records
        if name == "" {
            return []newdns.Set{
                {
                    Name: "example.com.",
                    Type: newdns.A,
                    Records: []newdns.Record{
                        {Address: "1.2.3.4"},
                    },
                },
                {
                    Name: "example.com.",
                    Type: newdns.AAAA,
                    Records: []newdns.Record{
                        {Address: "1:2:3:4::"},
                    },
                },
            }, nil
        }

        // return sub records
        if name == "foo" {
            return []newdns.Set{
                {
                    Name: "foo.example.com.",
                    Type: newdns.CNAME,
                    Records: []newdns.Record{
                        {Address: "bar.example.com."},
                    },
                },
            }, nil
        }

        return nil, nil
    },
}

// create server
server := newdns.NewServer(newdns.Config{
    Handler: func(name string) (*newdns.Zone, error) {
        // check name
        if newdns.InZone("example.com.", name) {
            return zone, nil
        }

        return nil, nil
    },
    Logger: func(e newdns.Event, msg *dns.Msg, err error, reason string) {
        fmt.Println(e, err, reason)
    },
})

// run server
go func() {
    err := server.Run(":1337")
    if err != nil {
        panic(err)
    }
}()

// print info
fmt.Println("Query apex: dig example.com @0.0.0.0 -p 1337")
fmt.Println("Query other: dig foo.example.com @0.0.0.0 -p 1337")

// wait forever
select {}

Credits

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].