Skip to content

Commit

Permalink
restructure project packages
Browse files Browse the repository at this point in the history
  • Loading branch information
Ondřej Benkovský committed Apr 22, 2024
1 parent 415b1c8 commit dad75f1
Show file tree
Hide file tree
Showing 39 changed files with 1,215 additions and 900 deletions.
25 changes: 16 additions & 9 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,29 @@ run:
linters:
disable-all: true
enable:
- gci
- gocritic
- godot
- gofmt
- gofumpt
- goimports
- gomoddirectives
- gomodguard
- gosec
- gosimple
- govet
- ineffassign
- revive
- staticcheck
- stylecheck
- testifylint
- typecheck
- unconvert
- unparam
- unused
- gofmt
- revive
- gci
- gofumpt
- usestdlibvars
- wastedassign
- whitespace
- godot
- unparam
- gocritic
- unconvert
- gosec

issues:
include:
Expand Down
2 changes: 1 addition & 1 deletion .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ builds:
- windows
- darwin
ldflags:
- -X 'github.com/tantalor93/dnspyre/v2/cmd.Version={{.Version}}-{{ .Os }}-{{ .Arch }}'
- -X 'github.com/tantalor93/dnspyre/v3/cmd.Version={{.Version}}-{{ .Os }}-{{ .Arch }}'
archives:
- id: dnspyre
name_template: '{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Release](https://img.shields.io/github/release/Tantalor93/dnspyre/all.svg)](https://github.com/tantalor93/dnspyre/releases)
[![Go version](https://img.shields.io/github/go-mod/go-version/Tantalor93/dnspyre)](https://github.com/Tantalor93/dnspyre/blob/master/go.mod#L3)
[![](https://godoc.org/github.com/Tantalor93/dnspyre/v2/cmd?status.svg)](https://godoc.org/github.com/tantalor93/dnspyre/v2/cmd)
[![](https://godoc.org/github.com/Tantalor93/dnspyre/v3?status.svg)](https://godoc.org/github.com/tantalor93/dnspyre/v3e)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
[![Tantalor93](https://circleci.com/gh/Tantalor93/dnspyre/tree/master.svg?style=svg)](https://circleci.com/gh/Tantalor93/dnspyre?branch=master)
[![lint](https://github.com/Tantalor93/dnspyre/actions/workflows/lint.yml/badge.svg?branch=master)](https://github.com/Tantalor93/dnspyre/actions/workflows/lint.yml)
Expand Down
274 changes: 0 additions & 274 deletions cmd/report_test.go

This file was deleted.

17 changes: 11 additions & 6 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import (

"github.com/alecthomas/kingpin/v2"
"github.com/miekg/dns"
"github.com/tantalor93/dnspyre/v3/pkg/dnsbench"
"github.com/tantalor93/dnspyre/v3/pkg/printutils"
"github.com/tantalor93/dnspyre/v3/pkg/reporter"
)

var (
Expand All @@ -22,7 +25,9 @@ var (
var (
pApp = kingpin.New("dnspyre", "A high QPS DNS benchmark.").Author(author)

benchmark Benchmark
benchmark = dnsbench.Benchmark{
Writer: os.Stdout,
}
)

func init() {
Expand Down Expand Up @@ -109,10 +114,10 @@ func init() {
Default("svg").EnumVar(&benchmark.PlotFormat, "svg", "png", "jpg")

pApp.Flag("doh-method", "HTTP method to use for DoH requests. Supported values: get, post.").
Default("post").EnumVar(&benchmark.DohMethod, getMethod, postMethod)
Default(dnsbench.PostHTTPMethod).EnumVar(&benchmark.DohMethod, dnsbench.GetHTTPMethod, dnsbench.PostHTTPMethod)

pApp.Flag("doh-protocol", "HTTP protocol to use for DoH requests. Supported values: 1.1, 2 and 3.").
Default(http1Proto).EnumVar(&benchmark.DohProtocol, http1Proto, http2Proto, http3Proto)
Default(dnsbench.HTTP1Proto).EnumVar(&benchmark.DohProtocol, dnsbench.HTTP1Proto, dnsbench.HTTP2Proto, dnsbench.HTTP3Proto)

pApp.Flag("insecure", "Disables server TLS certificate validation. Applicable for DoT, DoH and DoQ.").
Default("false").BoolVar(&benchmark.Insecure)
Expand Down Expand Up @@ -165,10 +170,10 @@ func Execute() {
end := time.Now()

if err != nil {
errPrint(os.Stderr, "There was an error while starting benchmark: %s\n", err.Error())
printutils.ErrPrint(os.Stderr, "There was an error while starting benchmark: %s\n", err.Error())
} else {
if err := benchmark.PrintReport(os.Stdout, res, start, end.Sub(start)); err != nil {
errPrint(os.Stderr, "There was an error while printing report: %s\n", err.Error())
if err := reporter.PrintReport(&benchmark, res, start, end.Sub(start)); err != nil {
printutils.ErrPrint(os.Stderr, "There was an error while printing report: %s\n", err.Error())
}
}
}
Expand Down
Loading

0 comments on commit dad75f1

Please sign in to comment.