-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'rel/v0.2.0+0.1.1' into release
- Loading branch information
Showing
34 changed files
with
2,184 additions
and
958 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
/pdns-etcd3 | ||
|
||
# IDEs | ||
/.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
pdns-etcd3 | ||
Copyright 2016-2022 nix <https://keybase.io/nixn> | ||
Copyright 2016-2024 nix <https://keybase.io/nixn> | ||
|
||
This product includes software developed by | ||
nix <https://keybase.io/nixn> |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# available profiles: | ||
# - standalone (backend in unix mode) | ||
# - pdns-34 (defunct) | ||
# - pdns-44 | ||
# - pdns-45 | ||
# - pdns-49 | ||
# - pdns-50 | ||
# - pdns-all | ||
# - etcdkeeper | ||
COMPOSE_PROFILES=standalone,etcdkeeper,pdns-49 | ||
PDNS_BACKEND_MODE=unix | ||
PDNS49_PUBLIC_PORT=5300 | ||
#ETCD_PUBLIC_CLIENT_PORT=23790 | ||
ETCDKEEPER_PORT=8080 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
FROM debian:12-slim | ||
ENTRYPOINT ["/pdns-etcd3", "-unix=/common/pdns-etcd3.sock", "-endpoints=etcd:2379"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
FROM debian:12-slim | ||
ADD etcdkeeper.sh /opt/ | ||
ADD https://github.com/evildecay/etcdkeeper/releases/download/v0.7.8/etcdkeeper-v0.7.8-linux_x86_64.tar.gz /opt/ | ||
WORKDIR /opt | ||
RUN <<EOF | ||
set -ex | ||
tar -xf etcdkeeper*.tar.gz | ||
chmod +x etcdkeeper etcdkeeper.sh | ||
export DEBIAN_FRONTENT=noninteractive | ||
apt-get update | ||
apt-get install -y simpleproxy | ||
EOF | ||
ENV ETCD_ENDPOINT="" | ||
ENTRYPOINT ./etcdkeeper.sh "$ETCD_ENDPOINT" | ||
EXPOSE 8080/tcp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
#version: '3.8' | ||
name: pdns-etcd3 | ||
services: | ||
backend: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile-backend | ||
command: -prefix=/DNS/ -log-debug=main+etcd+data | ||
volumes: | ||
- ../pdns-etcd3:/pdns-etcd3:ro | ||
- common:/common | ||
profiles: | ||
- standalone | ||
pdns34: | ||
image: powerdns/pdns-auth-34 # TODO build | ||
volumes: | ||
- ../pdns-etcd3:/pdns-etcd3:ro | ||
- common:/common | ||
- ./pdns.conf:/etc/powerdns/pdns.conf:ro | ||
- ./pdns-1-listen-legacy.conf:/etc/powerdns/pdns.d/pdns-1-listen-legacy.conf:ro | ||
- ./pdns-5-${PDNS_BACKEND_MODE:?}-v3.conf:/etc/powerdns/pdns.d/pdns-5-backend.conf:ro | ||
ports: | ||
- "${PDNS34_PUBLIC_TCP_PORT:-${PDNS34_PUBLIC_PORT:-}}:53" | ||
- "${PDNS34_PUBLIC_UDP_PORT:-${PDNS34_PUBLIC_PORT:-}}:53/udp" | ||
depends_on: | ||
- backend | ||
profiles: | ||
- pdns-34 | ||
#- pdns-all # TODO re-enable (when working) | ||
pdns44: | ||
image: powerdns/pdns-auth-44 | ||
volumes: | ||
- ../pdns-etcd3:/pdns-etcd3:ro | ||
- common:/common | ||
- ./pdns.conf:/etc/powerdns/pdns.conf:ro | ||
- ./pdns-1-listen.conf:/etc/powerdns/pdns.d/pdns-1-listen.conf:ro | ||
- ./pdns-5-${PDNS_BACKEND_MODE:?}.conf:/etc/powerdns/pdns.d/pdns-5-backend.conf:ro | ||
ports: | ||
- "${PDNS44_PUBLIC_TCP_PORT:-${PDNS44_PUBLIC_PORT:-}}:53" | ||
- "${PDNS44_PUBLIC_UDP_PORT:-${PDNS44_PUBLIC_PORT:-}}:53/udp" | ||
depends_on: | ||
- backend | ||
profiles: | ||
- pdns-44 | ||
- pdns-all | ||
pdns45: | ||
image: powerdns/pdns-auth-45 | ||
volumes: | ||
- ../pdns-etcd3:/pdns-etcd3:ro | ||
- common:/common | ||
- ./pdns.conf:/etc/powerdns/pdns.conf:ro | ||
- ./pdns-1-listen.conf:/etc/powerdns/pdns.d/pdns-1-listen.conf:ro | ||
- ./pdns-3-zone-cache.conf:/etc/powerdns/pdns.d/pdns-3-zone-cache.conf:ro | ||
- ./pdns-5-${PDNS_BACKEND_MODE:?}.conf:/etc/powerdns/pdns.d/pdns-5-backend.conf:ro | ||
ports: | ||
- "${PDNS45_PUBLIC_TCP_PORT:-${PDNS45_PUBLIC_PORT:-}}:53" | ||
- "${PDNS45_PUBLIC_UDP_PORT:-${PDNS45_PUBLIC_PORT:-}}:53/udp" | ||
depends_on: | ||
- backend | ||
profiles: | ||
- pdns-45 | ||
- pdns-all | ||
pdns49: | ||
image: powerdns/pdns-auth-49 | ||
volumes: | ||
- ../pdns-etcd3:/pdns-etcd3:ro | ||
- common:/common | ||
- ./pdns.conf:/etc/powerdns/pdns.conf:ro | ||
- ./pdns-1-listen.conf:/etc/powerdns/pdns.d/pdns-1-listen.conf:ro | ||
- ./pdns-3-zone-cache.conf:/etc/powerdns/pdns.d/pdns-3-zone-cache.conf:ro | ||
- ./pdns-5-${PDNS_BACKEND_MODE:?}.conf:/etc/powerdns/pdns.d/pdns-5-backend.conf:ro | ||
ports: | ||
- "${PDNS49_PUBLIC_TCP_PORT:-${PDNS49_PUBLIC_PORT:-}}:53" | ||
- "${PDNS49_PUBLIC_UDP_PORT:-${PDNS49_PUBLIC_PORT:-}}:53/udp" | ||
depends_on: | ||
- backend | ||
profiles: | ||
- pdns-49 | ||
- pdns-all | ||
pdns50: | ||
image: powerdns/pdns-auth-master | ||
volumes: | ||
- ../pdns-etcd3:/pdns-etcd3:ro | ||
- common:/common | ||
- ./pdns.conf:/etc/powerdns/pdns.conf:ro | ||
- ./pdns-1-listen.conf:/etc/powerdns/pdns.d/pdns-1-listen.conf:ro | ||
- ./pdns-3-zone-cache.conf:/etc/powerdns/pdns.d/pdns-3-zone-cache.conf:ro | ||
- ./pdns-5-${PDNS_BACKEND_MODE:?}.conf:/etc/powerdns/pdns.d/pdns-5-backend.conf:ro | ||
ports: | ||
- "${PDNS50_PUBLIC_TCP_PORT:-${PDNS50_PUBLIC_PORT:-}}:53" | ||
- "${PDNS50_PUBLIC_UDP_PORT:-${PDNS50_PUBLIC_PORT:-}}:53/udp" | ||
depends_on: | ||
- backend | ||
profiles: | ||
- pdns-50 | ||
- pdns-all | ||
etcd: | ||
image: quay.io/coreos/etcd:${ETCD_IMAGE_VERSION:-v3.5.14} | ||
volumes: | ||
- etcd-data:/data | ||
command: | | ||
etcd | ||
--data-dir=/data | ||
--name=etcd | ||
--initial-advertise-peer-urls=http://etcd:2380 | ||
--listen-peer-urls=http://0.0.0.0:2380 | ||
--advertise-client-urls=http://etcd:2379 | ||
--listen-client-urls=http://0.0.0.0:2379 | ||
--initial-cluster=etcd=http://etcd:2380 | ||
--auto-compaction-retention=1h | ||
ports: | ||
- "${ETCD_PUBLIC_CLIENT_PORT:-}:2379" | ||
restart: unless-stopped | ||
etcdkeeper: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile-etcdkeeper | ||
environment: | ||
ETCD_ENDPOINT: etcd:2379 | ||
ports: | ||
- "${ETCDKEEPER_PORT:-}:8080" | ||
depends_on: | ||
- etcd | ||
profiles: | ||
- etcdkeeper | ||
|
||
volumes: | ||
etcd-data: | ||
common: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
set -e | ||
simpleproxy -L 2379 -R "$1" -d | ||
./etcdkeeper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
local-address=0.0.0.0 | ||
local-ipv6=:: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
local-address=0.0.0.0, :: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# 4.5+: avoid currently unimplemented getAllDomains call | ||
zone-cache-refresh-interval=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#pipe: | ||
distributor-threads=1 | ||
remote-connection-string=pipe:command=/pdns-etcd3,endpoints=etcd:2379,log-trace=main+pdns,log-debug=etcd+data,prefix=DNS/,pdns-version=3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#pipe: | ||
distributor-threads=1 | ||
remote-connection-string=pipe:command=/pdns-etcd3,endpoints=etcd:2379,log-trace=main+pdns,log-debug=etcd+data,prefix=DNS/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#unix: | ||
distributor-threads=3 | ||
remote-connection-string=unix:path=/common/pdns-etcd3.sock,log-trace=main+pdns,something=useless,pdns-version=3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#unix: | ||
distributor-threads=3 | ||
remote-connection-string=unix:path=/common/pdns-etcd3.sock,log-trace=main+pdns,something=useless |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
security-poll-suffix= | ||
launch=remote | ||
include-dir=/etc/powerdns/pdns.d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* Copyright 2016-2024 nix <https://keybase.io/nixn> | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. */ | ||
|
||
package src | ||
|
||
import ( | ||
"encoding/json" | ||
"io" | ||
) | ||
|
||
type commType[T any] struct { | ||
in *json.Decoder | ||
out *json.Encoder | ||
} | ||
|
||
func newComm[T any](in io.Reader, out io.Writer) *commType[T] { | ||
comm := commType[T]{ | ||
json.NewDecoder(in), | ||
json.NewEncoder(out), | ||
} | ||
comm.out.SetEscapeHTML(false) | ||
return &comm | ||
} | ||
|
||
func (comm *commType[T]) read() (*T, error) { | ||
var data T | ||
err := comm.in.Decode(&data) | ||
return &data, err | ||
} | ||
|
||
func (comm *commType[T]) write(data any) error { | ||
return comm.out.Encode(data) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.