Commit Graph

62 Commits

Author SHA1 Message Date
Kwitsch debac9eaa8
Refactoring/linter (#1447)
* update golangci-lint to v1.57.2

* linter fixes
2024-04-12 16:44:50 -04:00
ThinkChaos bcd1381e18 feat: update list config and code to use "allow/deny" language 2024-04-11 18:33:09 -04:00
ThinkChaos 3fcf379df7 refactor(util): make `LogOnError` get the log from a `Context` 2024-03-19 19:10:07 -04:00
ThinkChaos 8c7b89cbb3 refactor(tests): remove `TmpFile.Error` to centralize error checks 2023-12-01 15:53:11 -05:00
ThinkChaos 891d0fba74 refactor(tests): move `DeferCleanup` into helper functions 2023-12-01 15:53:11 -05:00
Kwitsch 976d6198f1
Refactoring server.go (#1277)
* made Stop context aware

* added error check

* context aware OnRequest

* linter fix

* fixed some flakiness in tests

* made DoGetRequest context aware

* this doesn't belong there and produces flakyness
2023-11-28 07:02:51 +01:00
Nahshon Unna Tsameret 15bd383460
ginkgolinter: enable all checks and fix findings (#1274)
ginkgolinter configuration argument names may be a bit misleading.
Assuming the linter added to use it, this PR remove all the
supress-warning configurations.

Two error checks now found by the linter and fixed as well.
2023-11-26 16:10:38 +01: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 8ece708fe9
devcontainer & unit test refactoring (#1220)
* extension cleanup & added ginkgo watch

* added gcov2lcov

* added test explorer and reworked scripts

* go mod tidy

* use package cache volume

* script rework

* defined tasks

* defined launch

* don't try to convert if test was canceld

* generate lcov only in devcontainer

* disable coverage upload on forks

* wip: make lcov

* fixed unit tests for parallel

* parallel test for lists

* fix serve test for parallel

* parallel test fixes

* deleted accident commit

* wip: make lcov

* restructured settings location

* start script refactoring

* added GetProcessPort

* fixed parallel ports

* race fix

* changed port for github runner binding

* fixed local list var in test

* more local vars in tests fix

* less local vars

* run test & race parallel

* removed invalid error check

* fixed error  check

* less local variables

* fixed timing problem

* removed gcov2lcov

* added generate-lcov

* added GINKGO_PROCS to makefile

* fixed workflow

* run generate-lcov on save *.go

* added tooltitude
2023-11-11 11:58:31 -05:00
Dimitri Herzog 33ea933015
refactor: pass context for goroutine shutdown (#1187) 2023-10-07 16:21:40 -04:00
Dimitri Herzog d77f0ed54f
feat: add API endpoint to flush the DNS Cache (#1178) 2023-09-30 16:13:01 -04:00
Dimitri Herzog 65ff6847ad fix: return error code on server starup failure (#1165) 2023-09-20 17:44:52 +02:00
Dimitri Herzog 72d747c16f
feat: API-first approach for REST interface (#1129)
* feat: embed OpenAPI definition file

* feat: use OpenAPI generated server and client

* feat: provide OpenAPI interface documentation

* chore(test): add additional tests
2023-09-09 19:30:55 +02:00
ThinkChaos 639fba5323 refactor(config): allow more configuration for `upstreams`
Rename the `upstream` option to `upstreams.groups` so we can have
more `upstreams` options.
2023-08-01 15:01:40 -04:00
ThinkChaos 8a93e4500c style: fix all existing lint errors 2023-07-07 09:16:20 -04:00
ThinkChaos 42db8ec943 fix: parse the API URL using the non-deprecated options 2023-07-07 09:16:20 -04:00
ThinkChaos a79459987b feat(bootstrap): support multiple upstreams
If more than one upstream is configured, they are raced via
a `ParallelBestResolver`.
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
Kwitsch 7236ad13cf
Merge pull request #651 from kwitsch/fb-workflow_rework
GitHub workflow rework
2022-11-04 20:43:24 +01:00
ThinkChaos f724bda5cd Enable nosprintfhostport linter 2022-11-04 08:29:16 +01:00
Kwitsch 5c20f01680 another one 2022-09-23 20:02:03 +02:00
Kwitsch 5bfed0e980
Docker container rework (#638) 2022-09-08 22:34:08 +02:00
Dimitri Herzog 421807fc22
chore: update golangci-lint (#631) 2022-08-19 22:04:35 +02:00
Kwitsch 51ef9ea77f
test: fix flaky test(537) - second hunt (#610)
* go test -> ginkgo

* removed flake-attempts as suggested

* added FlakeAttempts to flaky test definition

* as net.DNSError qualifies as net.Error check and correct the response

* fix in downloader.go resolves flaky tests

* unwrap maybe?

* excluede DownloadFile from funlen linter

* use eventually on io operations in file_writer_test

* file_writer_test flaky fixes

* fix linter errors

* Serve test reversed go routine

* matcher fix

* serve test rework 2

* DeferCleanup tmp files

* fixed some flakiness in resolver tests

* go mod tidy

* fixed linter errors

* JustAfterEach -> DeferCleanup

* changed close to defer

* moved unwrap from downloader to test

* fix linter error

* propper cleanup in "should return error"

Co-authored-by: Dimitri Herzog <dimitri.herzog@gmail.com>
2022-08-01 22:27:11 +02:00
FileGo 0731ebe18a
Support for multiple configuration files (#534) 2022-05-25 15:13:52 +02:00
Dimitri Herzog f2d5b568aa add logging on server start 2022-05-16 21:26:32 +02:00
Dimitri Herzog a4b89537db
update golangci-lint (#510)
* update golangci-lint

* enable gomnd linter

* enable asciicheck linter

* enable bidichk linter

* enable durationcheck linter

* enable errchkjson linter

* enable errorlint linter

* enable exhaustive linter

* enable gomoddirectives linter

* enable gomodguard guard

* enable grouper linter

* enable grouper and ifshort linters

* enable importas linter

* enable makezero linter

* enable nestif linter

* enable nilerr linter

* enable nilnil linter

* enable nlreturn linter

* enable nolintlint linter

* enable predeclared linter

* enable sqlclosecheck linter

* enable tenv linter

* enable wastedassign linter
2022-05-10 09:09:50 +02:00
Dimitri Herzog 41febafd41
chore: test cleanup and refactoring (#509)
test: added additional assertions, introduced channels for bus event tests, refactoring, eliminating race conditions in tests, enable race check in tests
2022-05-06 22:34:08 +02:00
ThinkChaos 62c7816ab3
Support of DoH/DoT as bootstrap DNS (#485) 2022-04-22 22:12:35 +02:00
Dimitri Herzog 28789ee7fe
filtering of queries (#450) (#474) 2022-04-01 08:58:09 +02:00
ThinkChaos 27c8cbf2b7
Update to gingko v2 (#447) 2022-03-03 11:27:27 +01:00
ThinkChaos 69dc38308c
Allow configuring multiple listen addresses for each port (#372) 2021-12-20 22:13:07 +01:00
Dimitri Herzog cd767960a5 introduced go-multierror to handle multiple errors 2021-10-13 22:45:32 +02:00
Kwitsch e5b44f49ca
application startup should fail if initial download of a single list failed (#310) (#313)
application startup should fail if initial download of a single list failed
2021-10-13 21:30:14 +02:00
Dimitri Herzog ee8f041938 refactoring: generate enums 2021-09-11 21:31:03 +02:00
Dimitri Herzog 919512959b use full-qualified name as module 2021-08-27 13:41:36 +02:00
Dimitri Herzog 850baf0e47
bootstrapDNS not used for upstream DNS resolution (#242) (#246) 2021-08-21 23:19:30 +02:00
Dimitri Herzog 59ec29be77 fix lint warning 2021-07-16 23:13:32 +02:00
Dimitri Herzog 447821f646
Unable to set IP for http/https port (#221) (#226)
#221: Unable to set IP for http/https port
2021-06-28 07:51:46 +02:00
Dimitri Herzog fb26cb70e3
Fix "misuse of unbuffered os.Signal channel as argument to signal.Notify (govet)" (#215) 2021-05-28 09:30:26 +02:00
Joseph Harnish d8903bc9c5
#203: Added version to web interface. (#195)
* Added more data to template data, and push the version to server.go in the makefile

* moving version and build time to util package, added build time to the web interface

Co-authored-by: Dimitri Herzog <dimitri.herzog@gmail.com>
2021-05-05 22:38:22 +02:00
Dimitri Herzog 314922a028 #111: allow the ability to enable/disable blocking by group 2021-04-28 22:38:23 +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 efb5ac37af #147: Blocky commands do not run without local ./config.yml file 2021-02-26 22:42:00 +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