Skip to content

Commit

Permalink
improved readme, added more logs
Browse files Browse the repository at this point in the history
  • Loading branch information
ameshkov committed Aug 18, 2022
1 parent 18edc1f commit 02ba5b3
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
.idea
.vscode
build
godnsbench
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,21 @@ Application Options:
Help Options:
-h, --help Show this help message
```

## Examples

10 connections, 1000 queries to Google DNS using DNS-over-TLS:
```shell
godnsbench -a tls://dns.google -p 10 -c 1000
```

10 connections, 1000 queries for `example.net` to Google DNS using DNS-over-TLS:
```shell
godnsbench -a https://dns.google/dns-query -p 10 -c 1000 -q example.net
```

10 connections, 1000 queries for `example.net` with timeout 1 second to
AdGuard DNS using DNS-over-QUIC:
```shell
godnsbench -a quic://dns.adguard.com/dns-query -p 10 -c 1000 -t 1 -q example.net
```
Binary file modified godnsbench
Binary file not shown.
6 changes: 6 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ func run(options *Options) {
log.Info("Connections count: %d", options.Connections)
log.Info("Query: %s", options.Query)
log.Info("Queries to send: %d", options.QueriesCount)
log.Info("Query timeout: %d seconds", options.Timeout)

_, err := upstream.AddressToUpstream(options.Address, &upstream.Options{})
if err != nil {
Expand Down Expand Up @@ -212,6 +213,11 @@ func runConnection(options *Options, state *runState) {
} else {
_ = state.incErrors()
log.Debug("error occurred: %v", err)

// We should re-create the upstream in this case.
u, _ = upstream.AddressToUpstream(options.Address, &upstream.Options{
Timeout: time.Duration(options.Timeout) * time.Second,
})
}

queriesToSend = state.decQueriesToSend()
Expand Down

0 comments on commit 02ba5b3

Please sign in to comment.