iaean / dns3lcore

Core functionality of dns3l written in Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

dns3l-core

golangci-lint go test docker-dns3ld

Core parts of dns3l written in Go:

  • Backend daemon for DNS3L
  • API/Libraries for DNS3L functionality

Requires go >= 1.20

Implementation Status

Implemented:

  • Code skeleton
  • Config
  • REST API returns config
  • DNS handlers
  • ACME handlers
  • State, DB connection
  • Auth

Not yet implemented:

  • Legacy CA handlers

dns3ld (backend daemon)

Build

Run

make

to obtain a statically linked binary.

To obtain a Docker image, run

make docker

or explicitly (same semantics)

docker build -t dns3ld:$(awk -v FS="dns3ld=" 'NF>1{print $2}' VERSIONS)-dev -f docker/Dockerfile-dns3ld .

The awk command above is an example that will create the right tag name from the VERSIONS file, feel free to choose other tag names as needed.

Usage

$./dns3ld --help
DNS3LD backend daemon, version 1.0.0

Usage:
  dns3ld [flags]
  dns3ld [command]

Available Commands:
  completion  Generate the autocompletion script for the specified shell
  dbcreate    Create database structure
  help        Help about any command

Flags:
  -c, --config string   YAML-formatted configuration for dns3ld. (default "config.yaml")
  -h, --help            help for dns3ld
  -r, --renew           Whether automatic cert renewal jobs should run. Useful if multiple instances run on the
                                        same DB and you want to disable renewal for the replicas, which is not yet thread-safe. (default true)
  -s, --socket string   L4 socket on which the service should listen. (default ":80")

Use "dns3ld [command] --help" for more information about a command.

Example

./dns3ld --config config-example.yaml --socket 127.0.0.1:8080

docker-compose

Example:

  backend:
    image: ghcr.io/dns3l/dns3ld:1.0.1
    container_name: dns3l-backend
    restart: always
    volumes:
      - /root/dns3ld.conf.yaml:/etc/dns3ld.conf.yaml:ro
    networks:
      - dns3l
    command: 
      --config=/etc/dns3ld.conf.yaml
      --socket=:8080
    dns_search: .

Test

Unit tests

export DNS3L_TEST_CONFIG=/my/secret/folder/dns3l-config4test.yaml
go test ./...

Component tests

Component tests will test with real DB endpoints without using the Golang unit test framework.

make comptest

You can also use the Docker version of the component tests:

make comptest-docker

About

Core functionality of dns3l written in Go


Languages

Language:Go 97.9%Language:Shell 1.6%Language:Makefile 0.4%