portal

command module
v0.0.0-...-5abfbfe Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 22, 2022 License: MIT Imports: 3 Imported by: 0

README

Portal

⚠️ Under active development!

Portal is a domain name server written in Go. Portal is used by Void to answer (and block) DNS queries.

Features

  • Recursion and Forwarding (Iterative in progress)
  • Caching and auto renewing of RRs
  • Filter engine (in progress)
  • Custom RRs
  • Structured logging
  • Metrics collection
  • ...

TODOs

General
  • [WIP] How should we collect metrics / statistics which can be shown in the web interface of void?
  • [TODO] Implement mechanism to return FORMERR when unpacking a message (prior to handling). Maybe move the unpacking into the handling func to be able to handle these kind of errors better and in a centralized place. (See OPT record)
  • [TODO] Figure out a way to handle EDNS Options with access to some core components like cache, etc.
Caching
Partial lookup

We need to support lookup of partial domain names: We currently do the following:

  • Check if we cached the whole domain name, e.g. example.com
  • If we did, return requested RR

If we recursively resolve a domain name and encounter a NS record without any glue records we always start to resolve the domain name of the NS record from root (.). Instead we should lookup the cache if we have partial stored records of NS RRs.

Multiple records

A single node at domain-name should support multiple RRs at class and type. This feature comes with many implications:

  • Which of these RRs do we return when looking up the node: All of them or only one? And if only one - which one?
  • How do we calculate the Expiry / TTl when we return multiple RRs?
  • More?
RFCs
RFS to implement

Supported RFCs

  • Domain Names - Concepts and Facilities RFC 1034
  • Domain Names - Implementation and Specification RFC 1035
  • Serial Number Arithmetic RFC 1982
  • Extension Mechanisms for DNS (EDNS(0)) RFC 6891

Usage

Standalone

To use the server as a standalone DNS server, follow these steps:

  1. Clone the repository
  2. Build the binary via go build
  3. Run the binary with ./portal
Library
import (
    "fmt"
    "os"

    "github.com/go-void/portal/pkg/config"
    "github.com/go-void/portal/pkg/server"
)

func main() {
    // Setup config
    c, err := config.Read("path/to/config.toml")
    if err != nil {
        exit(err)
    }

    // Validate config
    err = c.Validate()
    if err != nil {
        exit(err)
    }

    // Create new server
    s := server.New(c)

    // Optionally provide custom implementations for different components via
    err = s.Configure()
    if err != nil {
        exit(err)
    }

    // Run the server
    err = s.Run()
    if err != nil {
        exit(err)
    }

    // This blocks until the server is shutdown
    s.Wait()
}

func exit(err error) {
    fmt.Println(err)
    os.Exit(1)
}

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
cmd
cli
pkg
cache
Package cache provides an in-memory cache to store answers from remote DNS servers
Package cache provides an in-memory cache to store answers from remote DNS servers
client
Package client provides a DNS client to send and receive DNS messages
Package client provides a DNS client to send and receive DNS messages
collector
Package collector provides functions to collect statistics about queries, filters and more
Package collector provides functions to collect statistics about queries, filters and more
dio
Package dio provides functions to read and write DNS messages from and to the wire
Package dio provides functions to read and write DNS messages from and to the wire
filter
Package filter provides different functions to filter out DNS requests (to block them)
Package filter provides different functions to filter out DNS requests (to block them)
pack
Package pack provides utility functions to (un)pack raw data from and to the "wire"
Package pack provides utility functions to (un)pack raw data from and to the "wire"
server
Package server provides functions to create and manage DNS server instances
Package server provides functions to create and manage DNS server instances
store
Package store provides an interface to store and retrieve custom DNS records
Package store provides an interface to store and retrieve custom DNS records
tree
Package tree implements a in-memory tree / node structure to store and retrieve resource record data
Package tree implements a in-memory tree / node structure to store and retrieve resource record data

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL