Commit Graph

25 Commits

Author SHA1 Message Date
ThinkChaos b335887992 refactor(log): store log in context so it's automatically propagated 2024-03-19 19:10:07 -04:00
ThinkChaos d83b7432d4 refactor(log): use `logrus.Level` directly and document `trace` level 2024-03-19 19:10:07 -04:00
ThinkChaos 4e89b44185 fix(util): make `FatalOnError` override `log.Silence` 2023-11-23 08:45:18 -05:00
ThinkChaos d52c598546
fix(tests): properly silence log output (#1259)
* fix(tests): properly silence log output

Using `init` allows it to also work for benchmarks.
And `log.Silence` was sometimes getting overridden by `log.init`.

* squash: fix(server): don't setup the logger again
2023-11-19 17:51:49 -05:00
Kwitsch d87e6b4157
fix: ANSI color codes being printed on Windows (#1225)
* added go-colorable

* fixed bug which prevented windows builds
2023-11-08 00:29:53 +01:00
DerRockWolf c112e86740
feat: add upstream strategy `strict` (#1093) 2023-08-21 09:50:23 +02:00
ThinkChaos 56633da0a7 feat(sudn): refactor and expand supported special use domains RFCs 2023-07-14 17:38:13 -04:00
ThinkChaos 5088c75a78
refactor: configuration rework (usage and printing) (#920)
* refactor: make `config.Duration` a struct with `time.Duration` embed

Allows directly calling `time.Duration` methods.

* refactor(HostsFileResolver): don't copy individual config items

The idea is to make adding configuration options easier, and searching
for references straight forward.

* refactor: move config printing to struct and use a logger

Using a logger allows using multiple levels so the whole configuration
can be printed in trace/verbose mode, but only important parts are
shown by default.

* squash: rename `Cast` to `ToDuration`

* squash: revert `Duration` to a simple wrapper ("new type" pattern)

* squash: `Duration.IsZero` tests

* squash: refactor resolvers to rely on their config directly if possible

* squash: implement `IsEnabled` and `LogValues` for all resolvers

* refactor: use go-enum `--values` to simplify getting all log fields

* refactor: simplify `QType` unmarshaling

* squash: rename `ValueLogger` to `Configurable`

* squash: rename `UpstreamConfig` to `ParallelBestConfig`

* squash: rename `RewriteConfig` to `RewriterConfig`

* squash: config tests

* squash: resolver tests

* squash: add `ForEach` test and improve `Chain` ones

* squash: simplify implementing `config.Configurable`

* squash: minor changes for better coverage

* squash: more `UnmarshalYAML` -> `UnmarshalText`

* refactor: move `config.Upstream` into own file

* refactor: add `Resolver.Type` method

* squash: add `log` method to `typed` to use `Resolover.Type` as prefix

* squash: tweak startup config logging

* squash: add `LogResolverConfig` tests

* squash: make sure all options of type `Duration` use `%s`
2023-03-12 22:14:10 +01:00
ThinkChaos 7c76836373 feat: stack log prefixes to differentiate between log emitters
The goal is to be able to tell apart logs from difference sources, such
as `bootstrap.parallel_best_resolver` and `parallel_best_resolver`.
2023-01-18 18:57:55 +01:00
Kwitsch 9abeaeddea
Added gofumpt (#805)
* fix linter errors

* added gofumpt

* Makefile cleanup

* gofumpt run

* Update Makefile

Co-authored-by: ThinkChaos <ThinkChaos@users.noreply.github.com>

* go mod tidy

* fmt + lint

* go mod tidy

Co-authored-by: ThinkChaos <ThinkChaos@users.noreply.github.com>
2022-12-26 22:11:45 +01:00
Kwitsch b73cd3b5ba
Config restructuring (#771)
To declutter the global top level config options i propose the grouping of ports and logging options as child options of top level options.

New structure:
ports:
  dns: 43
  http: 4000
  https: 4443
  tls: 853
log:
  level: warn
  format: json
  privacy: true
  timestamp: false
2022-12-02 21:55:40 +01:00
Dimitri Herzog f78a57a94d
chore(build): add additional linters (#774)
* chore(build): add nolintlint linter

* chore(build): add usestdlibvars linter
2022-11-29 21:58:26 +01:00
Dimitri Herzog 3e95b12eed feat: caching for empty DNS responses (#700) 2022-11-08 21:45:28 +01:00
Dimitri Herzog 421807fc22
chore: update golangci-lint (#631) 2022-08-19 22:04:35 +02:00
Dimitri Herzog 3c5b7a20dc
chore: Managing of external tools with go modules (#616) (#617) 2022-08-03 22:10:07 +02:00
deso 6ddee221e4
Disable colors when not in interactive terminal (#602) (#603)
Forcing colors in logrus causes color escapes sequences when logging to file or pipe.
2022-08-01 22:36:54 +02:00
ThinkChaos 62c7816ab3
Support of DoH/DoT as bootstrap DNS (#485) 2022-04-22 22:12:35 +02:00
Dimitri Herzog 476dd7d0eb update go-enum to v0.4.0 2022-03-28 21:35:48 +02:00
Dimitri Herzog 61ca25c64c sanitize log output 2021-12-20 22:37:32 +01:00
Dimitri Herzog ee8f041938 refactoring: generate enums 2021-09-11 21:31:03 +02:00
Joseph Harnish 1ea60579a7
#182 - added config option for logTimestamp (#184)
* added config option for logTimestamp

* set default to be true
2021-04-17 22:23:51 +02:00
Dimitri Herzog 21f9b90841 go fmt 2021-02-26 21:39:41 +01:00
donald-art 7ee2e7db64
public API documentation (#146)
* added doc comments

* added doc comments

* added doc comments

* added doc comments

* added doc comments

* added doc comments

* added doc comments

* added doc comments

* added doc comments

* added doc comments

* added doc comments

* added doc comments

* added doc comments

* added doc comments

* added doc comments

* added doc comments

* added doc comments

* added doc comments

* added doc comments

* added doc comments

* added doc comments

* added doc comments

* added doc comments

* added doc comments

* added doc comments

* added doc comments

* added doc comments
2021-02-26 13:45:57 +01:00
Dimitri Herzog 8f23f47a6d Renamed function, replaced global variable with function call, Initialize global logger only once, minor refactorings, fixed failing tests 2021-02-25 23:36:39 +01:00
nicolas-martin 3b0bbc5f6b use package logger instead of global 2021-02-22 17:28:48 -05:00