Commit Graph

84 Commits

Author SHA1 Message Date
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
DerRockWolf c112e86740
feat: add upstream strategy `strict` (#1093) 2023-08-21 09:50:23 +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 56633da0a7 feat(sudn): refactor and expand supported special use domains RFCs 2023-07-14 17:38:13 -04:00
ThinkChaos cfc3699ab5 feat: support multiple hosts files 2023-07-07 09:16:20 -04:00
Dimitri Herzog 8e70b8a975
chore(build): update golangci-lint (#931) 2023-03-16 07:49:09 +01: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
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
ThinkChaos c06c017a1a fix: `startVerifyUpstream` not disabling all start checks 2022-12-02 12:56:44 -05: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 e65a615418 Merge branch 'development' into fb-635 2022-09-09 21:11:15 +02:00
Kwitsch 2f7a30a3b9 rename SudnResolver to SpecialUseDomainNamesResolver 2022-09-09 21:02:01 +02:00
Kwitsch 7f3a6ef358 added sudn_resolver to chain 2022-09-04 01:57:18 +02:00
Dimitri Herzog 3c334c13b4 configure timeouts for http(s) listeners 2022-09-03 23:10:59 +02:00
FileGo 89927aa929
Change self-signed cert to ECDSA (#639)
Co-authored-by: Dimitri Herzog <dimitri.herzog@gmail.com>
2022-09-03 22:24:29 +02:00
Kwitsch 5e9eaa2965
delivery of blocking group as EDNS error(560) (#611) 2022-08-06 22:30:26 +02:00
Dimitri Herzog b1973702bd chore: update golangci-lint to v1.47.3 2022-08-01 23:19:35 +02:00
Kwitsch c912356740
Option to handle FQDN only requests (#561) 2022-06-20 13:02:51 +02:00
Dimitri Herzog 07b77653b1 generate self-signed certificate only if TLS or HTTPS listener are enabled 2022-06-04 13:41:39 +02:00
Peter Dave Hello e6957a3ff8
Make DoH/DoT server mininum TLS version configurable (#546)
* Make DoH/DoT server mininum TLS version configurable

* Disable gosec lint on server TLSConfig
2022-06-04 08:23:40 +02:00
Peter Dave Hello a120aafcdd
Add HTTP Secure Headers on HTTPS server response (#545) 2022-06-02 16:42:23 +02:00
FileGo 92fd6235bf
Self-signed certificate generation (#532)
* Added self-signed certificate functionality

Co-authored-by: Dimitri Herzog <dimitri.herzog@gmail.com>
2022-05-27 22:20:44 +02:00
Peter Dave Hello 43d3e15549
Use same minTLS ver & cipher for DoH as DoT server (#524) 2022-05-18 08:10:18 +02:00
Dimitri Herzog 2994e2a301
add additional logging context (#482) (#516) 2022-05-16 21:42:18 +02:00
Peter Dave Hello 4780b4808c
Improve DoT server TLS cipher suites (#520)
This removes some VULNERABLE, or potentially VULNERABLE ciphers, like
Triple DES and Obsoleted CBC ciphers, for the DoT server.
2022-05-16 21:41:39 +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 f8b6e59ef4
Add rewrite support to custom DNS (#449)
This commit extracts rewriting logic from `ConditionalUpstreamResolver`
into the new `RewriterResolver`, and uses that to enable rewriting for
the `CustomDNSResolver`.
`RewriterResolver` wraps a resolver and applies the rewrite to the
request that is forwarded to the inner resolver.

It also introduces a new optional interface: `NamedResolver`.
This allows a `Resolver` to choose what its user friendly name is,
instead of always being its type name.
2022-03-17 22:30:21 +01:00
Kwitsch ee451f8b36
Sync blocking enable/disable over redis (#377) (#403)
Co-authored-by: Dimitri Herzog <dimitri.herzog@gmail.com>
2022-01-19 22:03:41 +01:00
FileGo b43c7aa2cb
Enable resolving hosts file (#362)
fixes #362 

Co-authored-by: Dimitri Herzog <dimitri.herzog@gmail.com>
2022-01-04 15:40:09 +01:00
Dimitri Herzog 7ea5ba4cac updated github.com/go-chi/chi 2021-12-24 23:04:47 +01:00
Dimitri Herzog d6bb02f26f fix lint issues 2021-12-21 22:02:15 +01:00
Kwitsch d3611fb444
FR: DNS cache sync between multiple blocky instances (#344) (#365) 2021-12-21 17:06:16 +01:00
ThinkChaos 69dc38308c
Allow configuring multiple listen addresses for each port (#372) 2021-12-20 22:13:07 +01:00
Dimitri Herzog 9b9596970c Improved configuration output (duration format, etc.) 2021-11-07 21:35:16 +01:00
Dimitri Herzog a90fb5d1c2
Extract client name from the URL (DoH and DoT) (#317)
* Extract client name from the URL (DoH and DoT) #304

* improved tests
2021-10-13 22:47:14 +02:00
Dimitri Herzog cd767960a5 introduced go-multierror to handle multiple errors 2021-10-13 22:45:32 +02:00
Dimitri Herzog 57036aa088 fixed golangci-lint issues 2021-10-13 21:40:18 +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 c22292eb19 DoT (DNS-over-TLS) server (#303) 2021-10-04 21:56:18 +02:00
Dimitri Herzog 43bd5684a1 Remove stats resolver (#266) 2021-09-13 22:32:34 +02:00
Dimitri Herzog e6ca89607a write database entries async in bulk 2021-09-13 22:06:21 +02:00
Dimitri Herzog ee8f041938 refactoring: generate enums 2021-09-11 21:31:03 +02:00
Dimitri Herzog 63735546bb moving model types to the separate package 2021-09-08 21:38:34 +02:00
Dimitri Herzog 919512959b use full-qualified name as module 2021-08-27 13:41:36 +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 114171a45d set the truncated header when sending large responses via UDP and enable compression #205 2021-05-08 22:56:18 +02:00