-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 18edc1f
Showing
11 changed files
with
881 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,109 @@ | ||
name: Build | ||
|
||
'on': | ||
'push': | ||
'tags': | ||
- 'v*' | ||
'branches': | ||
- '*' | ||
'pull_request': | ||
|
||
jobs: | ||
tests: | ||
runs-on: ${{ matrix.os }} | ||
env: | ||
GO111MODULE: "on" | ||
strategy: | ||
matrix: | ||
os: | ||
- windows-latest | ||
- macos-latest | ||
- ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@master | ||
|
||
- uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.x | ||
|
||
- name: Run tests | ||
run: |- | ||
go test -race -v -bench=. -coverprofile=coverage.txt -covermode=atomic ./... | ||
- name: Upload coverage | ||
uses: codecov/codecov-action@v1 | ||
if: "success() && matrix.os == 'ubuntu-latest'" | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
file: ./coverage.txt | ||
|
||
build: | ||
needs: | ||
- tests | ||
runs-on: ubuntu-latest | ||
env: | ||
GO111MODULE: "on" | ||
steps: | ||
- uses: actions/checkout@master | ||
|
||
- uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.x | ||
|
||
- name: Prepare environment | ||
run: |- | ||
RELEASE_VERSION="${GITHUB_REF##*/}" | ||
if [[ "${RELEASE_VERSION}" != v* ]]; then RELEASE_VERSION='dev'; fi | ||
echo "RELEASE_VERSION=\"${RELEASE_VERSION}\"" >> $GITHUB_ENV | ||
# Win | ||
- run: GOOS=windows GOARCH=386 VERSION=${RELEASE_VERSION} make release | ||
- run: GOOS=windows GOARCH=amd64 VERSION=${RELEASE_VERSION} make release | ||
|
||
# MacOS | ||
- run: GOOS=darwin GOARCH=amd64 VERSION=${RELEASE_VERSION} make release | ||
|
||
# Linux X86 | ||
- run: GOOS=linux GOARCH=386 VERSION=${RELEASE_VERSION} make release | ||
- run: GOOS=linux GOARCH=amd64 VERSION=${RELEASE_VERSION} make release | ||
|
||
# Linux ARM | ||
- run: GOOS=linux GOARCH=arm GOARM=6 VERSION=${RELEASE_VERSION} make release | ||
- run: GOOS=linux GOARCH=arm64 VERSION=${RELEASE_VERSION} make release | ||
|
||
# Linux MIPS/MIPSLE | ||
- run: GOOS=linux GOARCH=mips GOMIPS=softfloat VERSION=${RELEASE_VERSION} make release | ||
- run: GOOS=linux GOARCH=mipsle GOMIPS=softfloat VERSION=${RELEASE_VERSION} make release | ||
|
||
# FreeBSD X86 | ||
- run: GOOS=freebsd GOARCH=386 VERSION=${RELEASE_VERSION} make release | ||
- run: GOOS=freebsd GOARCH=amd64 VERSION=${RELEASE_VERSION} make release | ||
|
||
# FreeBSD ARM/ARM64 | ||
- run: GOOS=freebsd GOARCH=arm GOARM=6 VERSION=${RELEASE_VERSION} make release | ||
- run: GOOS=freebsd GOARCH=arm64 VERSION=${RELEASE_VERSION} make release | ||
|
||
- run: ls -l build/godnsbench-* | ||
|
||
- name: Create release | ||
if: startsWith(github.ref, 'refs/tags/v') | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: Release ${{ github.ref }} | ||
draft: false | ||
prerelease: false | ||
|
||
- name: Upload | ||
if: startsWith(github.ref, 'refs/tags/v') | ||
uses: xresloader/upload-to-github-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
file: "build/godnsbench-*.tar.gz;build/godnsbench-*.zip" | ||
tags: true | ||
draft: false |
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,26 @@ | ||
name: golangci-lint | ||
'on': | ||
'push': | ||
'tags': | ||
- 'v*' | ||
'branches': | ||
- '*' | ||
'pull_request': | ||
|
||
jobs: | ||
golangci: | ||
runs-on: | ||
${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: | ||
- ubuntu-latest | ||
- macos-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v2.3.0 | ||
with: | ||
# This field is required. Dont set the patch version to always use | ||
# the latest patch version. | ||
version: v1.45.2 |
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 @@ | ||
.DS_Store | ||
.idea | ||
.vscode | ||
build |
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,70 @@ | ||
# options for analysis running | ||
run: | ||
# default concurrency is a available CPU number | ||
concurrency: 4 | ||
|
||
# timeout for analysis, e.g. 30s, 5m, default is 1m | ||
deadline: 2m | ||
|
||
# which files to skip: they will be analyzed, but issues from them | ||
# won't be reported. Default value is empty list, but there is | ||
# no need to include all autogenerated files, we confidently recognize | ||
# autogenerated files. If it's not please let us know. | ||
skip-files: | ||
- ".*generated.*" | ||
- ".*_test.go" | ||
|
||
# all available settings of specific linters | ||
linters-settings: | ||
gocyclo: | ||
min-complexity: 20 | ||
lll: | ||
line-length: 200 | ||
|
||
linters: | ||
enable: | ||
- deadcode | ||
- errcheck | ||
- govet | ||
- ineffassign | ||
- staticcheck | ||
- structcheck | ||
- unused | ||
- varcheck | ||
- bodyclose | ||
- depguard | ||
- dupl | ||
- gocyclo | ||
- goimports | ||
- gosec | ||
- misspell | ||
- stylecheck | ||
- unconvert | ||
disable-all: true | ||
fast: true | ||
|
||
issues: | ||
exclude-use-default: false | ||
|
||
# List of regexps of issue texts to exclude, empty list by default. | ||
# But independently from this option we use default exclude patterns, | ||
# it can be disabled by `exclude-use-default: false`. To list all | ||
# excluded by default patterns execute `golangci-lint run --help` | ||
exclude: | ||
# errcheck defer Close | ||
- error return value not checked \(defer .*\.Close()\) | ||
# errcheck: Almost all programs ignore errors on these functions and in most cases it's ok | ||
- Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*printf?|os\.(Un)?Setenv). is not checked | ||
# gosec: Duplicated errcheck checks | ||
- G104 | ||
# gosec: Expect file permissions to be 0600 or less | ||
- G302 | ||
# errcheck defer Close | ||
- error return value not checked \(defer .*\.Close()\) | ||
# gosec: False positive is triggered by 'src, err := os.ReadFile(filename)' | ||
- Potential file inclusion via variable | ||
# gosec: TLS InsecureSkipVerify may be true | ||
# We have a configuration option that allows to do this | ||
- G402 | ||
# gosec: Use of weak random number generator | ||
- G404 |
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,8 @@ | ||
Copyright 2020 Andrey Meshkov | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
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,43 @@ | ||
NAME=godnsbench | ||
BASE_BUILDDIR=build | ||
BUILDNAME=$(GOOS)-$(GOARCH) | ||
BUILDDIR=$(BASE_BUILDDIR)/$(BUILDNAME) | ||
VERSION?=dev | ||
|
||
ifeq ($(GOOS),windows) | ||
ext=.exe | ||
archiveCmd=zip -9 -r $(NAME)-$(BUILDNAME)-$(VERSION).zip $(BUILDNAME) | ||
else | ||
ext= | ||
archiveCmd=tar czpvf $(NAME)-$(BUILDNAME)-$(VERSION).tar.gz $(BUILDNAME) | ||
endif | ||
|
||
.PHONY: default | ||
default: build | ||
|
||
build: clean | ||
go build -ldflags "-X main.VersionString=$(VERSION)" | ||
|
||
release: check-env-release | ||
mkdir -p $(BUILDDIR) | ||
cp LICENSE $(BUILDDIR)/ | ||
cp README.md $(BUILDDIR)/ | ||
GOOS=$(GOOS) GOARCH=$(GOARCH) go build -ldflags "-X main.VersionString=$(VERSION)" -o $(BUILDDIR)/$(NAME)$(ext) | ||
cd $(BASE_BUILDDIR) ; $(archiveCmd) | ||
|
||
test: | ||
go test -race -v -bench=. ./... | ||
|
||
clean: | ||
go clean | ||
rm -rf $(BASE_BUILDDIR) | ||
|
||
check-env-release: | ||
@ if [ "$(GOOS)" = "" ]; then \ | ||
echo "Environment variable GOOS not set"; \ | ||
exit 1; \ | ||
fi | ||
@ if [ "$(GOARCH)" = "" ]; then \ | ||
echo "Environment variable GOOS not set"; \ | ||
exit 1; \ | ||
fi |
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,39 @@ | ||
[](https://goreportcard.com/report/ameshkov/godnsbench) | ||
[](https://github.com/ameshkov/godnsbench/releases) | ||
|
||
# godnsbench | ||
|
||
A very simple DNS benchmarking tool based on [dnsproxy](https://github.com/AdguardTeam/dnsproxy). | ||
|
||
## How to install | ||
|
||
* Using homebrew: | ||
``` | ||
brew install ameshkov/tap/godnsbench | ||
``` | ||
* From source: | ||
``` | ||
go get github.com/ameshkov/godnsbench | ||
``` | ||
* You can get a binary from the [releases page](https://github.com/ameshkov/godnsbench/releases). | ||
## Usage | ||
```shell | ||
Usage: | ||
godnsbench [OPTIONS] | ||
Application Options: | ||
-a, --address= Address of the DNS server you're trying to test. Note, that it should include the protocol | ||
(tls://, https://, quic://) | ||
-p, --parallel= The number of connections you would like to open simultaneously (default: 1) | ||
-q, --query= The host name you would like to resolve (default: example.org) | ||
-t, --timeout= Query timeout in seconds (default: 10) | ||
-c, --count= The overall number of queries we should send (default: 10000) | ||
-v, --verbose Verbose output (optional) | ||
-o, --output= Path to the log file. If not set, write to stdout. | ||
Help Options: | ||
-h, --help Show this help message | ||
``` |
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,35 @@ | ||
module github.com/ameshkov/godnsbench | ||
|
||
go 1.18 | ||
|
||
require ( | ||
github.com/AdguardTeam/dnsproxy v0.44.0 | ||
github.com/AdguardTeam/golibs v0.10.9 | ||
github.com/jessevdk/go-flags v1.5.0 | ||
) | ||
|
||
require ( | ||
github.com/aead/chacha20 v0.0.0-20180709150244-8b13a72661da // indirect | ||
github.com/aead/poly1305 v0.0.0-20180717145839-3fee0db0b635 // indirect | ||
github.com/ameshkov/dnscrypt/v2 v2.2.3 // indirect | ||
github.com/ameshkov/dnsstamps v1.0.3 // indirect | ||
github.com/cheekybits/genny v1.0.0 // indirect | ||
github.com/fsnotify/fsnotify v1.5.1 // indirect | ||
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 // indirect | ||
github.com/lucas-clemente/quic-go v0.28.1 // indirect | ||
github.com/marten-seemann/qtls-go1-16 v0.1.5 // indirect | ||
github.com/marten-seemann/qtls-go1-17 v0.1.2 // indirect | ||
github.com/marten-seemann/qtls-go1-18 v0.1.2 // indirect | ||
github.com/marten-seemann/qtls-go1-19 v0.1.0-beta.1 // indirect | ||
github.com/miekg/dns v1.1.44 // indirect | ||
github.com/nxadm/tail v1.4.8 // indirect | ||
github.com/onsi/ginkgo v1.16.5 // indirect | ||
golang.org/x/crypto v0.0.0-20220315160706-3147a52a75dd // indirect | ||
golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 // indirect | ||
golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e // indirect | ||
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect | ||
golang.org/x/text v0.3.7 // indirect | ||
golang.org/x/tools v0.1.10 // indirect | ||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect | ||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect | ||
) |
Oops, something went wrong.