From d4e30e4d17280b667357ee5eac51968fdf9bacfa Mon Sep 17 00:00:00 2001 From: Denis Machard <5562930+dmachard@users.noreply.github.com> Date: Tue, 5 Nov 2024 20:56:08 +0100 Subject: [PATCH] update docs + fix githubactions (#862) * update docs * fix GH CI --- .github/workflows/bench-go.yml | 24 +- .github/workflows/benchmark.yml | 48 --- .github/workflows/build.yml | 133 +++----- .github/workflows/golint.yml | 18 +- .github/workflows/goreleaser.yml | 7 +- .github/workflows/publish.yml | 2 +- .github/workflows/testing-dnstap.yml | 292 ++++++------------ .github/workflows/testing-go.yml | 123 ++++---- .github/workflows/testing-powerdns.yml | 151 ++++----- README.md | 21 +- docs/dnsconversions.md | 147 +++++---- docs/loggers/logger_file.md | 2 +- docs/loggers/logger_stdout.md | 2 +- telemetry/prometheus.go | 8 + telemetry/prometheus_test.go | 2 +- tests/dnsquery_dnstapdoq.py | 4 +- .../{dnsdist_dox.conf => dnsdist_doq.conf} | 0 ...nsdist_dnstaptcp.conf => dnsdist_tcp.conf} | 0 ...dist_dnstapunix.conf => dnsdist_unix.conf} | 0 19 files changed, 378 insertions(+), 606 deletions(-) delete mode 100644 .github/workflows/benchmark.yml rename tests/testsdata/powerdns/{dnsdist_dox.conf => dnsdist_doq.conf} (100%) rename tests/testsdata/powerdns/{dnsdist_dnstaptcp.conf => dnsdist_tcp.conf} (100%) rename tests/testsdata/powerdns/{dnsdist_dnstapunix.conf => dnsdist_unix.conf} (100%) diff --git a/.github/workflows/bench-go.yml b/.github/workflows/bench-go.yml index 6dc2fba7..819d55fe 100644 --- a/.github/workflows/bench-go.yml +++ b/.github/workflows/bench-go.yml @@ -1,4 +1,4 @@ -name: bench go +name: Go Benchmark on: push: @@ -21,33 +21,25 @@ jobs: dev: strategy: matrix: - os-version: ['ubuntu-22.04' ] + os-version: [ 'ubuntu-latest' ] go-version: [ '1.21', '1.22', '1.23' ] runs-on: ${{ matrix.os-version }} steps: - uses: actions/checkout@v4 + + - name: Configure environment to avoid toolchain installs + shell: bash + run: echo "GOTOOLCHAIN=local" >> "$GITHUB_ENV" + - uses: actions/setup-go@v5 with: - go-version: ${{ matrix.go-version }} + go-version: "${{ matrix.go-version }}" - name: Show Go version run: | go version - sudo go version - - name: Set up Go for root - if: runner.os != 'macOS' - run: | - which go - sudo which go - sudo ln -sf `which go` `sudo which go` || true - - - name: Show Go version - run: | - go version - sudo go version - - name: Bench dnsutils run: | cd dnsutils/ diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e9f4ac73..00000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: Benchmark - -on: - push: - paths-ignore: - - 'docs/**' - - 'README.md' - branches: - - main - pull_request: - paths-ignore: - - 'docs/**' - - 'README.md' - branches: - - main - -permissions: - contents: read - -jobs: - bench-dnstaptcp: - runs-on: ubuntu-22.04 - steps: - - uses: actions/setup-go@v5 - - uses: actions/setup-python@v5 - with: - python-version: '3.12' - - - uses: actions/checkout@v4 - with: - path: app - - - uses: actions/checkout@v4 - with: - repository: dmachard/go-dnstap-generator - path: gen - - - name: Build - run: | - cd app/ - go build . - cd ../gen/ - go build . - - - name: Loading testing - run: | - cd app/ - sudo python3 -m unittest tests.bench -v \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b9892541..8ab1e5c7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: go build +name: Go Cross-Platform Build on: push: @@ -18,8 +18,7 @@ permissions: contents: read jobs: - - makefile: + makefile-build: runs-on: ubuntu-latest strategy: @@ -28,9 +27,14 @@ jobs: steps: - uses: actions/checkout@v4 + + - name: Configure environment to avoid toolchain installs + shell: bash + run: echo "GOTOOLCHAIN=local" >> "$GITHUB_ENV" + - uses: actions/setup-go@v5 with: - go-version: ${{ matrix.go-version }} + go-version: "${{ matrix.go-version }}" - name: build binary from makefile run: make build @@ -41,98 +45,55 @@ jobs: - name: dep+build from makefile run: make - go-ubuntu: - runs-on: ubuntu-latest - + go-build: + runs-on: ${{ matrix.os }} strategy: matrix: + os: [ubuntu-latest, macos-latest, windows-latest] go-version: ['1.21', '1.22', '1.23'] + goos: [linux, freebsd, darwin, windows] + exclude: + - { os: macos-latest, goos: linux } + - { os: macos-latest, goos: freebsd } + - { os: macos-latest, goos: windows } + - { os: ubuntu-latest, goos: darwin } + - { os: ubuntu-latest, goos: windows } + - { os: windows-latest, goos: linux } + - { os: windows-latest, goos: freebsd } + - { os: windows-latest, goos: darwin } steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version: ${{ matrix.go-version }} + - uses: actions/checkout@v4 - - name: build binary - run: | - go mod edit -go=${{ matrix.go-version }} - go mod tidy - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o go-dnscollector *.go + - name: Configure environment to avoid toolchain installs + shell: bash + run: echo "GOTOOLCHAIN=local" >> "$GITHUB_ENV" - go-freebsd: + - uses: actions/setup-go@v5 + with: + go-version: "${{ matrix.go-version }}" + + - name: Build binary + run: | + if [[ "${{ matrix.os }}" == 'windows-latest' ]]; then + set CGO_ENABLED=0 + go build -ldflags="-s -w" -o go-dnscollector.exe . + else + CGO_ENABLED=0 GOOS=${{ matrix.goos }} GOARCH=amd64 go build -ldflags="-s -w" -o go-dnscollector *.go + fi + shell: bash + + docker-build: runs-on: ubuntu-latest - strategy: matrix: - go-version: ['1.21', '1.22', '1.23'] - - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version: ${{ matrix.go-version }} + platform: [linux/amd64, linux/386] - - name: build binary - run: | - go mod edit -go=${{ matrix.go-version }} - go mod tidy - CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 go build -ldflags="-s -w" -o go-dnscollector *.go - - # for macos and window, limit the build to the latest version - go-macos: - runs-on: macos-latest - - strategy: - matrix: - go-version: ['1.21', '1.22', '1.23'] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version: ${{ matrix.go-version }} - - - name: build binary - run: | - go mod edit -go=${{ matrix.go-version }} - go mod tidy - CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" -o go-dnscollector *.go - - go-win: - runs-on: windows-latest - - strategy: - matrix: - go-version: ['1.21', '1.22', '1.23'] - - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version: ${{ matrix.go-version }} - - - name: build binary - run: | - set CGO_ENABLED=0 - go mod edit -go=${{ matrix.go-version }} - go mod tidy - go build -ldflags="-s -w" -o go-dnscollector.exe . - - docker: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Build the Docker image - run: | - docker build --build-arg VERSION=dev . --file Dockerfile -t go-dnscollector - - docker32b: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4 - - name: Build the Docker image - run: | - docker build --build-arg VERSION=dev . --platform linux/386 --file Dockerfile -t go-dnscollector + - name: Build the Docker image + run: | + PLATFORM=${{ matrix.platform }} + TAG=$(echo "$PLATFORM" | tr '/' '-') + docker build --build-arg VERSION=dev . --platform $PLATFORM --file Dockerfile -t go-dnscollector:$TAG \ No newline at end of file diff --git a/.github/workflows/golint.yml b/.github/workflows/golint.yml index 9bfa7c47..64f628f8 100644 --- a/.github/workflows/golint.yml +++ b/.github/workflows/golint.yml @@ -1,4 +1,4 @@ -name: go lint +name: Go Linter on: push: @@ -15,21 +15,23 @@ on: - main permissions: - contents: read + contents: read # for actions/checkout to fetch code + pull-requests: read # for golangci/golangci-lint-action to fetch pull requests +env: + GO_VERSION: "1.23" + GOLANGCI_LINT_VERSION: "v1.61.0" + jobs: linter: - permissions: - contents: read # for actions/checkout to fetch code - pull-requests: read # for golangci/golangci-lint-action to fetch pull requests - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: '1.23' + go-version: "${{ env.GO_VERSION }}" # workaround: when the files to be extracted are already present, # tar extraction in Golangci Lint fails with the "File exists" # https://github.com/golangci/golangci-lint-action/issues/807 @@ -38,6 +40,6 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@v6 with: - version: "v1.61.0" + version: "${{ env.GOLANGCI_LINT_VERSION }}" args: --timeout 3m --verbose \ No newline at end of file diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml index 14f9b7ce..d5951bd0 100644 --- a/.github/workflows/goreleaser.yml +++ b/.github/workflows/goreleaser.yml @@ -1,4 +1,4 @@ -name: go releaser +name: Go Releaser on: push: tags: @@ -7,6 +7,9 @@ on: permissions: contents: read +env: + GO_VERSION: "1.23" + jobs: goreleaser: permissions: @@ -19,7 +22,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: "1.23" + go-version: "${{ env.GO_VERSION }}" - name: Run GoReleaser uses: goreleaser/goreleaser-action@v6 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index b2413be8..3c54db28 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,4 +1,4 @@ -name: docker push +name: Docker Push on: release: diff --git a/.github/workflows/testing-dnstap.yml b/.github/workflows/testing-dnstap.yml index 319223dc..67201976 100644 --- a/.github/workflows/testing-dnstap.yml +++ b/.github/workflows/testing-dnstap.yml @@ -1,4 +1,4 @@ -name: tests dnstap +name: Tests DNStap on: push: @@ -17,210 +17,98 @@ on: permissions: contents: read -jobs: - unbound: - runs-on: ubuntu-22.04 - env: - COLLECTOR_USER: runneradmin - - strategy: - matrix: - go-version: [ '1.23' ] - unbound: [ '1.19.3', '1.20.0' ] - - mode: [ 'tcp' ] - - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version: ${{ matrix.go-version }} - - uses: actions/setup-python@v5 - with: - python-version: 3.12 - - - name: build binary - run: | - go mod edit -go=${{ matrix.go-version }} - go mod tidy - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o go-dnscollector *.go - - - name: Deploy docker image - run: | - sudo docker run -d --network="host" --name=unbound --volume=$PWD/tests/testsdata/unbound/unbound_${{ matrix.mode }}.conf:/opt/unbound/etc/unbound/unbound.conf:z -v /tmp/:/opt/unbound/etc/unbound/tmp/:z mvance/unbound:${{ matrix.unbound }} - until (dig -p 5553 www.github.com @127.0.0.1 | grep NOERROR); do sleep 5.0; done - - - name: Test ${{ matrix.mode }} - run: | - sudo python3 -m pip install dnstap_pb fstrm dnspython - sudo python3 -m pip install --upgrade protobuf - sudo python3 -m unittest tests.dnsquery_dnstap${{ matrix.mode }} -v - - coredns: - runs-on: ubuntu-22.04 - - strategy: - matrix: - go-version: [ '1.23' ] - coredns: [ '1.10.1', '1.11.1' ] - mode: [ 'tcp' ] - - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version: ${{ matrix.go-version }} - - uses: actions/setup-python@v5 - with: - python-version: 3.12 - - - name: build binary - run: | - go mod edit -go=${{ matrix.go-version }} - go mod tidy - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o go-dnscollector *.go - - - name: Deploy coredns docker image - run: | - sudo docker run -d --network="host" --name=coredns -v $PWD/tests/testsdata/:$PWD/tests/testsdata/ -v /tmp/:/tmp/ coredns/coredns:${{ matrix.coredns }} -conf $PWD/tests/testsdata/coredns/coredns_${{ matrix.mode }}.conf - until (dig -p 5553 www.github.com @127.0.0.1 | grep NOERROR); do sleep 5.0; done - - - name: Test ${{ matrix.mode }} - run: | - sudo python3 -m pip install dnstap_pb fstrm dnspython - sudo python3 -m pip install --upgrade protobuf - sudo python3 -m unittest tests.dnsquery_dnstap${{ matrix.mode }} -v - - coredns_tls: - runs-on: ubuntu-22.04 - - strategy: - matrix: - go-version: [ '1.23' ] - coredns: [ '1.11.1' ] - mode: [ 'tls' ] - - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version: ${{ matrix.go-version }} - - uses: actions/setup-python@v5 - with: - python-version: 3.12 - - - name: build binary - run: | - go mod edit -go=${{ matrix.go-version }} - go mod tidy - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o go-dnscollector *.go - - - name: Generate certificate - run: | - openssl rand -base64 48 > passphrase.txt - openssl genrsa -aes128 -passout file:passphrase.txt -out server.key 2048 - openssl req -new -passin file:passphrase.txt -key server.key -out server.csr -subj "/C=FR/O=krkr/OU=Domain Control Validated/CN=*.krkr.io" - openssl rsa -in server.key -passin file:passphrase.txt -out dnscollector.key - openssl x509 -req -days 36500 -in server.csr -signkey dnscollector.key -out dnscollector.crt - mv dnscollector.key ./tests/testsdata/ - mv dnscollector.crt ./tests/testsdata/ - - - name: Deploy coredns docker image - run: | - sudo docker run -d --network="host" --name=coredns -v $PWD/tests/testsdata/:$PWD/tests/testsdata/ -v /tmp/:/tmp/ coredns/coredns:${{ matrix.coredns }} -conf $PWD/tests/testsdata/coredns/coredns_${{ matrix.mode }}.conf - until (dig -p 5553 www.github.com @127.0.0.1 | grep NOERROR); do sleep 5.0; done - - - name: Test ${{ matrix.mode }} - run: | - sudo python3 -m pip install dnstap_pb fstrm dnspython - sudo python3 -m pip install --upgrade protobuf - sudo python3 -m unittest tests.dnsquery_dnstap${{ matrix.mode }} -v - - dnsdist: - runs-on: ubuntu-22.04 - env: - COLLECTOR_USER: pdns - - strategy: - matrix: - go-version: [ '1.23' ] - dnsdist: [ '17', '18', '19' ] - - mode: [ 'dnstaptcp', 'dnstapunix' ] +env: + Q_VERSION: "0.19.2" + PYTHON_VERSION: "3.13" + GO_VERSION: "1.23" + COLLECTOR_USER: "pdns" +jobs: + build_bin: + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version: ${{ matrix.go-version }} - - uses: actions/setup-python@v5 - with: - python-version: 3.12 - - - name: build binary - run: | - go mod edit -go=${{ matrix.go-version }} - go mod tidy - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o go-dnscollector *.go - - - name: add pdns user - run: | - sudo addgroup --system --gid 953 pdns - sudo adduser --system --disabled-password --no-create-home -uid 953 --gid 953 pdns - - - name: Deploy dnsdist docker image - run: | - sudo docker run -d --network="host" --name=dnsdist --volume=$PWD/tests/testsdata/powerdns/dnsdist_${{ matrix.mode }}.conf:/etc/dnsdist/conf.d/dnsdist.conf:z -v /tmp/:/tmp/ powerdns/dnsdist-${{ matrix.dnsdist }} - until (dig -p 5553 www.github.com @127.0.0.1 | grep NOERROR); do sleep 5.0; done - - - name: Test ${{ matrix.mode }} - run: | - sudo python3 -m pip install dnstap_pb fstrm dnspython - sudo python3 -m pip install --upgrade protobuf - sudo -E python3 -m unittest tests.dnsquery_${{ matrix.mode }} -v - - dnsdist_doq: - runs-on: ubuntu-22.04 - + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: "${{ env.GO_VERSION }}" + + - name: Build Binary + run: | + CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o go-dnscollector *.go + + - name: Upload Binary Artifact + uses: actions/upload-artifact@v4 + with: + name: go-dnscollector + path: go-dnscollector + + tests_logging: + needs: build_bin + runs-on: ubuntu-latest strategy: matrix: - go-version: [ '1.23' ] - dnsdist: [ '19' ] + config: + - { service: "unbound", version: "1.20.0", mode: "tcp" } + - { service: "coredns", version: "1.11.1", mode: "tcp" } + - { service: "coredns", version: "1.11.1", mode: "tls" } + - { service: "dnsdist", version: "19", mode: "tcp" } + - { service: "dnsdist", version: "19", mode: "unix" } + - { service: "dnsdist", version: "19", mode: "doq" } steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version: ${{ matrix.go-version }} - - uses: actions/setup-python@v5 - with: - python-version: 3.12 - - - name: build binary - run: | - go mod edit -go=${{ matrix.go-version }} - go mod tidy - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o go-dnscollector *.go - - - name: download q - run: | - wget https://github.com/natesales/q/releases/download/v0.19.2/q_0.19.2_linux_amd64.tar.gz - tar xvf q_0.19.2_linux_amd64.tar.gz - - - name: Generate certificate - run: | - openssl genrsa 2048 > ca.key - openssl req -days 365 -new -x509 -nodes -key ca.key -out ca.crt -config <(echo -e "[ req ]\nprompt = no\ndistinguished_name = req_distinguished_name\n[ req_distinguished_name ]\ncountryName = LU\nstateOrProvinceName = Space\nlocalityName = Moon\norganizationName = Github\norganizationalUnitName = Lab\ncommonName = dnscollector.dev\nemailAddress = admin@dnscollector.dev") - echo -e "[ req ]\nprompt = no\ndistinguished_name = req_distinguished_name\nreq_extensions = req_ext\n[ req_distinguished_name ]\ncountryName = LU\nstateOrProvinceName = Space\nlocalityName = Moon\norganizationName = Github\norganizationalUnitName = DNScollector\ncommonName = dnscollector.dev\nemailAddress = admin@dnscollector.dev\n[ req_ext ]\nsubjectAltName = DNS: dnscollector.dev, IP: 127.0.0.1" > server.conf - openssl req -newkey rsa:2048 -nodes -keyout server.key -out server.csr --config server.conf - openssl x509 -req -days 365 -in server.csr -out server.crt -CA ca.crt -CAkey ca.key -extensions req_ext -extfile server.conf - sudo chmod 644 server.key - - - name: Deploy dnsdist docker image - run: | - sudo docker run -d --network="host" --name=dnsdist --volume=$PWD/tests/testsdata/powerdns/dnsdist_dox.conf:/etc/dnsdist/conf.d/dnsdist.conf:z --volume=$PWD/server.key:/etc/dnsdist/conf.d/server.key:z --volume=$PWD/server.crt:/etc/dnsdist/conf.d/server.crt:z powerdns/dnsdist-${{ matrix.dnsdist }} - until (dig -p 5553 www.github.com @127.0.0.1 | grep NOERROR); do sleep 5.0; done - - - name: Tests - run: | - sudo python3 -m unittest tests.dnsquery_dnstapdoq -v + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "${{ env.PYTHON_VERSION }}" + + - name: Download Binary Artifact + uses: actions/download-artifact@v4 + with: + name: go-dnscollector + + - name: Make Binary Executable + run: chmod +x go-dnscollector + + - name: Download q test doq test + run: | + wget https://github.com/natesales/q/releases/download/v0.19.2/q_${{ env.Q_VERSION }}_linux_amd64.tar.gz + tar xvf q_${{ env.Q_VERSION }}_linux_amd64.tar.gz + + - name: Generate certificate + run: | + openssl genrsa 2048 > ca.key + openssl req -days 365 -new -x509 -nodes -key ca.key -out ca.crt -config <(echo -e "[ req ]\nprompt = no\ndistinguished_name = req_distinguished_name\n[ req_distinguished_name ]\ncountryName = LU\nstateOrProvinceName = Space\nlocalityName = Moon\norganizationName = Github\norganizationalUnitName = Lab\ncommonName = dnscollector.dev\nemailAddress = admin@dnscollector.dev") + echo -e "[ req ]\nprompt = no\ndistinguished_name = req_distinguished_name\nreq_extensions = req_ext\n[ req_distinguished_name ]\ncountryName = LU\nstateOrProvinceName = Space\nlocalityName = Moon\norganizationName = Github\norganizationalUnitName = DNScollector\ncommonName = dnscollector.dev\nemailAddress = admin@dnscollector.dev\n[ req_ext ]\nsubjectAltName = DNS: dnscollector.dev, IP: 127.0.0.1" > server.conf + openssl req -newkey rsa:2048 -nodes -keyout dnscollector.key -out dnscollector.csr --config server.conf + openssl x509 -req -days 365 -in dnscollector.csr -out dnscollector.crt -CA ca.crt -CAkey ca.key -extensions req_ext -extfile server.conf + sudo chmod 644 dnscollector.key + mv dnscollector.key ./tests/testsdata/ + mv dnscollector.crt ./tests/testsdata/ + + - name: Add pdns user for unix socket test + run: | + sudo addgroup --system --gid 953 pdns + sudo adduser --system --disabled-password --no-create-home -uid 953 --gid 953 pdns + + - name: Deploy docker image for "${{ matrix.config.service }}" + run: | + case ${{ matrix.config.service }} in + "unbound") + sudo docker run -d --network="host" --name=unbound --volume=$PWD/tests/testsdata/unbound/unbound_${{ matrix.config.mode }}.conf:/opt/unbound/etc/unbound/unbound.conf:z -v /tmp/:/opt/unbound/etc/unbound/tmp/:z mvance/unbound:${{ matrix.config.version }} + ;; + "coredns") + sudo docker run -d --network="host" --name=coredns -v $PWD/tests/testsdata/:$PWD/tests/testsdata/ -v /tmp/:/tmp/ coredns/coredns:${{ matrix.config.version }} -conf $PWD/tests/testsdata/coredns/coredns_${{ matrix.config.mode }}.conf + ;; + "dnsdist") + sudo docker run -d --network="host" --name=dnsdist --volume=$PWD/tests/testsdata/powerdns/dnsdist_${{ matrix.config.mode }}.conf:/etc/dnsdist/conf.d/dnsdist.conf:z --volume=$PWD/tests/testsdata/dnscollector.key:/etc/dnsdist/conf.d/server.key:z --volume=$PWD/tests/testsdata/dnscollector.crt:/etc/dnsdist/conf.d/server.crt:z -v /tmp/:/tmp/ powerdns/dnsdist-${{ matrix.config.version }} + ;; + esac + until (dig -p 5553 www.github.com @127.0.0.1 | grep NOERROR); do sleep 5.0; done + + - name: Run Tests for ${{ matrix.config.service }} - ${{ matrix.config.mode }} + run: | + python3 -m venv venv + source venv/bin/activate + python3 -m pip install dnstap_pb fstrm dnspython protobuf + python3 -m unittest tests.dnsquery_dnstap${{ matrix.config.mode }} -v \ No newline at end of file diff --git a/.github/workflows/testing-go.yml b/.github/workflows/testing-go.yml index 0578637b..60471b80 100644 --- a/.github/workflows/testing-go.yml +++ b/.github/workflows/testing-go.yml @@ -1,4 +1,4 @@ -name: tests go +name: Go Tests on: push: @@ -17,11 +17,35 @@ on: permissions: contents: read +env: + PROM_VERSION: "2.55.0" + GENTAP: "0.8.0" + PYTHON_VERSION: '3.13' + GO_VERSION: '1.23' + jobs: - dev: + build_bin: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: "${{ env.GO_VERSION }}" + + - name: Build Binary + run: | + CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o go-dnscollector *.go + + - name: Upload Binary Artifact + uses: actions/upload-artifact@v4 + with: + name: go-dnscollector + path: go-dnscollector + + testunit: strategy: matrix: - os-version: ['ubuntu-22.04' ] #, 'macos-latest' + os-version: [ 'ubuntu-24.04' ] go-version: [ '1.21', '1.22', '1.23' ] package: - '.' @@ -30,11 +54,17 @@ jobs: - 'dnsutils' - 'workers' - 'transformers' + - 'telemetry' - runs-on: ${{ matrix.os-version }} + runs-on: "${{ matrix.os-version }}" steps: - uses: actions/checkout@v4 + + - name: Configure environment to avoid toolchain installs + shell: bash + run: echo "GOTOOLCHAIN=local" >> "$GITHUB_ENV" + - uses: actions/setup-go@v5 with: go-version: ${{ matrix.go-version }} @@ -42,70 +72,47 @@ jobs: - name: Show Go version run: | go version - sudo go version - - - name: Set up Go for root - if: runner.os != 'macOS' - run: | - which go - sudo which go - sudo ln -sf `which go` `sudo which go` || true - - - name: Show Go version - run: | - go version - sudo go version - + - name: Test ${{ matrix.package }} - run: sudo go test -timeout 240s ./${{ matrix.package }}/ -race -cover -v + run: go test -timeout 240s -exec sudo ./${{ matrix.package }}/ -race -cover -v - int: - runs-on: ubuntu-22.04 - - strategy: - matrix: - go-version: [ '1.21', '1.22', '1.23' ] - package: ['config', 'clientquery_dnstaptcp', 'clientquery_dnstapunix' ] + config: + needs: build_bin + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 + + - name: Download Binary Artifact + uses: actions/download-artifact@v4 with: - go-version: ${{ matrix.go-version }} + name: go-dnscollector + + - name: Make Binary Executable + run: chmod +x go-dnscollector + - uses: actions/setup-python@v5 with: - python-version: '3.12' - - - name: build binary - run: | - go mod edit -go=${{ matrix.go-version }} - go mod tidy - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o go-dnscollector *.go + python-version: "${{ env.PYTHON_VERSION }}" - - name: Test ${{ matrix.package }} + - name: Test config run: | - sudo python3 -m pip install dnstap_pb fstrm dnspython - sudo python3 -m pip install --upgrade protobuf - sudo python3 -m unittest tests.${{ matrix.package }} -v + python3 -m unittest tests.config -v metrics: - runs-on: ubuntu-22.04 + needs: build_bin + runs-on: ubuntu-latest - strategy: - matrix: - go-version: [ '1.21', '1.22', '1.23'] - steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 + + - name: Download Binary Artifact + uses: actions/download-artifact@v4 with: - go-version: ${{ matrix.go-version }} - - - name: build binary - run: | - go mod edit -go=${{ matrix.go-version }} - go mod tidy - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o go-dnscollector *.go + name: go-dnscollector + + - name: Make Binary Executable + run: chmod +x go-dnscollector - name: run collector run: ./go-dnscollector -config ./tests/testsdata/config_prom.yml & @@ -115,8 +122,6 @@ jobs: wget -nv https://github.com/dmachard/go-dnstap-generator/releases/download/v${{ env.GENTAP }}/go-dnstap-generator_${{ env.GENTAP }}_linux_amd64.tar.gz tar xf go-dnstap-generator_${{ env.GENTAP }}_linux_amd64.tar.gz ./go-dnstap-generator -i 127.0.0.1 -p 6000 -n 1 - env: - GENTAP: "0.7.0" - name: check prometheus format metrics run: | @@ -124,8 +129,6 @@ jobs: tar xf prometheus-$PROM_VERSION.linux-amd64.tar.gz cd prometheus-$PROM_VERSION.linux-amd64/ curl -u admin:changeme http://127.0.0.1:8081/metrics | ./promtool check metrics - env: - PROM_VERSION: "2.51.1" count: runs-on: ubuntu-latest @@ -134,14 +137,18 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 + - name: Configure environment to avoid toolchain installs + shell: bash + run: echo "GOTOOLCHAIN=local" >> "$GITHUB_ENV" + - name: Set up Go uses: actions/setup-go@v5 with: - go-version: "1.23" + go-version: ${{ env.GO_VERSION }} - id: count_tests run: | - data=$(sudo go test -timeout 360s -v ./workers ./dnsutils ./transformers ./pkgconfig ./pkginit ./telemetry ././ 2>&1 | grep -c RUN) + data=$(sudo go test -timeout 360s -v -exec sudo ./workers ./dnsutils ./transformers ./pkgconfig ./pkginit ./telemetry ././ 2>&1 | grep -c RUN) echo "Count of Tests: $data" echo "data=$data" >> $GITHUB_OUTPUT diff --git a/.github/workflows/testing-powerdns.yml b/.github/workflows/testing-powerdns.yml index b1ab1d0a..9c8b0345 100644 --- a/.github/workflows/testing-powerdns.yml +++ b/.github/workflows/testing-powerdns.yml @@ -1,4 +1,4 @@ -name: tests powerdns +name: Tests PowerDNS on: push: @@ -17,105 +17,70 @@ on: permissions: contents: read -jobs: - - dnsdist: - runs-on: ubuntu-22.04 - env: - COLLECTOR_USER: pdns - - strategy: - matrix: - go-version: [ '1.23' ] - dnsdist: [ '18', '19' ] - - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version: ${{ matrix.go-version }} - - uses: actions/setup-python@v5 - with: - python-version: 3.12 - - - name: build binary - run: | - go mod edit -go=${{ matrix.go-version }} - go mod tidy - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o go-dnscollector *.go - - - name: Deploy dnsdist docker image - run: | - sudo docker run -d --network="host" --name=dnsdist --volume=$PWD/tests/testsdata/powerdns/dnsdist_protobuf.conf:/etc/dnsdist/conf.d/dnsdist.conf:z -v /tmp/:/tmp/ powerdns/dnsdist-${{ matrix.dnsdist }} - until (dig -p 5553 www.github.com @127.0.0.1 | grep NOERROR); do sleep 5.0; done - - - name: Test dns query - run: | - sudo python3 -m pip install dnspython - sudo -E python3 -m unittest tests.dnsquery_powerdns -v - - recursor: - runs-on: ubuntu-22.04 - - strategy: - matrix: - go-version: [ '1.23' ] - recursor: [ '49', '50' ] +env: + PYTHON_VERSION: "3.13" + GO_VERSION: "1.23" +jobs: + build: + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version: ${{ matrix.go-version }} - - uses: actions/setup-python@v5 - with: - python-version: 3.12 + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: "${{ env.GO_VERSION }}" - - name: build binary - run: | - go mod edit -go=${{ matrix.go-version }} - go mod tidy - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o go-dnscollector *.go + - name: Build Binary + run: | + CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o go-dnscollector *.go - - name: Deploy recursor docker image - run: | - sudo docker run -d --network="host" --name=recursor --volume=$PWD/tests/testsdata/powerdns/pdns_recursor.lua:/etc/powerdns/recursor.lua:z --volume=$PWD/tests/testsdata/powerdns/pdns_recursor.conf:/etc/powerdns/recursor.conf:z powerdns/pdns-recursor-${{ matrix.recursor }} - until (dig -p 5553 www.github.com @127.0.0.1 | grep NOERROR); do sleep 5.0; done + - name: Upload Binary Artifact + uses: actions/upload-artifact@v4 + with: + name: go-dnscollector + path: go-dnscollector - - name: Test send query - run: | - sudo python3 -m pip install dnspython - sudo -E python3 -m unittest tests.dnsquery_powerdns -v - - recursor5: - runs-on: ubuntu-22.04 + test_protobuf: + needs: build + runs-on: ubuntu-latest strategy: matrix: - go-version: [ '1.23' ] - recursor: [ '51' ] + component: + - { name: 'dnsdist', version: '18' } + - { name: 'dnsdist', version: '19' } + - { name: 'recursor', version: '51' } steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version: ${{ matrix.go-version }} - - uses: actions/setup-python@v5 - with: - python-version: 3.12 - - - name: build binary - run: | - go mod edit -go=${{ matrix.go-version }} - go mod tidy - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o go-dnscollector *.go - - - name: Deploy recursor 5.x docker image - run: | - sudo docker run -d --network="host" --name=recursor --volume=$PWD/tests/testsdata/powerdns/pdns_recursor.yml:/etc/powerdns/recursor.yml:z powerdns/pdns-recursor-${{ matrix.recursor }} - until (dig -p 5553 www.github.com @127.0.0.1 | grep NOERROR); do sleep 5.0; done - - - name: Test send query - run: | - sudo python3 -m pip install dnspython - sudo -E python3 -m unittest tests.dnsquery_powerdns -v \ No newline at end of file + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "${{ env.PYTHON_VERSION }}" + + - name: Download Binary Artifact + uses: actions/download-artifact@v4 + with: + name: go-dnscollector + + - name: Make Binary Executable + run: chmod +x go-dnscollector + + - name: Deploy Docker image + run: | + case ${{ matrix.component.name }} in + "dnsdist") + sudo docker run -d --network="host" --name=dnsdist --volume=$PWD/tests/testsdata/powerdns/dnsdist_protobuf.conf:/etc/dnsdist/conf.d/dnsdist.conf:z -v /tmp/:/tmp/ powerdns/dnsdist-${{ matrix.component.version }} + ;; + "recursor") + sudo docker run -d --network="host" --name=recursor --volume=$PWD/tests/testsdata/powerdns/pdns_recursor.yml:/etc/powerdns/recursor.yml:z powerdns/pdns-recursor-${{ matrix.component.version }} + ;; + esac + until (dig -p 5553 www.github.com @127.0.0.1 | grep NOERROR); do sleep 5.0; done + + - name: Test DNS query + run: | + python3 -m venv venv + source venv/bin/activate + python3 -m pip install dnspython + python3 -m unittest tests.dnsquery_powerdns -v diff --git a/README.md b/README.md index aead1ab5..07ec6e63 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,17 @@
- - - - - + + + + +
- +
- +
`DNS-collector` acts as a passive high speed **ingestor** with **pipelining** support for your DNS logs, written in **Golang**. It allows enhancing your DNS logs by adding metadata, extracting usage patterns, and facilitating security analysis. @@ -19,7 +19,7 @@ > Additionally, DNS-collector also support > > - [Extended](https://github.com/dmachard/go-dns-collector/blob/main/docs/extended_dnstap.md) DNStap with TLS encryption, compression, and more metadata capabilities -> - DNS protocol conversions to [plain text, JSON, jinja and more](https://github.com/dmachard/go-dns-collector/blob/main/docs/dnsconversions.md) +> - DNS protocol conversions to [Plain text, Key/Value JSON, Jinja and more](https://github.com/dmachard/go-dns-collector/blob/main/docs/dnsconversions.md) > - DNS parser with [Extension Mechanisms for DNS (EDNS)](https://github.com/dmachard/go-dns-collector/blob/main/docs/dnsparser.md) support > - Live capture on a network interface > - IPv4/v6 defragmentation and TCP reassembly @@ -103,10 +103,9 @@ The configuration of DNS-collector is done through a file named [`config.yml`](c When the DNS-collector starts, it will look for the config.yml from the current working directory. A typical [configuration in pipeline](./running_mode.md) mode includes one or more collectors to receive DNS traffic and several loggers to process the incoming data. -To get started quickly, you can use this default [`config.yml`](config.yml). -For advanced settings, see the [advanced configuration guide](./docs/advanced_config.md). +To get started quickly, you can use this default [`config.yml`](config.yml). You can also see the `_examples` folder from documentation witch contains a number of [various configurations](./docs/examples.md) to get you started with the DNS-collector in different ways. -You can also see the [`_examples`](./docs/_examples) folder from documentation witch contains a number of [various configurations](./docs/examples.md) to get you started with the DNS-collector in different ways. +For advanced settings, see the [advanced configuration guide](./docs/advanced_config.md). Additionally, the [`_integration`](./docs/_integration) folder contains preconfigured files and `docker compose` examples for integrating DNS-collector with popular tools: diff --git a/docs/dnsconversions.md b/docs/dnsconversions.md index a776ca13..ea9b5795 100644 --- a/docs/dnsconversions.md +++ b/docs/dnsconversions.md @@ -5,8 +5,7 @@ All DNStap messages or network-captured data are first transformed into the [DNSMessage](https://pkg.go.dev/github.com/dmachard/go-dnscollector/dnsutils#DNSMessage) structure. Once in this structure, the object can be further converted to text, JSON, or any specific output format (e.g., Kafka, Redis). - [Text Format Inline](#text-format-inline) -- [JSON Advanced Structure](#) -- [Flat JSON (Key/Value)](#flat-json-format) +- [JSON Enconding](#json-encoding) - [Jinja templating](#jinja-templating) ## Text format inline @@ -113,7 +112,6 @@ global: ## JSON encoding - The `DNS-collector` enables the transformation of DNS queries or replies into `JSON` format. The JSON format contains DNS messages with additionnal metadata added by transformers or collectors. @@ -124,6 +122,77 @@ The default JSON payload parts: - `dns`: DNS fields. - `edns`: Extended DNS options. + +The Flat JSON is a simple key-value pair structure that supports customization of the keys in the format. + +At times, a single level key-value output in JSON is easier to ingest than multi-level JSON structures. +Utilizing `flat-json` delivers every output field as its own key/value pair but requires more processing +on the host running DNS-collector. + +This format is recommended because custom relabeling can be applied on it (drop keys or rename it). + +Here's a flat JSON output formatted using `jq`: + +```json +{ + "dns.flags.aa": false, + "dns.flags.ad": false, + "dns.flags.qr": true, + "dns.flags.ra": true, + "dns.flags.tc": false, + "dns.flags.rd": false, + "dns.flags.cd": false, + "dns.length": 82, + "dns.malformed-packet": false, + "dns.id": 34555, + "dns.opcode": 0, + "dns.qname": "google.nl", + "dns.qtype": "A", + "dns.rcode": "NOERROR", + "dns.qclass": "IN", + "dns.qdcount": 0, + "dns.ancount": 1, + "dns.arcount": 0, + "dns.nscount": 0, + "dns.resource-records.an.0.name": "google.nl", + "dns.resource-records.an.0.rdata": "142.251.39.99", + "dns.resource-records.an.0.rdatatype": "A", + "dns.resource-records.an.0.ttl": 300, + "dns.resource-records.an.0.class": "IN", + "dns.resource-records.ar": "-", + "dns.resource-records.ns": "-", + "dnstap.identity": "foo", + "dnstap.peer-name": "172.16.0.2", + "dnstap.latency": 0.000000, + "dnstap.operation": "CLIENT_RESPONSE", + "dnstap.timestamp-rfc3339ns": "2023-03-31T10:14:46.664534902Z", + "dnstap.version": "BIND 9.18.13-1+ubuntu20.04.1+isc+1-Ubuntu", + "dnstap.extra": "-", + "dnstap.policy-rule": "-", + "dnstap.policy-type": "-", + "dnstap.policy-action": "-", + "dnstap.policy-match": "-", + "dnstap.policy-value": "-", + "dnstap.query-zone": "-", + "edns.dnssec-ok": 0, + "edns.options.0.code": 10, + "edns.options.0.data": "-", + "edns.options.0.name": "COOKIE", + "edns.rcode": 0, + "edns.udp-size": 1232, + "edns.version": 0, + "network.family": "IPv4", + "network.ip-defragmented": false, + "network.protocol": "UDP", + "network.query-ip": "127.0.0.1", + "network.query-port": "36232", + "network.response-ip": "127.0.0.1", + "network.response-port": "53", + "network.tcp-reassembled": false, +} +``` + + **Example JSON Output** ```json @@ -207,7 +276,6 @@ The default JSON payload parts: } ``` - **Extended JSON format** This JSON message can be extended by collector(s): @@ -223,74 +291,3 @@ This JSON message can be also extended by transformer(s): - [Traffic reducer](transformers/transform_trafficreducer.md) - [Traffic filtering](transformers/transformer_trafficfiltering.md) * - -## Flat JSON format - -Flat JSON is a simple key-value pair structure that supports customization of the keys in the format. - -At times, a single level key-value output in JSON is easier to ingest than multi-level JSON structures. -Utilizing `flat-json` delivers every output field as its own key/value pair but requires more processing -on the host running DNS-collector. - -This format is recommended because custom relabeling can be applied on it (drop keys or rename it). - -Here's a flat JSON output formatted using `jq`: - -```json -{ - "dns.flags.aa": false, - "dns.flags.ad": false, - "dns.flags.qr": true, - "dns.flags.ra": true, - "dns.flags.tc": false, - "dns.flags.rd": false, - "dns.flags.cd": false, - "dns.length": 82, - "dns.malformed-packet": false, - "dns.id": 34555, - "dns.opcode": 0, - "dns.qname": "google.nl", - "dns.qtype": "A", - "dns.rcode": "NOERROR", - "dns.qclass": "IN", - "dns.qdcount": 0, - "dns.ancount": 1, - "dns.arcount": 0, - "dns.nscount": 0, - "dns.resource-records.an.0.name": "google.nl", - "dns.resource-records.an.0.rdata": "142.251.39.99", - "dns.resource-records.an.0.rdatatype": "A", - "dns.resource-records.an.0.ttl": 300, - "dns.resource-records.an.0.class": "IN", - "dns.resource-records.ar": "-", - "dns.resource-records.ns": "-", - "dnstap.identity": "foo", - "dnstap.peer-name": "172.16.0.2", - "dnstap.latency": 0.000000, - "dnstap.operation": "CLIENT_RESPONSE", - "dnstap.timestamp-rfc3339ns": "2023-03-31T10:14:46.664534902Z", - "dnstap.version": "BIND 9.18.13-1+ubuntu20.04.1+isc+1-Ubuntu", - "dnstap.extra": "-", - "dnstap.policy-rule": "-", - "dnstap.policy-type": "-", - "dnstap.policy-action": "-", - "dnstap.policy-match": "-", - "dnstap.policy-value": "-", - "dnstap.query-zone": "-", - "edns.dnssec-ok": 0, - "edns.options.0.code": 10, - "edns.options.0.data": "-", - "edns.options.0.name": "COOKIE", - "edns.rcode": 0, - "edns.udp-size": 1232, - "edns.version": 0, - "network.family": "IPv4", - "network.ip-defragmented": false, - "network.protocol": "UDP", - "network.query-ip": "127.0.0.1", - "network.query-port": "36232", - "network.response-ip": "127.0.0.1", - "network.response-port": "53", - "network.tcp-reassembled": false, -} -``` diff --git a/docs/loggers/logger_file.md b/docs/loggers/logger_file.md index 9c30286b..2724f8a0 100644 --- a/docs/loggers/logger_file.md +++ b/docs/loggers/logger_file.md @@ -46,7 +46,7 @@ The File Logger allows you to log DNS traffic to a file in various formats, with > available directives, use this parameter if you want a specific format. * `jinja-format` (string) - > jinja template, please refer [Jinja encoding](../dns2jinja.md) to see all available directives + > jinja template, please refer [Jinja templating](../dnsconversions.md#jinja-templating) to see all available directives * `postrotate-command` (string) > Specifies a command or script to run after each file rotation. diff --git a/docs/loggers/logger_stdout.md b/docs/loggers/logger_stdout.md index 412e7b04..9d9c4a4b 100644 --- a/docs/loggers/logger_stdout.md +++ b/docs/loggers/logger_stdout.md @@ -15,7 +15,7 @@ Options: > output text format, please refer to the default text format to see all available [directives](../configuration.md#custom-text-format), use this parameter if you want a specific format * `jinja-format` (string) - > jinja template, please refer [Jinja encoding](../dns2jinja.md) to see all available directives + > jinja template, please refer [Jinja templating](../dnsconversions.md#jinja-templating) to see all available directives * `chan-buffer-size` (integer) > Specifies the maximum number of packets that can be buffered before discard additional packets. diff --git a/telemetry/prometheus.go b/telemetry/prometheus.go index 2c9ff99a..bce272cb 100644 --- a/telemetry/prometheus.go +++ b/telemetry/prometheus.go @@ -100,6 +100,14 @@ func (t *PrometheusCollector) UpdateStats() { } } } + +func (t *PrometheusCollector) GetWorkerStats(workerName string) (WorkerStats, bool) { + t.Lock() + defer t.Unlock() + ws, ok := t.data[workerName] + return ws, ok +} + func (t *PrometheusCollector) Collect(ch chan<- prometheus.Metric) { t.Lock() defer t.Unlock() diff --git a/telemetry/prometheus_test.go b/telemetry/prometheus_test.go index b618ed82..c879c871 100644 --- a/telemetry/prometheus_test.go +++ b/telemetry/prometheus_test.go @@ -40,7 +40,7 @@ func TestTelemetry_PrometheusCollectorUpdateStats(t *testing.T) { collector.Record <- ws // Verify that the stats were updated - storedWS, ok := collector.data["worker1"] + storedWS, ok := collector.GetWorkerStats("worker1") assert.True(t, ok, "Worker stats should be present in the collector") assert.Equal(t, ws.TotalIngress, storedWS.TotalIngress) assert.Equal(t, ws.TotalEgress, storedWS.TotalEgress) diff --git a/tests/dnsquery_dnstapdoq.py b/tests/dnsquery_dnstapdoq.py index 479ccfce..48f0b0cc 100644 --- a/tests/dnsquery_dnstapdoq.py +++ b/tests/dnsquery_dnstapdoq.py @@ -1,7 +1,5 @@ import unittest import asyncio -import requests -import re class CollectorProc(asyncio.SubprocessProtocol): def __init__(self, is_ready, is_clientresponse): @@ -56,7 +54,7 @@ def setUp(self): self.loop = asyncio.get_event_loop() def test_stdout_recv(self): - """test to receive dnstap DOQ response in stdou""" + """test to receive dnstap DOQ response in stdout""" async def run(): # run collector is_ready = asyncio.Future() diff --git a/tests/testsdata/powerdns/dnsdist_dox.conf b/tests/testsdata/powerdns/dnsdist_doq.conf similarity index 100% rename from tests/testsdata/powerdns/dnsdist_dox.conf rename to tests/testsdata/powerdns/dnsdist_doq.conf diff --git a/tests/testsdata/powerdns/dnsdist_dnstaptcp.conf b/tests/testsdata/powerdns/dnsdist_tcp.conf similarity index 100% rename from tests/testsdata/powerdns/dnsdist_dnstaptcp.conf rename to tests/testsdata/powerdns/dnsdist_tcp.conf diff --git a/tests/testsdata/powerdns/dnsdist_dnstapunix.conf b/tests/testsdata/powerdns/dnsdist_unix.conf similarity index 100% rename from tests/testsdata/powerdns/dnsdist_dnstapunix.conf rename to tests/testsdata/powerdns/dnsdist_unix.conf