Compare commits

..

13 Commits

Author SHA1 Message Date
Ainar Garipov
62a8fe0b73 Pull request: home: add a patch against the global pprof handlers
Merge in DNS/adguard-home from 2336-pprof to master

Closes #2336.

Squashed commit of the following:

commit 855e133b17da4274bef7dec5c3b7db73486d97db
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Nov 19 14:49:22 2020 +0300

    home: add a patch against the global pprof handlers
2020-11-19 14:59:30 +03:00
Ainar Garipov
b1c71a1284 Pull request: all: prepare for v0.104.2
Merge in DNS/adguard-home from prepare-release to master

Squashed commit of the following:

commit cf4cad216fa259b260bc9cfbd99938979b10623c
Merge: 5434ab5c1 4690229d8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Nov 19 13:08:50 2020 +0300

    Merge branch 'master' into prepare-release

commit 5434ab5c178942e8db9e99758c86d22e977d092f
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Nov 19 13:01:43 2020 +0300

    all: prepare for v0.104.2
2020-11-19 13:14:52 +03:00
Ainar Garipov
4690229d81 Pull request: querylog: use better error signaling
Merge in DNS/adguard-home from 2325-querylog-suffering to master

Closes #2325.

Squashed commit of the following:

commit 90388050ed495286cdfed6574dd438abd4a33baa
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Nov 19 12:37:00 2020 +0300

    all: changelog

commit bbdeabbb550c7e98f579e2a68c71de7a66624203
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Nov 19 12:33:21 2020 +0300

    querylog: improve error reporting

commit 807b23aa74d0e39f5ef51910e5b91c9b95a8c341
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Wed Nov 18 19:39:22 2020 +0300

    querylog: improve docs

commit 65a8f4f3323192c872b3389d2b3420e072a01297
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Wed Nov 18 19:36:28 2020 +0300

    querylog: use better error signaling
2020-11-19 12:53:31 +03:00
Eugene Burkov
de257b73aa Pull request: update golangci-lint and golangci-lint-actions versions
Merge in DNS/adguard-home from linter-version-update to master

Squashed commit of the following:

commit 3ab2cb198dd924d86f5e6b92d101846acc747e9b
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Wed Nov 18 16:42:13 2020 +0300

    all: update golangci-lint and golangci-lint-actions versions
2020-11-18 18:42:26 +03:00
Eugene Burkov
40614d9a7b Pull request: querylog bug fix
Merge in DNS/adguard-home from 2324-querylog-bug-fix to master

Closes #2324.

Squashed commit of the following:

commit fdd584a218e1edc3e45ab5b00ceed0a3be681e32
Merge: 8103f9e42 f2eda6d19
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Wed Nov 18 15:35:42 2020 +0300

    Merge branch 'master' into 2324-querylog-bug-fix

commit 8103f9e42a398f43682ee30d09b3afdab0e9e177
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Wed Nov 18 14:28:29 2020 +0300

    querylog: fix the file ordering bug

commit 2c4e8fcc5b8593be1614480508dfd600fc676e64
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Tue Nov 17 20:57:45 2020 +0300

    querylog: wrap errors to clarify error trace

commit 3733062b494817696e4443f153774bb01cea1b06
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Tue Nov 17 18:55:17 2020 +0300

    querylog: fix logger output bug
2020-11-18 15:43:28 +03:00
Ainar Garipov
f2eda6d192 Pull request: - client: 2326 Fix dhcp bug interfaces bug
Merge in DNS/adguard-home from fix/2326 to master

Closes #2326.

Squashed commit of the following:

commit 31f24d733eda747e161ddd44055591dbbc0752d7
Author: Artem Baskal <a.baskal@adguard.com>
Date:   Tue Nov 17 18:16:19 2020 +0300

    - client: 2326 Fix dhcp bug interfaces bug
2020-11-17 19:56:58 +03:00
Eugene Burkov
8a9c6e8a02 Pull request: cover with tests
Merge in DNS/adguard-home from 2271-cover-with-tests to master

Updates #2271.

Squashed commit of the following:

commit db6440efe05171bc15367a2996521848ca348053
Merge: db7fa726b bf4c256c7
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Mon Nov 16 19:23:09 2020 +0300

    Merge branch 'master' into 2271-cover-with-tests

commit db7fa726bb91b08ec7aaa6c0c818c88b5feb87cd
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Mon Nov 16 18:26:51 2020 +0300

    all: clean dependencies sum

commit b8dc6078c4bcc0de1b7e9073832de122f6fe38a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Mon Nov 16 16:46:00 2020 +0300

    testutil: improve code quality

commit 001b7194682b1f00aa54dc5a28236faed5a5b02d
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Mon Nov 16 16:29:49 2020 +0300

    testutil: enhance functionality

commit f6ccd91a4df6c56778eab8ae50e88e3818b20dd3
Merge: 43fa2eefb 6358240e9
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Mon Nov 16 15:57:37 2020 +0300

    Merge branch 'master' into 2271-cover-with-tests

commit 43fa2eefbc10ef361603cacc1ca12092b12a057a
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Mon Nov 16 14:55:15 2020 +0300

    querylog: replace fake log with real in tests

commit b95bee7565a14a02c80c78131b3ced224663dd8a
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Mon Nov 16 12:38:59 2020 +0300

    dnsfilter: replace thoughtless declaration with idiomatic one

commit a210b1586092e7ae91a9e67c972fa2d2f6baded6
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Fri Nov 13 19:00:25 2020 +0300

    all: refresh golibs dependencies

commit 4ff97bd1ade6c80e274ff5716e44df4eba55bdd9
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Fri Nov 13 18:38:47 2020 +0300

    all: remove std log

commit 542dbda10fefce9f46d15489712b163d919b1291
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Fri Nov 13 13:46:39 2020 +0300

    querylog: improve test logic and readability

commit 796d402385925e8e62a1b4c7bf56e4ceec22418c
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Thu Nov 12 19:06:42 2020 +0300

    all: improve code quality

commit e81894c11ef15b0453e8e5297f1349936a32f9dd
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Thu Nov 12 18:32:30 2020 +0300

    all: cover with tests

commit 252d81fc8a50a91b02cf0f6f35cc22178a2a4d90
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Thu Nov 12 17:32:01 2020 +0300

    all: cover with tests
2020-11-16 19:45:31 +03:00
Ainar Garipov
bf4c256c72 Pull request: return 501 when we don't support features
Merge in DNS/adguard-home from 2295-dhcp-windows to master

Updates #2295.

Squashed commit of the following:

commit 3b00a90c3d9bc33e9af478e4062c0f938d4f327d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Nov 16 16:45:43 2020 +0300

    all: use the 501 handlers instead of the real ones, revert other changes

commit 0a3b37736a21abd6181e0d28c32069e8d7a576d0
Merge: 45feba755 6358240e9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Nov 16 15:59:15 2020 +0300

    Merge branch 'master' into 2295-dhcp-windows and update

commit 45feba755dde37e43cc8075b896e1576157341e6
Merge: cd987d8bc a19523b25
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Nov 16 15:51:16 2020 +0300

    Merge branch 'master' into 2295-dhcp-windows

commit cd987d8bc2cd524b7454d9037b595069714645f9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Nov 13 15:55:23 2020 +0300

    all: improve tests and refactor dhcp checking code even more

commit 3aad675443f325b5909523bcc1c987aa04ac61d9
Merge: 70c477e61 09196118e
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Nov 13 14:44:43 2020 +0300

    Merge branch 'master' into 2295-dhcp-windows

commit 70c477e61cdc1237603918f1c44470c1549f1136
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Nov 13 14:34:06 2020 +0300

    home: fix dhcpd test on windows

commit e59597d783fb9304e63f94eee2b5a5d67a5b2169
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Nov 13 13:38:25 2020 +0300

    all: mention the feature in the changelog

commit 5555c8d881b1c20b5b0a0cb096a17cf56e209c06
Merge: c3b6a5a93 e802e6645
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Nov 13 13:35:35 2020 +0300

    Merge branch 'master' into 2295-dhcp-windows

commit c3b6a5a930693090838eb1ef9f75a09b5b223ba6
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Nov 12 20:37:09 2020 +0300

    util: fix comment

commit ed92dfdb5d3a6c4ba5d032cbe781e7fd87882813
Author: ArtemBaskal <asbaskal@miem.hse.ru>
Date:   Thu Nov 12 20:24:14 2020 +0300

    Adapt client

commit e6f0494c20a4ad5388492af9091568eea5c6e2d6
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Nov 12 13:35:25 2020 +0300

    return 501 when we don't support features
2020-11-16 19:01:12 +03:00
Eugene Burkov
6358240e9b Pull request: 2273 clean tests output
Merge in DNS/adguard-home from 2273-clean-tests-output to master

Closes #2273.

Squashed commit of the following:

commit 7571a33fc1f76300bd256578b3afa95338e399c4
Merge: f17df0f9c a19523b25
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Mon Nov 16 15:45:30 2020 +0300

    Merge branch 'master' into 2273-clean-tests-output

commit f17df0f9ce2a3ed25db33fbc6a2e7cabd33f657b
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Mon Nov 16 15:35:42 2020 +0300

    home: move build constraint on top line

commit 3717c8ef5a51f9dcaa7e524bfa7b0f1d90bec93d
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Mon Nov 16 15:24:50 2020 +0300

    all: add improvements to changelog

commit de6d5afe39d74a3c3d3e0bbe6d0e09aea0214d56
Merge: 43d4f7acf 394fc5a9d
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Mon Nov 16 15:04:38 2020 +0300

    Merge branch 'master' into 2273-clean-tests-output

commit 43d4f7acf188e810aa7277cb6479110c9842e8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Mon Nov 16 13:38:13 2020 +0300

    dnsfilter: remove redundant test logging

commit 7194c1413006b8f52fc454e89ab052bf52e4e517
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Mon Nov 16 12:19:14 2020 +0300

    testutil: improve comments

commit 9f17ab08e287fa69ce30d9e7eec8ea8880f87716
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Sat Nov 14 01:22:08 2020 +0300

    nclient4: fix wrong function name

commit f355749149b2a4485792ba2bdcbc0bb4b629d726
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Sat Nov 14 01:07:22 2020 +0300

    testutil: fix comments and naming

commit f8c50a260bfae08d594a7f37d603941d3680a45e
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Fri Nov 13 14:09:50 2020 +0300

    testutil: create a package and include it

commit f169cdc4084b719de65aa0cdc65200b48785322e
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Thu Nov 12 20:15:58 2020 +0300

    agherr: discard loggers output

commit 360e736b5a2a30f2c5350448234f14b841e3ea27
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Thu Nov 12 20:09:55 2020 +0300

    all: replace default log writer with ioutil.Discard

    Closes #2273.
2020-11-16 15:52:05 +03:00
Artem Baskal
a19523b258 - client: 2237 Update graph drawing library
Squashed commit of the following:

commit 980e9c2f37640ee204ce0365f6c3bcc74741cc7c
Merge: cb4cae82b 394fc5a9d
Author: Artem Baskal <a.baskal@adguard.com>
Date:   Mon Nov 16 14:52:26 2020 +0300

    Merge branch 'master' into fix/2237

commit cb4cae82b5b605894d123d6442ea23b24cc90c12
Author: ArtemBaskal <asbaskal@miem.hse.ru>
Date:   Thu Nov 12 12:07:49 2020 +0300

    minor

commit 5c07dac48067b4ed201aeb59a44e8592ed2b0b67
Author: ArtemBaskal <a.baskal@adguard.com>
Date:   Wed Nov 11 19:47:38 2020 +0300

    minor

commit 53f60762e520427a080bdfcd94b08b9ed3a63ca4
Author: ArtemBaskal <a.baskal@adguard.com>
Date:   Wed Nov 11 19:06:06 2020 +0300

    Adapt mobile version

commit 7659ac733ce4606f6fadf30e0eaddbeefd6095d6
Author: ArtemBaskal <a.baskal@adguard.com>
Date:   Wed Nov 11 18:31:53 2020 +0300

    Fix empty graph offset, return background area below graph

commit 45499adb20a90024dba4b0b4e44ad4f01a1782d5
Author: ArtemBaskal <a.baskal@adguard.com>
Date:   Tue Nov 10 17:46:47 2020 +0300

    - client: 2237 Update graph drawing library
2020-11-16 15:22:30 +03:00
Artem Baskal
394fc5a9d8 - client: 2300 Fix block client bug when clients values are empty in config
Close #2300

Squashed commit of the following:

commit 7222a03ebf3bf8aa93fbd819227e1d5caacce92b
Merge: 91b06b10e 09196118e
Author: Artem Baskal <a.baskal@adguard.com>
Date:   Mon Nov 16 12:46:26 2020 +0300

    Merge branch 'master' into fix/2300

commit 91b06b10e5d46472c9474032d0ae11dc8d0e4609
Author: Artem Baskal <a.baskal@adguard.com>
Date:   Fri Nov 13 15:12:31 2020 +0300

    - client: 2300 Fix block client bug when clients values are empty in config
2020-11-16 12:56:55 +03:00
Ainar Garipov
09196118e9 Pull request: dhcpd: fix possible infinite loop, set timeouts better
Merge in DNS/adguard-home from 2301-dhcp-check to master

Closes #2301.

Squashed commit of the following:

commit bf5c31b8592f909a372fcdaebacc491d310cc3e6
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Nov 13 14:28:54 2020 +0300

    dhcpd: fix possible infinite loop, set timeouts better
2020-11-13 14:40:22 +03:00
Ainar Garipov
e802e6645e Pull request: all: add a changelog and a developer guide
Merge in DNS/adguard-home from 2294-changelog to master

Closes #2294.

Squashed commit of the following:

commit 25ffc9786d23d83448b916a81f0b20135b051169
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Nov 12 19:40:48 2020 +0300

    all: add a changelog and a developer guide
2020-11-13 13:01:07 +03:00
49 changed files with 1394 additions and 322 deletions

View File

@@ -12,10 +12,10 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v1
uses: golangci/golangci-lint-action@v2.3.0
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.27
version: v1.32
eslint:
runs-on: ubuntu-latest

54
CHANGELOG.md Normal file
View File

@@ -0,0 +1,54 @@
# AdGuard Home Changelog
All notable changes to this project will be documented in this file.
The format is based on
[*Keep a Changelog*](https://keepachangelog.com/en/1.0.0/),
and this project adheres to
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
## [v0.104.3] - 2020-11-19
### Fixed
- The accidentally exposed profiler HTTP API ([#2336]).
[#2336]: https://github.com/AdguardTeam/AdGuardHome/issues/2336
## [v0.104.2] - 2020-11-19
### Added
- This changelog :-) ([#2294]).
- `HACKING.md`, a guide for developers.
### Changed
- Improved tests output ([#2273]).
### Fixed
- Query logs from file not loading after the ones buffered in memory ([#2325]).
- Unnecessary errors in query logs when switching between log files ([#2324]).
- `404 Not Found` errors on the DHCP settings page on *Windows*. The page now
correctly shows that DHCP is not currently available on that OS ([#2295]).
- Infinite loop in `/dhcp/find_active_dhcp` ([#2301]).
[#2273]: https://github.com/AdguardTeam/AdGuardHome/issues/2273
[#2294]: https://github.com/AdguardTeam/AdGuardHome/issues/2294
[#2295]: https://github.com/AdguardTeam/AdGuardHome/issues/2295
[#2301]: https://github.com/AdguardTeam/AdGuardHome/issues/2301
[#2324]: https://github.com/AdguardTeam/AdGuardHome/issues/2324
[#2325]: https://github.com/AdguardTeam/AdGuardHome/issues/2325
[Unreleased]: https://github.com/AdguardTeam/AdGuardHome/compare/v0.104.3...HEAD
[v0.104.3]: https://github.com/AdguardTeam/AdGuardHome/compare/v0.104.2...v0.104.3
[v0.104.2]: https://github.com/AdguardTeam/AdGuardHome/compare/v0.104.1...v0.104.2

153
HACKING.md Normal file
View File

@@ -0,0 +1,153 @@
# AdGuardHome Developer Guidelines
As of **2020-11-12**, this document is still a work-in-progress. Some of the
rules aren't enforced, and others might change. Still, this is a good place to
find out about how we **want** our code to look like.
## Git
* Follow the commit message header format:
```none
pkg: fix the network error logging issue
```
Where `pkg` is the package where most changes took place. If there are
several such packages, just write `all`.
* Keep your commit messages to be no wider than eighty (**80**) columns.
* Only use lowercase letters in your commit message headers.
## Go
* <https://github.com/golang/go/wiki/CodeReviewComments>.
* <https://github.com/golang/go/wiki/TestComments>.
* <https://go-proverbs.github.io/>
* Avoid `init` and use explicit initialization functions instead.
* Avoid `new`, especially with structs.
* Document everything, including unexported top-level identifiers, to build
a habit of writing documentation.
* Don't put variable names into any kind of quotes.
* Don't use naked `return`s.
* Don't use underscores in file and package names, unless they're build tags
or for tests. This is to prevent accidental build errors with weird tags.
* Don't write code with more than four (**4**) levels of indentation. Just
like [Linus said], plus an additional level for an occasional error check or
struct initialization.
* Eschew external dependencies, including transitive, unless
absolutely necessary.
* No `goto`.
* No shadowing, since it can often lead to subtle bugs, especially with
errors.
* Prefer constants to variables where possible. Reduce global variables. Use
[constant errors] instead of `errors.New`.
* Put comments above the documented entity, **not** to the side, to improve
readability.
* Use `gofumpt --extra -s`.
**TODO(a.garipov):** Add to the linters.
* Use linters.
* Use named returns to improve readability of function signatures.
* When a method implements an interface, start the doc comment with the
standard template:
```go
// Foo implements the Fooer interface for *foo.
func (f *foo) Foo() {
// …
}
```
* Write logs and error messages in lowercase only to make it easier to `grep`
logs and error messages without using the `-i` flag.
* Write slices of struct like this:
```go
ts := []T{{
Field: Value0,
// …
}, {
Field: Value1,
// …
}, {
Field: Value2,
// …
}}
```
[constant errors]: https://dave.cheney.net/2016/04/07/constant-errors
[Linus said]: https://www.kernel.org/doc/html/v4.17/process/coding-style.html#indentation
## Text, Including Comments
* Text should wrap at eighty (**80**) columns to be more readable, to use
a common standard, and to allow editing or diffing side-by-side without
wrapping.
The only exception are long hyperlinks.
* Use U.S. English, as it is the most widely used variety of English in the
code right now as well as generally.
* Use double spacing between sentences to make sentence borders more clear.
* Use the serial comma (a.k.a. Oxford comma) to improve comprehension,
decrease ambiguity, and use a common standard.
* Write todos like this:
```go
// TODO(usr1): Fix the frobulation issue.
```
Or, if several people need to look at the code:
```go
// TODO(usr1, usr2): Fix the frobulation issue.
```
## Markdown
* **TODO(a.garipov):** Define our Markdown conventions.
## YAML
* **TODO(a.garipov):** Find a YAML formatter or write our own.
* All strings, including keys, must be quoted. Reason: the [NO-rway Law].
* Indent with two (**2**) spaces.
* No extra indentation in multiline arrays:
```yaml
'values':
- 'value-1'
- 'value-2'
- 'value-3'
```
* Prefer single quotes for string to prevent accidental escaping, unless
escaping is required.
[NO-rway Law]: https://news.ycombinator.com/item?id=17359376

337
client/package-lock.json generated vendored
View File

@@ -2014,72 +2014,168 @@
}
}
},
"@nivo/axes": {
"version": "0.49.1",
"resolved": "https://registry.npmjs.org/@nivo/axes/-/axes-0.49.1.tgz",
"integrity": "sha512-2ZqpKtnZ9HE30H+r565VCrypKRQzAoMbAg1hsht88dlNQRtghBSxbAS0Y4IUW/wgN/AzvOIBJHvxH7bgaB8Oow==",
"@nivo/annotations": {
"version": "0.64.0",
"resolved": "https://registry.npmjs.org/@nivo/annotations/-/annotations-0.64.0.tgz",
"integrity": "sha512-b9VAVuAn2HztOZckU2GcBwptjCobYV5VgX/jwZTSFeZFLtjZza+QinNL2AbQ2cnmeU3nVCw1dTbJMMZ9fTCCNQ==",
"requires": {
"@nivo/core": "0.49.0",
"d3-format": "^1.3.2",
"@nivo/colors": "0.64.0",
"lodash": "^4.17.11",
"react-spring": "^8.0.27"
}
},
"@nivo/axes": {
"version": "0.64.0",
"resolved": "https://registry.npmjs.org/@nivo/axes/-/axes-0.64.0.tgz",
"integrity": "sha512-Pm+Y3C67OuBb3JqHpyFKWAoPAnNojb1s5/LFQYVYN1QpKyjeqilGAoLCjHK6ckgfzreiGf7NG+oBgpH8Ncz2fQ==",
"requires": {
"@nivo/scales": "0.64.0",
"d3-format": "^1.4.4",
"d3-time": "^1.0.11",
"d3-time-format": "^2.1.3",
"lodash": "^4.17.4",
"react-motion": "^0.5.2",
"recompose": "^0.26.0"
"react-spring": "^8.0.27"
},
"dependencies": {
"d3-format": {
"version": "1.4.5",
"resolved": "https://registry.npmjs.org/d3-format/-/d3-format-1.4.5.tgz",
"integrity": "sha512-J0piedu6Z8iB6TbIGfZgDzfXxUFN3qQRMofy2oPdXzQibYGqPB/9iMcxr/TGalU+2RsyDO+U4f33id8tbnSRMQ=="
},
"d3-time": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/d3-time/-/d3-time-1.1.0.tgz",
"integrity": "sha512-Xh0isrZ5rPYYdqhAVk8VLnMEidhz5aP7htAADH6MfzgmmicPkTo8LhkLxci61/lCB7n7UmE3bN0leRt+qvkLxA=="
},
"d3-time-format": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/d3-time-format/-/d3-time-format-2.3.0.tgz",
"integrity": "sha512-guv6b2H37s2Uq/GefleCDtbe0XZAuy7Wa49VGkPVPMfLL9qObgBST3lEHJBMUp8S7NdLQAGIvr2KXk8Hc98iKQ==",
"requires": {
"d3-time": "1"
}
}
}
},
"@nivo/colors": {
"version": "0.64.0",
"resolved": "https://registry.npmjs.org/@nivo/colors/-/colors-0.64.0.tgz",
"integrity": "sha512-3CKIkSjKgwSgBsiJoTlZpFUUpaGTl60pF6rFsIiFT30os9jMxP/J4ikQGQ/vMLPTXskZYoxByaMHGKJy5wypqg==",
"requires": {
"d3-color": "^1.2.3",
"d3-scale": "^3.0.0",
"d3-scale-chromatic": "^1.3.3",
"lodash.get": "^4.4.2",
"lodash.isplainobject": "^4.0.6",
"react-motion": "^0.5.2"
}
},
"@nivo/core": {
"version": "0.49.0",
"resolved": "https://registry.npmjs.org/@nivo/core/-/core-0.49.0.tgz",
"integrity": "sha512-TCPMUO2aJ7fI+ZB6t3d3EBQtNxJnTzaxLJsrVyn/3AQIjUwccAeo2aIy81wLBGWGtlGNUDNdAbnFzXiJosH0yg==",
"version": "0.64.0",
"resolved": "https://registry.npmjs.org/@nivo/core/-/core-0.64.0.tgz",
"integrity": "sha512-tupETbvxgv4B9y3pcXy/lErMwY2aZht+FKSyah1dPFd88LnMD/DOL+to6ociBHmpLQNUMA7wid6R7BlXRY/bmg==",
"requires": {
"d3-color": "^1.0.3",
"d3-format": "^1.3.2",
"d3-color": "^1.2.3",
"d3-format": "^1.4.4",
"d3-hierarchy": "^1.1.8",
"d3-interpolate": "^1.3.2",
"d3-scale": "^2.1.2",
"d3-interpolate": "^2.0.1",
"d3-scale": "^3.0.0",
"d3-scale-chromatic": "^1.3.3",
"d3-shape": "^1.2.2",
"d3-shape": "^1.3.5",
"d3-time-format": "^2.1.3",
"lodash": "^4.17.4",
"react-measure": "^2.0.2",
"react-motion": "^0.5.2",
"recompose": "^0.26.0"
"lodash": "^4.17.11",
"react-spring": "^8.0.27",
"recompose": "^0.30.0",
"resize-observer-polyfill": "^1.5.1"
},
"dependencies": {
"d3-format": {
"version": "1.4.5",
"resolved": "https://registry.npmjs.org/d3-format/-/d3-format-1.4.5.tgz",
"integrity": "sha512-J0piedu6Z8iB6TbIGfZgDzfXxUFN3qQRMofy2oPdXzQibYGqPB/9iMcxr/TGalU+2RsyDO+U4f33id8tbnSRMQ=="
},
"d3-time": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/d3-time/-/d3-time-1.1.0.tgz",
"integrity": "sha512-Xh0isrZ5rPYYdqhAVk8VLnMEidhz5aP7htAADH6MfzgmmicPkTo8LhkLxci61/lCB7n7UmE3bN0leRt+qvkLxA=="
},
"d3-time-format": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/d3-time-format/-/d3-time-format-2.3.0.tgz",
"integrity": "sha512-guv6b2H37s2Uq/GefleCDtbe0XZAuy7Wa49VGkPVPMfLL9qObgBST3lEHJBMUp8S7NdLQAGIvr2KXk8Hc98iKQ==",
"requires": {
"d3-time": "1"
}
}
}
},
"@nivo/legends": {
"version": "0.49.0",
"resolved": "https://registry.npmjs.org/@nivo/legends/-/legends-0.49.0.tgz",
"integrity": "sha512-8KbUFYozqwD+/rj4in0mnF9b9CuyNFjVgXqm2KW3ODVlWIgYgjTVlEhlg9VZIArFPlIyyAjEYC88YSRcALHugg==",
"version": "0.64.0",
"resolved": "https://registry.npmjs.org/@nivo/legends/-/legends-0.64.0.tgz",
"integrity": "sha512-L7Mp/of/jY4qE7ef6PXJ8/e3aASBTfsf5BTOh3imSXZT6I4hXa5ppmGAgZ0gOSpcPXuMEjBc0aSIEJoeoytQ/g==",
"requires": {
"lodash": "^4.17.4",
"recompose": "^0.26.0"
"@nivo/core": "0.64.0",
"lodash": "^4.17.11",
"recompose": "^0.30.0"
}
},
"@nivo/line": {
"version": "0.49.1",
"resolved": "https://registry.npmjs.org/@nivo/line/-/line-0.49.1.tgz",
"integrity": "sha512-wKkOmpnwK2psmZbJReDq+Eh/WV9r1JA8V4Vl4eIRuf971CW0KUT9nCAoc/FcKio0qsiq5wyFt3J5LuAhfzlV/w==",
"version": "0.64.0",
"resolved": "https://registry.npmjs.org/@nivo/line/-/line-0.64.0.tgz",
"integrity": "sha512-WkQU28ZL9Mxq42AdmybWe+2qFh/TiUXu+7e6nj41e/8DO95Guxg1XQ+i5zQKuw/UZlqXZs6WOsMW8EMNE4GzXw==",
"requires": {
"@nivo/axes": "0.49.1",
"@nivo/core": "0.49.0",
"@nivo/legends": "0.49.0",
"@nivo/scales": "0.49.0",
"d3-format": "^1.3.2",
"d3-scale": "^2.1.2",
"d3-shape": "^1.2.2",
"lodash": "^4.17.4",
"react-motion": "^0.5.2",
"recompose": "^0.26.0"
"@nivo/annotations": "0.64.0",
"@nivo/axes": "0.64.0",
"@nivo/colors": "0.64.0",
"@nivo/legends": "0.64.0",
"@nivo/scales": "0.64.0",
"@nivo/tooltip": "0.64.0",
"@nivo/voronoi": "0.64.0",
"d3-shape": "^1.3.5",
"react-spring": "^8.0.27"
}
},
"@nivo/scales": {
"version": "0.49.0",
"resolved": "https://registry.npmjs.org/@nivo/scales/-/scales-0.49.0.tgz",
"integrity": "sha512-+5Leu4zX6mDSAunf4ZJHeqVlT+ZsqiKXLB6hT/u7r3GjxZP9A+n3rHePhIzikBiBRMlLjyiBlylLzhKBAYbGWQ==",
"version": "0.64.0",
"resolved": "https://registry.npmjs.org/@nivo/scales/-/scales-0.64.0.tgz",
"integrity": "sha512-Jbr1rlfe/gLCippndPaCM7doJzzx1K9oXPxS4JiyvrIUkQoMWiozymZQdEp8kgigI6uwWu5xvPwCOFXalCIhKg==",
"requires": {
"d3-scale": "^2.1.2",
"d3-scale": "^3.0.0",
"d3-time-format": "^2.1.3",
"lodash": "^4.17.4"
"lodash": "^4.17.11"
},
"dependencies": {
"d3-time": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/d3-time/-/d3-time-1.1.0.tgz",
"integrity": "sha512-Xh0isrZ5rPYYdqhAVk8VLnMEidhz5aP7htAADH6MfzgmmicPkTo8LhkLxci61/lCB7n7UmE3bN0leRt+qvkLxA=="
},
"d3-time-format": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/d3-time-format/-/d3-time-format-2.3.0.tgz",
"integrity": "sha512-guv6b2H37s2Uq/GefleCDtbe0XZAuy7Wa49VGkPVPMfLL9qObgBST3lEHJBMUp8S7NdLQAGIvr2KXk8Hc98iKQ==",
"requires": {
"d3-time": "1"
}
}
}
},
"@nivo/tooltip": {
"version": "0.64.0",
"resolved": "https://registry.npmjs.org/@nivo/tooltip/-/tooltip-0.64.0.tgz",
"integrity": "sha512-iGsuCi42uw/8F7OVvPyWdQgxJXVOPTEdtl2WK2FlSJIH7bfnEsZ+R/lTdElY2JAvGHuNW6hQwpNUZdC/2rOatg==",
"requires": {
"react-spring": "^8.0.27"
}
},
"@nivo/voronoi": {
"version": "0.64.0",
"resolved": "https://registry.npmjs.org/@nivo/voronoi/-/voronoi-0.64.0.tgz",
"integrity": "sha512-YdNRzD2rFc1NcAZe9D8gxos+IT2CRPOV/7fUfBCG9SoNw1TtSwSKtEs4xsxmUFmLT1FadWcyKeKuhgJUQnof/A==",
"requires": {
"@nivo/core": "0.64.0",
"d3-delaunay": "^5.1.1",
"d3-scale": "^3.0.0",
"recompose": "^0.30.0"
}
},
"@nodelib/fs.scandir": {
@@ -4681,24 +4777,27 @@
"dev": true
},
"d3-array": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/d3-array/-/d3-array-1.2.4.tgz",
"integrity": "sha512-KHW6M86R+FUPYGb3R5XiYjXPq7VzwxZ22buHhAEVG5ztoEcZZMLov530mmccaqA1GghZArjQV46fuc8kUqhhHw=="
},
"d3-collection": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/d3-collection/-/d3-collection-1.0.7.tgz",
"integrity": "sha512-ii0/r5f4sjKNTfh84Di+DpztYwqKhEyUlKoPrzUFfeSkWxjW49xU2QzO9qrPrNkpdI0XJkfzvmTu8V2Zylln6A=="
"version": "2.8.0",
"resolved": "https://registry.npmjs.org/d3-array/-/d3-array-2.8.0.tgz",
"integrity": "sha512-6V272gsOeg7+9pTW1jSYOR1QE37g95I3my1hBmY+vOUNHRrk9yt4OTz/gK7PMkVAVDrYYq4mq3grTiZ8iJdNIw=="
},
"d3-color": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/d3-color/-/d3-color-1.4.1.tgz",
"integrity": "sha512-p2sTHSLCJI2QKunbGb7ocOh7DgTAn8IrLx21QRc/BSnodXM4sv6aLQlnfpvehFMLZEfBc6g9pH9SWQccFYfJ9Q=="
},
"d3-delaunay": {
"version": "5.3.0",
"resolved": "https://registry.npmjs.org/d3-delaunay/-/d3-delaunay-5.3.0.tgz",
"integrity": "sha512-amALSrOllWVLaHTnDLHwMIiz0d1bBu9gZXd1FiLfXf8sHcX9jrcj81TVZOqD4UX7MgBZZ07c8GxzEgBpJqc74w==",
"requires": {
"delaunator": "4"
}
},
"d3-format": {
"version": "1.4.4",
"resolved": "https://registry.npmjs.org/d3-format/-/d3-format-1.4.4.tgz",
"integrity": "sha512-TWks25e7t8/cqctxCmxpUuzZN11QxIA7YrMbram94zMQ0PXjE4LVIMe/f6a4+xxL8HQ3OsAFULOINQi1pE62Aw=="
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/d3-format/-/d3-format-2.0.0.tgz",
"integrity": "sha512-Ab3S6XuE/Q+flY96HXT0jOXcM4EAClYFnRGY5zsjRGNy6qCYrQsMffs7cV5Q9xejb35zxW5hf/guKw34kvIKsA=="
},
"d3-hierarchy": {
"version": "1.1.9",
@@ -4706,11 +4805,11 @@
"integrity": "sha512-j8tPxlqh1srJHAtxfvOUwKNYJkQuBFdM1+JAUfq6xqH5eAqf93L7oG1NVqDa4CpFZNvnNKtCYEUC8KY9yEn9lQ=="
},
"d3-interpolate": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-1.4.0.tgz",
"integrity": "sha512-V9znK0zc3jOPV4VD2zZn0sDhZU3WAE2bmlxdIwwQPPzPjvyLkd8B3JUVdS1IDUFDkWZ72c9qnv1GK2ZagTZ8EA==",
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-2.0.1.tgz",
"integrity": "sha512-c5UhwwTs/yybcmTpAVqwSFl6vrQ8JZJoT5F7xNFK9pymv5C0Ymcc9/LIJHtYIggg/yS9YHw8i8O8tgb9pupjeQ==",
"requires": {
"d3-color": "1"
"d3-color": "1 - 2"
}
},
"d3-path": {
@@ -4719,16 +4818,15 @@
"integrity": "sha512-VLaYcn81dtHVTjEHd8B+pbe9yHWpXKZUC87PzoFmsFrJqgFwDe/qxfp5MlfsfM1V5E/iVt0MmEbWQ7FVIXh/bg=="
},
"d3-scale": {
"version": "2.2.2",
"resolved": "https://registry.npmjs.org/d3-scale/-/d3-scale-2.2.2.tgz",
"integrity": "sha512-LbeEvGgIb8UMcAa0EATLNX0lelKWGYDQiPdHj+gLblGVhGLyNbaCn3EvrJf0A3Y/uOOU5aD6MTh5ZFCdEwGiCw==",
"version": "3.2.3",
"resolved": "https://registry.npmjs.org/d3-scale/-/d3-scale-3.2.3.tgz",
"integrity": "sha512-8E37oWEmEzj57bHcnjPVOBS3n4jqakOeuv1EDdQSiSrYnMCBdMd3nc4HtKk7uia8DUHcY/CGuJ42xxgtEYrX0g==",
"requires": {
"d3-array": "^1.2.0",
"d3-collection": "1",
"d3-format": "1",
"d3-interpolate": "1",
"d3-time": "1",
"d3-time-format": "2"
"d3-array": "^2.3.0",
"d3-format": "1 - 2",
"d3-interpolate": "1.2.0 - 2",
"d3-time": "1 - 2",
"d3-time-format": "2 - 3"
}
},
"d3-scale-chromatic": {
@@ -4738,6 +4836,16 @@
"requires": {
"d3-color": "1",
"d3-interpolate": "1"
},
"dependencies": {
"d3-interpolate": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-1.4.0.tgz",
"integrity": "sha512-V9znK0zc3jOPV4VD2zZn0sDhZU3WAE2bmlxdIwwQPPzPjvyLkd8B3JUVdS1IDUFDkWZ72c9qnv1GK2ZagTZ8EA==",
"requires": {
"d3-color": "1"
}
}
}
},
"d3-shape": {
@@ -4749,16 +4857,16 @@
}
},
"d3-time": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/d3-time/-/d3-time-1.1.0.tgz",
"integrity": "sha512-Xh0isrZ5rPYYdqhAVk8VLnMEidhz5aP7htAADH6MfzgmmicPkTo8LhkLxci61/lCB7n7UmE3bN0leRt+qvkLxA=="
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/d3-time/-/d3-time-2.0.0.tgz",
"integrity": "sha512-2mvhstTFcMvwStWd9Tj3e6CEqtOivtD8AUiHT8ido/xmzrI9ijrUUihZ6nHuf/vsScRBonagOdj0Vv+SEL5G3Q=="
},
"d3-time-format": {
"version": "2.2.3",
"resolved": "https://registry.npmjs.org/d3-time-format/-/d3-time-format-2.2.3.tgz",
"integrity": "sha512-RAHNnD8+XvC4Zc4d2A56Uw0yJoM7bsvOlJR33bclxq399Rak/b9bhvu/InjxdWhPtkgU53JJcleJTGkNRnN6IA==",
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/d3-time-format/-/d3-time-format-3.0.0.tgz",
"integrity": "sha512-UXJh6EKsHBTjopVqZBhFysQcoXSv/5yLONZvkQ5Kk3qbwiUYkdX17Xa1PT6U1ZWXGGfB1ey5L8dKMlFq2DO0Ag==",
"requires": {
"d3-time": "1"
"d3-time": "1 - 2"
}
},
"damerau-levenshtein": {
@@ -4963,6 +5071,11 @@
}
}
},
"delaunator": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/delaunator/-/delaunator-4.0.1.tgz",
"integrity": "sha512-WNPWi1IRKZfCt/qIDMfERkDp93+iZEmOxN2yy4Jg+Xhv8SLk2UTqqbe1sfiipn0and9QrE914/ihdx82Y/Giag=="
},
"delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
@@ -5253,11 +5366,21 @@
"dev": true
},
"encoding": {
"version": "0.1.12",
"resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.12.tgz",
"integrity": "sha1-U4tm8+5izRq1HsMjgp0flIDHS+s=",
"version": "0.1.13",
"resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz",
"integrity": "sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==",
"requires": {
"iconv-lite": "~0.4.13"
"iconv-lite": "^0.6.2"
},
"dependencies": {
"iconv-lite": {
"version": "0.6.2",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.2.tgz",
"integrity": "sha512-2y91h5OpQlolefMPmUlivelittSWy0rP+oYVpn6A7GwVHNE8AWzoYOBNmlwks3LobaJxgHCYZAnyNo2GgpNRNQ==",
"requires": {
"safer-buffer": ">= 2.1.2 < 3.0.0"
}
}
}
},
"end-of-stream": {
@@ -6766,11 +6889,6 @@
"integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
"dev": true
},
"get-node-dimensions": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/get-node-dimensions/-/get-node-dimensions-1.2.1.tgz",
"integrity": "sha512-2MSPMu7S1iOTL+BOa6K1S62hB2zUAYNF/lV0gSVlOaacd087lc6nR1H1r0e3B1CerTo+RceOmi1iJW+vp21xcQ=="
},
"get-package-type": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz",
@@ -7430,6 +7548,7 @@
"version": "0.4.24",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
"integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
"dev": true,
"requires": {
"safer-buffer": ">= 2.1.2 < 3"
}
@@ -10194,6 +10313,16 @@
"resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.15.tgz",
"integrity": "sha512-rlrc3yU3+JNOpZ9zj5pQtxnx2THmvRykwL4Xlxoa8I9lHBlVbbyPhgyPMioxVZ4NqyxaVVtaJnzsyOidQIhyyQ=="
},
"lodash.get": {
"version": "4.4.2",
"resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz",
"integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk="
},
"lodash.isplainobject": {
"version": "4.0.6",
"resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz",
"integrity": "sha1-fFJqUtibRcRcxpC4gWO+BJf1UMs="
},
"lodash.sortby": {
"version": "4.7.0",
"resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz",
@@ -12403,17 +12532,6 @@
"resolved": "https://registry.npmjs.org/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz",
"integrity": "sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA=="
},
"react-measure": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/react-measure/-/react-measure-2.3.0.tgz",
"integrity": "sha512-dwAvmiOeblj5Dvpnk8Jm7Q8B4THF/f1l1HtKVi0XDecsG6LXwGvzV5R1H32kq3TW6RW64OAf5aoQxpIgLa4z8A==",
"requires": {
"@babel/runtime": "^7.2.0",
"get-node-dimensions": "^1.2.1",
"prop-types": "^15.6.2",
"resize-observer-polyfill": "^1.5.0"
}
},
"react-modal": {
"version": "3.11.2",
"resolved": "https://registry.npmjs.org/react-modal/-/react-modal-3.11.2.tgz",
@@ -12576,6 +12694,15 @@
}
}
},
"react-spring": {
"version": "8.0.27",
"resolved": "https://registry.npmjs.org/react-spring/-/react-spring-8.0.27.tgz",
"integrity": "sha512-nDpWBe3ZVezukNRandTeLSPcwwTMjNVu1IDq9qA/AMiUqHuRN4BeSWvKr3eIxxg1vtiYiOLy4FqdfCP5IoP77g==",
"requires": {
"@babel/runtime": "^7.3.1",
"prop-types": "^15.5.8"
}
},
"react-table": {
"version": "6.11.4",
"resolved": "https://registry.npmjs.org/react-table/-/react-table-6.11.4.tgz",
@@ -12663,13 +12790,15 @@
}
},
"recompose": {
"version": "0.26.0",
"resolved": "https://registry.npmjs.org/recompose/-/recompose-0.26.0.tgz",
"integrity": "sha512-KwOu6ztO0mN5vy3+zDcc45lgnaUoaQse/a5yLVqtzTK13czSWnFGmXbQVmnoMgDkI5POd1EwIKSbjU1V7xdZog==",
"version": "0.30.0",
"resolved": "https://registry.npmjs.org/recompose/-/recompose-0.30.0.tgz",
"integrity": "sha512-ZTrzzUDa9AqUIhRk4KmVFihH0rapdCSMFXjhHbNrjAWxBuUD/guYlyysMnuHjlZC/KRiOKRtB4jf96yYSkKE8w==",
"requires": {
"@babel/runtime": "^7.0.0",
"change-emitter": "^0.1.2",
"fbjs": "^0.8.1",
"hoist-non-react-statics": "^2.3.1",
"react-lifecycles-compat": "^3.0.2",
"symbol-observable": "^1.0.4"
}
},
@@ -15067,9 +15196,9 @@
}
},
"ua-parser-js": {
"version": "0.7.21",
"resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.21.tgz",
"integrity": "sha512-+O8/qh/Qj8CgC6eYBVBykMrNtp5Gebn4dlGD/kKXVkJNDwyrAwSIqwz8CDf+tsAIWVycKcku6gIXJ0qwx/ZXaQ=="
"version": "0.7.22",
"resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.22.tgz",
"integrity": "sha512-YUxzMjJ5T71w6a8WWVcMGM6YWOTX27rCoIQgLXiWaxqXSx9D7DNjiGWn1aJIRSQ5qr0xuhra77bSIh6voR/46Q=="
},
"unherit": {
"version": "1.1.3",
@@ -16086,9 +16215,9 @@
}
},
"whatwg-fetch": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.0.0.tgz",
"integrity": "sha512-9GSJUgz1D4MfyKU7KRqwOjXCXTqWdFNvEr7eUBYchQiVc744mqK/MzXPNR2WsPkmkOa4ywfg8C2n8h+13Bey1Q=="
"version": "3.5.0",
"resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.5.0.tgz",
"integrity": "sha512-jXkLtsR42xhXg7akoDKvKWE40eJeI+2KZqcp2h3NsOrRnDvtWX36KcKl30dy+hxECivdk2BVUHVNrPtoMBUx6A=="
},
"whatwg-mimetype": {
"version": "2.3.0",

2
client/package.json vendored
View File

@@ -13,7 +13,7 @@
"test:watch": "jest --watch"
},
"dependencies": {
"@nivo/line": "^0.49.1",
"@nivo/line": "^0.64.0",
"axios": "^0.19.2",
"classnames": "^2.2.6",
"date-fns": "^1.29.0",

View File

@@ -51,9 +51,10 @@ export const toggleClientBlockSuccess = createAction('TOGGLE_CLIENT_BLOCK_SUCCES
export const toggleClientBlock = (ip, disallowed, disallowed_rule) => async (dispatch) => {
dispatch(toggleClientBlockRequest());
try {
const {
allowed_clients, blocked_hosts, disallowed_clients = [],
} = await apiClient.getAccessList();
const accessList = await apiClient.getAccessList();
const allowed_clients = accessList.allowed_clients ?? [];
const blocked_hosts = accessList.blocked_hosts ?? [];
const disallowed_clients = accessList.disallowed_clients ?? [];
const updatedDisallowedClients = disallowed
? disallowed_clients.filter((client) => client !== disallowed_rule)

View File

@@ -373,10 +373,14 @@ export const getDhcpStatusFailure = createAction('GET_DHCP_STATUS_FAILURE');
export const getDhcpStatus = () => async (dispatch) => {
dispatch(getDhcpStatusRequest());
try {
const status = await apiClient.getDhcpStatus();
const globalStatus = await apiClient.getGlobalStatus();
status.dhcp_available = globalStatus.dhcp_available;
dispatch(getDhcpStatusSuccess(status));
if (globalStatus.dhcp_available) {
const status = await apiClient.getDhcpStatus();
status.dhcp_available = globalStatus.dhcp_available;
dispatch(getDhcpStatusSuccess(status));
} else {
dispatch(getDhcpStatusFailure());
}
} catch (error) {
dispatch(addErrorToast({ error }));
dispatch(getDhcpStatusFailure());

View File

@@ -22,11 +22,6 @@
border-bottom: 6px solid #585965;
}
.card-chart-bg {
left: -20px;
width: calc(100% + 20px);
}
@media (max-width: 1279.98px) {
.table__action {
position: absolute;

View File

@@ -12,6 +12,7 @@
--gray-4d: #4D4D4D;
--gray-f3: #F3F3F3;
--gray-8: #888;
--gray-3: #333;
--danger: #DF3812;
--white80: rgba(255, 255, 255, 0.8);

View File

@@ -72,30 +72,30 @@ const Interfaces = () => {
(store) => store.form[FORM_NAME.DHCP_INTERFACES]?.values?.interface_name,
);
if (processingInterfaces || !interfaces) {
return null;
}
const interfaceValue = interface_name && interfaces[interface_name];
return !processingInterfaces
&& interfaces
&& <>
<div className="row dhcp__interfaces">
<div className="col col__dhcp">
<Field
name="interface_name"
component={renderSelectField}
className="form-control custom-select pl-4 col-md"
validate={[validateRequiredValue]}
label='dhcp_interface_select'
>
<option value='' disabled={enabled}>
{t('dhcp_interface_select')}
</option>
{renderInterfaces(interfaces)}
</Field>
</div>
{interfaceValue
&& renderInterfaceValues(interfaceValue)}
</div>
</>;
return <div className="row dhcp__interfaces">
<div className="col col__dhcp">
<Field
name="interface_name"
component={renderSelectField}
className="form-control custom-select pl-4 col-md"
validate={[validateRequiredValue]}
label='dhcp_interface_select'
>
<option value='' disabled={enabled}>
{t('dhcp_interface_select')}
</option>
{renderInterfaces(interfaces)}
</Field>
</div>
{interfaceValue
&& renderInterfaceValues(interfaceValue)}
</div>;
};
renderInterfaceValues.propTypes = {

View File

@@ -65,9 +65,14 @@ const Dhcp = () => {
useEffect(() => {
dispatch(getDhcpStatus());
dispatch(getDhcpInterfaces());
}, []);
useEffect(() => {
if (dhcp_available) {
dispatch(getDhcpInterfaces());
}
}, [dhcp_available]);
useEffect(() => {
const [ipv4] = interfaces?.[interface_name]?.ipv4_addresses ?? [];
const [ipv6] = interfaces?.[interface_name]?.ipv6_addresses ?? [];

View File

@@ -80,7 +80,6 @@
.card-body-stats {
position: relative;
flex: 1 1 auto;
height: calc(100% - 3rem);
margin: 0;
padding: 1rem 1.5rem;
}

View File

@@ -1,9 +1,16 @@
.line__tooltip {
padding: 2px 10px 7px;
line-height: 1.1;
color: #fff;
color: var(--white);
background-color: var(--gray-3);
border-radius: 4px;
opacity: 90%;
}
.line__tooltip-text {
font-size: 0.7rem;
}
.card-chart-bg path[d^="M0,32"] {
transform: translateY(32px);
}

View File

@@ -1,56 +1,75 @@
import React from 'react';
import PropTypes from 'prop-types';
import { ResponsiveLine } from '@nivo/line';
import addDays from 'date-fns/add_days';
import addHours from 'date-fns/add_hours';
import subDays from 'date-fns/sub_days';
import subHours from 'date-fns/sub_hours';
import dateFormat from 'date-fns/format';
import round from 'lodash/round';
import { useSelector } from 'react-redux';
import PropTypes from 'prop-types';
import './Line.css';
const Line = ({ data, color }) => data
&& <ResponsiveLine
const Line = ({
data, color = 'black',
}) => {
const interval = useSelector((state) => state.stats.interval);
return <ResponsiveLine
enableArea
animate
enableSlices="x"
curve="linear"
colors={[color]}
data={data}
margin={{
top: data[0].data.every(({ y }) => y === 0) ? 62 : 15,
right: 0,
bottom: 1,
left: 20,
}}
minY="auto"
stacked={false}
curve='linear'
axisBottom={null}
axisLeft={null}
enableGridX={false}
enableGridY={false}
enableDots={false}
enableArea={true}
animate={false}
colorBy={() => (color)}
tooltip={(slice) => (
<div>
{slice.data.map((d) => (
<div key={d.serie.id} className="line__tooltip">
<span className="line__tooltip-text">
<strong>{d.data.y}</strong>
<br />
<small>{d.data.x}</small>
</span>
</div>
))}
</div>
)}
theme={{
tooltip: {
container: {
padding: '0',
background: '#333',
borderRadius: '4px',
crosshair: {
line: {
stroke: 'black',
strokeWidth: 1,
strokeOpacity: 0.35,
},
},
}}
xScale={{
type: 'linear',
min: 0,
max: 'auto',
}}
crosshairType="x"
axisLeft={false}
axisBottom={false}
enableGridX={false}
enableGridY={false}
enablePoints={false}
xFormat={(x) => {
if (interval === 1 || interval === 7) {
const hoursAgo = subHours(Date.now(), 24 * interval);
return dateFormat(addHours(hoursAgo, x), 'D MMM HH:00');
}
const daysAgo = subDays(Date.now(), interval - 1);
return dateFormat(addDays(daysAgo, x), 'D MMM YYYY');
}}
yFormat={(y) => round(y, 2)}
sliceTooltip={(slice) => {
const { xFormatted, yFormatted } = slice.slice.points[0].data;
return <div className="line__tooltip">
<span className="line__tooltip-text">
<strong>{yFormatted}</strong>
<br />
<small>{xFormatted}</small>
</span>
</div>;
}}
/>;
};
Line.propTypes = {
data: PropTypes.array.isRequired,
color: PropTypes.string.isRequired,
color: PropTypes.string,
width: PropTypes.number,
height: PropTypes.number,
};
export default Line;

View File

@@ -13452,10 +13452,8 @@ a.icon:hover {
.card-chart-bg {
height: 4rem;
margin-top: -1rem;
position: relative;
z-index: 1;
overflow: hidden;
}
.card-options {

View File

@@ -1,10 +1,6 @@
import 'url-polyfill';
import dateParse from 'date-fns/parse';
import dateFormat from 'date-fns/format';
import subHours from 'date-fns/sub_hours';
import addHours from 'date-fns/add_hours';
import addDays from 'date-fns/add_days';
import subDays from 'date-fns/sub_days';
import round from 'lodash/round';
import axios from 'axios';
import i18n from 'i18next';
@@ -105,21 +101,10 @@ export const normalizeLogs = (logs) => logs.map((log) => {
};
});
export const normalizeHistory = (history, interval) => {
if (interval === 1 || interval === 7) {
const hoursAgo = subHours(Date.now(), 24 * interval);
return history.map((item, index) => ({
x: dateFormat(addHours(hoursAgo, index), 'D MMM HH:00'),
y: round(item, 2),
}));
}
const daysAgo = subDays(Date.now(), interval - 1);
return history.map((item, index) => ({
x: dateFormat(addDays(daysAgo, index), 'D MMM YYYY'),
y: round(item, 2),
}));
};
export const normalizeHistory = (history) => history.map((item, idx) => ({
x: idx,
y: item,
}));
export const normalizeTopStats = (stats) => (
stats.map((item) => ({

View File

@@ -44,7 +44,6 @@ const getDevServerConfig = (proxyUrl = BASE_URL) => {
proxy: {
[proxyUrl]: `http://${devServerHost}:${port}`,
},
open: true,
};
};

2
go.mod
View File

@@ -4,7 +4,7 @@ go 1.14
require (
github.com/AdguardTeam/dnsproxy v0.33.2
github.com/AdguardTeam/golibs v0.4.2
github.com/AdguardTeam/golibs v0.4.3
github.com/AdguardTeam/urlfilter v0.12.3
github.com/NYTimes/gziphandler v1.1.1
github.com/beefsack/go-rate v0.0.0-20200827232406-6cde80facd47 // indirect

8
go.sum
View File

@@ -7,13 +7,13 @@ dmitri.shuralyov.com/html/belt v0.0.0-20180602232347-f7d459c86be0/go.mod h1:JLBr
dmitri.shuralyov.com/service/change v0.0.0-20181023043359-a85b471d5412/go.mod h1:a1inKt/atXimZ4Mv927x+r7UpyzRUf4emIoiiSC2TN4=
dmitri.shuralyov.com/state v0.0.0-20180228185332-28bcc343414c/go.mod h1:0PRwlb0D6DFvNNtx+9ybjezNCa8XF0xaYcETyp6rHWU=
git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg=
github.com/AdguardTeam/dnsproxy v0.33.1 h1:rEAS1fBEQ3JslzsfkcyMRV96OeBWFnKzXvksduI0ous=
github.com/AdguardTeam/dnsproxy v0.33.1/go.mod h1:kLi6lMpErnZThy5haiRSis4q0KTB8uPWO4JQsU1EDJA=
github.com/AdguardTeam/dnsproxy v0.33.2 h1:k5aMcsw3TA/G2DR8EjIkwutDPuuRkKh8xij4cFWC6Fk=
github.com/AdguardTeam/dnsproxy v0.33.2/go.mod h1:kLi6lMpErnZThy5haiRSis4q0KTB8uPWO4JQsU1EDJA=
github.com/AdguardTeam/golibs v0.4.0/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4=
github.com/AdguardTeam/golibs v0.4.2 h1:7M28oTZFoFwNmp8eGPb3ImmYbxGaJLyQXeIFVHjME0o=
github.com/AdguardTeam/golibs v0.4.2/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4=
github.com/AdguardTeam/golibs v0.4.3 h1:nXTLLLlIyU4BSRF0An5azS0uimSK/YpIMOBAO0/v1RY=
github.com/AdguardTeam/golibs v0.4.3/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4=
github.com/AdguardTeam/gomitmproxy v0.2.0/go.mod h1:Qdv0Mktnzer5zpdpi5rAwixNJzW2FN91LjKJCkVbYGU=
github.com/AdguardTeam/urlfilter v0.12.3 h1:FMjQG0eTgrr8xA3z2zaLVcCgGdpzoECPGWwgPjtwPNs=
github.com/AdguardTeam/urlfilter v0.12.3/go.mod h1:1fcCQx5TGJANrQN6sHNNM9KPBl7qx7BJml45ko6vru0=
@@ -325,8 +325,6 @@ golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/
golang.org/x/net v0.0.0-20200707034311-ab3426394381 h1:VXak5I6aEWmAXeQjA+QSZzlgNrpq9mjcfDemuexIKsU=
golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20201016165138-7b1cca2348c0/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20201031054903-ff519b6c9102 h1:42cLlJJdEh+ySyeUUbEQ5bsTiq8voBeTuweGVkY6Puw=
golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b h1:uwuIcX0g4Yl1NC5XAz37xsr2lTtcqevgzYNVt49waME=
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
@@ -370,8 +368,6 @@ golang.org/x/sys v0.0.0-20200519105757-fe76b779f299 h1:DYfZAGf2WMFjMxbgTjaC+2HC7
golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201018230417-eeed37f84f13/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201107080550-4d91cf3a1aaf h1:kt3wY1Lu5MJAnKTfoMR52Cu4gwvna4VTzNOiT8tY73s=
golang.org/x/sys v0.0.0-20201107080550-4d91cf3a1aaf/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201109165425-215b40eba54c h1:+B+zPA6081G5cEb2triOIJpcvSW4AYzmIyWAqMn2JAc=
golang.org/x/sys v0.0.0-20201109165425-215b40eba54c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=

View File

@@ -5,9 +5,14 @@ import (
"fmt"
"testing"
"github.com/AdguardTeam/AdGuardHome/internal/testutil"
"github.com/stretchr/testify/assert"
)
func TestMain(m *testing.M) {
testutil.DiscardLogOutput(m)
}
func TestError_Error(t *testing.T) {
testCases := []struct {
name string
@@ -43,7 +48,7 @@ func TestError_Unwrap(t *testing.T) {
)
errs := []error{
errSimple: errors.New("a"),
errWrapped: fmt.Errorf("%w", errors.New("nested")),
errWrapped: fmt.Errorf("err: %w", errors.New("nested")),
errNil: nil,
}
testCases := []struct {

View File

@@ -86,28 +86,36 @@ func CheckIfOtherDHCPServersPresentV4(ifaceName string) (bool, error) {
}
for {
ok, next, err := tryConn(req, c, iface)
ok, next, err := tryConn4(req, c, iface)
if next {
if err != nil {
log.Debug("dhcpv4: trying a connection: %s", err)
}
continue
}
if ok {
return true, nil
}
if err != nil {
log.Debug("%s", err)
return false, err
}
}
}
// TODO(a.garipov): Refactor further. Inspect error handling, remove the next
// parameter, address the TODO, etc.
func tryConn(req *dhcpv4.DHCPv4, c net.PacketConn, iface *net.Interface) (ok, next bool, err error) {
// TODO(a.garipov): Refactor further. Inspect error handling, remove parameter
// next, address the TODO, merge with tryConn6, etc.
func tryConn4(req *dhcpv4.DHCPv4, c net.PacketConn, iface *net.Interface) (ok, next bool, err error) {
// TODO: replicate dhclient's behavior of retrying several times with
// progressively longer timeouts.
log.Tracef("waiting %v for an answer", defaultDiscoverTime)
log.Tracef("dhcpv4: waiting %v for an answer", defaultDiscoverTime)
b := make([]byte, 1500)
_ = c.SetReadDeadline(time.Now().Add(defaultDiscoverTime))
err = c.SetDeadline(time.Now().Add(defaultDiscoverTime))
if err != nil {
return false, false, fmt.Errorf("setting deadline: %w", err)
}
n, _, err := c.ReadFrom(b)
if err != nil {
if isTimeout(err) {
@@ -119,7 +127,7 @@ func tryConn(req *dhcpv4.DHCPv4, c net.PacketConn, iface *net.Interface) (ok, ne
return false, false, fmt.Errorf("receiving packet: %w", err)
}
log.Tracef("received packet, %d bytes", n)
log.Tracef("dhcpv4: received packet, %d bytes", n)
response, err := dhcpv4.FromBytes(b[:n])
if err != nil {
@@ -141,7 +149,7 @@ func tryConn(req *dhcpv4.DHCPv4, c net.PacketConn, iface *net.Interface) (ok, ne
return false, true, nil
}
log.Tracef("the packet is from an active dhcp server")
log.Tracef("dhcpv4: the packet is from an active dhcp server")
return true, false, nil
}
@@ -200,43 +208,77 @@ func CheckIfOtherDHCPServersPresentV6(ifaceName string) (bool, error) {
}
for {
log.Debug("DHCPv6: Waiting %v for an answer", defaultDiscoverTime)
b := make([]byte, 4096)
_ = c.SetReadDeadline(time.Now().Add(defaultDiscoverTime))
n, _, err := c.ReadFrom(b)
if isTimeout(err) {
log.Debug("DHCPv6: didn't receive DHCP response")
return false, nil
}
if err != nil {
return false, fmt.Errorf("couldn't receive packet: %w", err)
}
ok, next, err := tryConn6(req, c)
if next {
if err != nil {
log.Debug("dhcpv6: trying a connection: %s", err)
}
log.Debug("DHCPv6: Received packet (%v bytes)", n)
resp, err := dhcpv6.FromBytes(b[:n])
if err != nil {
log.Debug("DHCPv6: dhcpv6.FromBytes: %s", err)
continue
}
log.Debug("DHCPv6: received message from server: %s", resp.Summary())
cid := req.Options.ClientID()
msg, err := resp.GetInnerMessage()
if err != nil {
log.Debug("DHCPv6: resp.GetInnerMessage: %s", err)
continue
}
rcid := msg.Options.ClientID()
if resp.Type() == dhcpv6.MessageTypeAdvertise &&
msg.TransactionID == req.TransactionID &&
rcid != nil &&
cid.Equal(*rcid) {
log.Debug("DHCPv6: The packet is from an active DHCP server")
if ok {
return true, nil
}
log.Debug("DHCPv6: received message from server doesn't match our request")
if err != nil {
return false, err
}
}
}
// TODO(a.garipov): See the comment on tryConn4. Sigh…
func tryConn6(req *dhcpv6.Message, c net.PacketConn) (ok, next bool, err error) {
// TODO: replicate dhclient's behavior of retrying several times with
// progressively longer timeouts.
log.Tracef("dhcpv6: waiting %v for an answer", defaultDiscoverTime)
b := make([]byte, 4096)
err = c.SetDeadline(time.Now().Add(defaultDiscoverTime))
if err != nil {
return false, false, fmt.Errorf("setting deadline: %w", err)
}
n, _, err := c.ReadFrom(b)
if err != nil {
if isTimeout(err) {
log.Debug("dhcpv6: didn't receive dhcp response")
return false, false, nil
}
return false, false, fmt.Errorf("receiving packet: %w", err)
}
log.Tracef("dhcpv6: received packet, %d bytes", n)
response, err := dhcpv6.FromBytes(b[:n])
if err != nil {
log.Debug("dhcpv6: encoding: %s", err)
return false, true, err
}
log.Debug("dhcpv6: received message from server: %s", response.Summary())
cid := req.Options.ClientID()
msg, err := response.GetInnerMessage()
if err != nil {
log.Debug("dhcpv6: resp.GetInnerMessage(): %s", err)
return false, true, err
}
rcid := msg.Options.ClientID()
if !(response.Type() == dhcpv6.MessageTypeAdvertise &&
msg.TransactionID == req.TransactionID &&
rcid != nil &&
cid.Equal(*rcid)) {
log.Debug("dhcpv6: received message from server doesn't match our request")
return false, true, nil
}
log.Tracef("dhcpv6: the packet is from an active dhcp server")
return true, false, nil
}

View File

@@ -1,3 +1,4 @@
// Package dhcpd provides a DHCP server.
package dhcpd
import (
@@ -5,6 +6,7 @@ import (
"net"
"net/http"
"path/filepath"
"runtime"
"strconv"
"strings"
"time"
@@ -13,8 +15,10 @@ import (
"github.com/AdguardTeam/golibs/log"
)
const defaultDiscoverTime = time.Second * 3
const leaseExpireStatic = 1
const (
defaultDiscoverTime = time.Second * 3
leaseExpireStatic = 1
)
var webHandlersRegistered = false
@@ -82,7 +86,8 @@ func (s *Server) CheckConfig(config ServerConfig) error {
// Create - create object
func Create(config ServerConfig) *Server {
s := Server{}
s := &Server{}
s.conf.Enabled = config.Enabled
s.conf.InterfaceName = config.InterfaceName
s.conf.HTTPRegister = config.HTTPRegister
@@ -90,8 +95,21 @@ func Create(config ServerConfig) *Server {
s.conf.DBFilePath = filepath.Join(config.WorkDir, dbFilename)
if !webHandlersRegistered && s.conf.HTTPRegister != nil {
if runtime.GOOS == "windows" {
// Our DHCP server doesn't work on Windows yet, so
// signal that to the front with an HTTP 501.
//
// TODO(a.garipov): This needs refactoring. We
// shouldn't even try and initialize a DHCP server on
// Windows, but there are currently too many
// interconnected parts--such as HTTP handlers and
// frontend--to make that work properly.
s.registerNotImplementedHandlers()
} else {
s.registerHandlers()
}
webHandlersRegistered = true
s.registerHandlers()
}
var err4, err6 error
@@ -130,7 +148,7 @@ func Create(config ServerConfig) *Server {
// we can't delay database loading until DHCP server is started,
// because we need static leases functionality available beforehand
s.dbLoad()
return &s
return s
}
// server calls this function after DB is updated

View File

@@ -9,9 +9,14 @@ import (
"testing"
"time"
"github.com/AdguardTeam/AdGuardHome/internal/testutil"
"github.com/stretchr/testify/assert"
)
func TestMain(m *testing.M) {
testutil.DiscardLogOutput(m)
}
func testNotify(flags uint32) {
}

View File

@@ -11,7 +11,6 @@ import (
"time"
"github.com/AdguardTeam/AdGuardHome/internal/util"
"github.com/AdguardTeam/golibs/jsonutil"
"github.com/AdguardTeam/golibs/log"
)
@@ -499,11 +498,48 @@ func (s *Server) handleReset(w http.ResponseWriter, r *http.Request) {
}
func (s *Server) registerHandlers() {
s.conf.HTTPRegister("GET", "/control/dhcp/status", s.handleDHCPStatus)
s.conf.HTTPRegister("GET", "/control/dhcp/interfaces", s.handleDHCPInterfaces)
s.conf.HTTPRegister("POST", "/control/dhcp/set_config", s.handleDHCPSetConfig)
s.conf.HTTPRegister("POST", "/control/dhcp/find_active_dhcp", s.handleDHCPFindActiveServer)
s.conf.HTTPRegister("POST", "/control/dhcp/add_static_lease", s.handleDHCPAddStaticLease)
s.conf.HTTPRegister("POST", "/control/dhcp/remove_static_lease", s.handleDHCPRemoveStaticLease)
s.conf.HTTPRegister("POST", "/control/dhcp/reset", s.handleReset)
s.conf.HTTPRegister(http.MethodGet, "/control/dhcp/status", s.handleDHCPStatus)
s.conf.HTTPRegister(http.MethodGet, "/control/dhcp/interfaces", s.handleDHCPInterfaces)
s.conf.HTTPRegister(http.MethodPost, "/control/dhcp/set_config", s.handleDHCPSetConfig)
s.conf.HTTPRegister(http.MethodPost, "/control/dhcp/find_active_dhcp", s.handleDHCPFindActiveServer)
s.conf.HTTPRegister(http.MethodPost, "/control/dhcp/add_static_lease", s.handleDHCPAddStaticLease)
s.conf.HTTPRegister(http.MethodPost, "/control/dhcp/remove_static_lease", s.handleDHCPRemoveStaticLease)
s.conf.HTTPRegister(http.MethodPost, "/control/dhcp/reset", s.handleReset)
}
// jsonError is a generic JSON error response.
type jsonError struct {
// Message is the error message, an opaque string.
Message string `json:"message"`
}
// notImplemented returns a handler that replies to any request with an HTTP 501
// Not Implemented status and a JSON error with the provided message msg.
//
// TODO(a.garipov): Either take the logger from the server after we've
// refactored logging or make this not a method of *Server.
func (s *Server) notImplemented(msg string) (f func(http.ResponseWriter, *http.Request)) {
return func(w http.ResponseWriter, _ *http.Request) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusNotImplemented)
err := json.NewEncoder(w).Encode(&jsonError{
Message: msg,
})
if err != nil {
log.Debug("writing 501 json response: %s", err)
}
}
}
func (s *Server) registerNotImplementedHandlers() {
h := s.notImplemented("dhcp is not supported on windows")
s.conf.HTTPRegister(http.MethodGet, "/control/dhcp/status", h)
s.conf.HTTPRegister(http.MethodGet, "/control/dhcp/interfaces", h)
s.conf.HTTPRegister(http.MethodPost, "/control/dhcp/set_config", h)
s.conf.HTTPRegister(http.MethodPost, "/control/dhcp/find_active_dhcp", h)
s.conf.HTTPRegister(http.MethodPost, "/control/dhcp/add_static_lease", h)
s.conf.HTTPRegister(http.MethodPost, "/control/dhcp/remove_static_lease", h)
s.conf.HTTPRegister(http.MethodPost, "/control/dhcp/reset", h)
}

View File

@@ -0,0 +1,22 @@
package dhcpd
import (
"net/http"
"net/http/httptest"
"testing"
"github.com/stretchr/testify/assert"
)
func TestServer_notImplemented(t *testing.T) {
s := &Server{}
h := s.notImplemented("never!")
w := httptest.NewRecorder()
r, err := http.NewRequest(http.MethodGet, "/unsupported", nil)
assert.Nil(t, err)
h(w, r)
assert.Equal(t, http.StatusNotImplemented, w.Code)
assert.Equal(t, `{"message":"never!"}`+"\n", w.Body.String())
}

View File

@@ -17,11 +17,16 @@ import (
"testing"
"time"
"github.com/AdguardTeam/AdGuardHome/internal/testutil"
"github.com/hugelgupf/socketpair"
"github.com/insomniacslk/dhcp/dhcpv4"
"github.com/insomniacslk/dhcp/dhcpv4/server4"
)
func TestMain(m *testing.M) {
testutil.DiscardLogOutput(m)
}
type handler struct {
mu sync.Mutex
received []*dhcpv4.DHCPv4

View File

@@ -17,7 +17,8 @@ import (
"github.com/AdguardTeam/golibs/log"
)
// Check if network interface has a static IP configured
// HasStaticIP check if the network interface has a static IP configured
//
// Supports: Raspbian.
func HasStaticIP(ifaceName string) (bool, error) {
if runtime.GOOS == "linux" {
@@ -36,7 +37,7 @@ func HasStaticIP(ifaceName string) (bool, error) {
return false, fmt.Errorf("cannot check if IP is static: not supported on %s", runtime.GOOS)
}
// Set a static IP for the specified network interface
// SetStaticIP sets a static IP for the network interface.
func SetStaticIP(ifaceName string) error {
if runtime.GOOS == "linux" {
return setStaticIPDhcpdConf(ifaceName)

View File

@@ -1,15 +1,23 @@
package dnsfilter
import (
"bytes"
"fmt"
"net"
"strings"
"testing"
"github.com/AdguardTeam/AdGuardHome/internal/testutil"
"github.com/AdguardTeam/golibs/log"
"github.com/AdguardTeam/urlfilter/rules"
"github.com/miekg/dns"
"github.com/stretchr/testify/assert"
)
func TestMain(m *testing.M) {
testutil.DiscardLogOutput(m)
}
var setts RequestFilteringSettings
// HELPERS
@@ -137,10 +145,17 @@ func TestEtcHostsMatching(t *testing.T) {
// SAFE BROWSING
func TestSafeBrowsing(t *testing.T) {
logOutput := &bytes.Buffer{}
testutil.ReplaceLogWriter(t, logOutput)
testutil.ReplaceLogLevel(t, log.DEBUG)
d := NewForTest(&Config{SafeBrowsingEnabled: true}, nil)
defer d.Close()
gctx.stats.Safebrowsing.Requests = 0
d.checkMatch(t, "wmconvirus.narod.ru")
assert.True(t, strings.Contains(logOutput.String(), "SafeBrowsing lookup for wmconvirus.narod.ru"))
d.checkMatch(t, "test.wmconvirus.narod.ru")
d.checkMatchEmpty(t, "yandex.ru")
d.checkMatchEmpty(t, "pornhub.com")
@@ -290,7 +305,6 @@ func TestSafeSearchCacheGoogle(t *testing.T) {
t.Fatalf("Failed to lookup for %s", safeDomain)
}
t.Logf("IP addresses: %v", ips)
ip := ips[0]
for _, i := range ips {
if i.To4() != nil {
@@ -324,9 +338,14 @@ func TestSafeSearchCacheGoogle(t *testing.T) {
// PARENTAL
func TestParentalControl(t *testing.T) {
logOutput := &bytes.Buffer{}
testutil.ReplaceLogWriter(t, logOutput)
testutil.ReplaceLogLevel(t, log.DEBUG)
d := NewForTest(&Config{ParentalEnabled: true}, nil)
defer d.Close()
d.checkMatch(t, "pornhub.com")
assert.True(t, strings.Contains(logOutput.String(), "Parental lookup for pornhub.com"))
d.checkMatch(t, "www.pornhub.com")
d.checkMatchEmpty(t, "www.yandex.ru")
d.checkMatchEmpty(t, "yandex.ru")

View File

@@ -5,7 +5,9 @@ import (
"strings"
"testing"
"github.com/AdguardTeam/AdGuardHome/internal/agherr"
"github.com/AdguardTeam/golibs/cache"
"github.com/miekg/dns"
"github.com/stretchr/testify/assert"
)
@@ -88,4 +90,47 @@ func TestSafeBrowsingCache(t *testing.T) {
hash = sha256.Sum256([]byte("nonexisting.com"))
_, ok = c.hashToHost[hash]
assert.True(t, ok)
c = &sbCtx{
svc: "SafeBrowsing",
cacheTime: 100,
}
conf = cache.Config{}
c.cache = cache.New(conf)
hash = sha256.Sum256([]byte("sub.host.com"))
c.hashToHost = make(map[[32]byte]string)
c.hashToHost[hash] = "sub.host.com"
c.cache.Set(hash[0:2], make([]byte, 32))
assert.Equal(t, 0, c.getCached())
}
// testErrUpstream implements upstream.Upstream interface for replacing real
// upstream in tests.
type testErrUpstream struct{}
// Exchange always returns nil Msg and non-nil error.
func (teu *testErrUpstream) Exchange(*dns.Msg) (*dns.Msg, error) {
return nil, agherr.Error("bad")
}
func (teu *testErrUpstream) Address() string {
return ""
}
func TestSBPC_checkErrorUpstream(t *testing.T) {
d := NewForTest(&Config{SafeBrowsingEnabled: true}, nil)
defer d.Close()
ups := &testErrUpstream{}
d.safeBrowsingUpstream = ups
d.parentalUpstream = ups
_, err := d.checkSafeBrowsing("smthng.com")
assert.NotNil(t, err)
_, err = d.checkParental("smthng.com")
assert.NotNil(t, err)
}

View File

@@ -0,0 +1,170 @@
package dnsforward
import (
"io/ioutil"
"net/http"
"net/http/httptest"
"strings"
"testing"
"github.com/stretchr/testify/assert"
)
func TestDNSForwardHTTTP_handleGetConfig(t *testing.T) {
s := createTestServer(t)
err := s.Start()
assert.Nil(t, err)
defer assert.Nil(t, s.Stop())
defaultConf := s.conf
w := httptest.NewRecorder()
testCases := []struct {
name string
conf func() ServerConfig
want string
}{{
name: "all_right",
conf: func() ServerConfig {
return defaultConf
},
want: "{\"upstream_dns\":[\"8.8.8.8:53\",\"8.8.4.4:53\"],\"upstream_dns_file\":\"\",\"bootstrap_dns\":[\"9.9.9.10\",\"149.112.112.10\",\"2620:fe::10\",\"2620:fe::fe:10\"],\"protection_enabled\":true,\"ratelimit\":0,\"blocking_mode\":\"\",\"blocking_ipv4\":\"\",\"blocking_ipv6\":\"\",\"edns_cs_enabled\":false,\"dnssec_enabled\":false,\"disable_ipv6\":false,\"upstream_mode\":\"\",\"cache_size\":0,\"cache_ttl_min\":0,\"cache_ttl_max\":0}",
}, {
name: "fastest_addr",
conf: func() ServerConfig {
conf := defaultConf
conf.FastestAddr = true
return conf
},
want: "{\"upstream_dns\":[\"8.8.8.8:53\",\"8.8.4.4:53\"],\"upstream_dns_file\":\"\",\"bootstrap_dns\":[\"9.9.9.10\",\"149.112.112.10\",\"2620:fe::10\",\"2620:fe::fe:10\"],\"protection_enabled\":true,\"ratelimit\":0,\"blocking_mode\":\"\",\"blocking_ipv4\":\"\",\"blocking_ipv6\":\"\",\"edns_cs_enabled\":false,\"dnssec_enabled\":false,\"disable_ipv6\":false,\"upstream_mode\":\"fastest_addr\",\"cache_size\":0,\"cache_ttl_min\":0,\"cache_ttl_max\":0}",
}, {
name: "parallel",
conf: func() ServerConfig {
conf := defaultConf
conf.AllServers = true
return conf
},
want: "{\"upstream_dns\":[\"8.8.8.8:53\",\"8.8.4.4:53\"],\"upstream_dns_file\":\"\",\"bootstrap_dns\":[\"9.9.9.10\",\"149.112.112.10\",\"2620:fe::10\",\"2620:fe::fe:10\"],\"protection_enabled\":true,\"ratelimit\":0,\"blocking_mode\":\"\",\"blocking_ipv4\":\"\",\"blocking_ipv6\":\"\",\"edns_cs_enabled\":false,\"dnssec_enabled\":false,\"disable_ipv6\":false,\"upstream_mode\":\"parallel\",\"cache_size\":0,\"cache_ttl_min\":0,\"cache_ttl_max\":0}",
}}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
s.conf = tc.conf()
s.handleGetConfig(w, nil)
assert.Equal(t, tc.want, w.Body.String())
assert.Equal(t, "application/json", w.Header().Get("Content-Type"))
})
w.Body.Reset()
}
}
func TestDNSForwardHTTTP_handleSetConfig(t *testing.T) {
s := createTestServer(t)
defaultConf := s.conf
err := s.Start()
assert.Nil(t, err)
defer func() {
assert.Nil(t, s.Stop())
}()
w := httptest.NewRecorder()
const defaultConfJSON = "{\"upstream_dns\":[\"8.8.8.8:53\",\"8.8.4.4:53\"],\"upstream_dns_file\":\"\",\"bootstrap_dns\":[\"9.9.9.10\",\"149.112.112.10\",\"2620:fe::10\",\"2620:fe::fe:10\"],\"protection_enabled\":true,\"ratelimit\":0,\"blocking_mode\":\"\",\"blocking_ipv4\":\"\",\"blocking_ipv6\":\"\",\"edns_cs_enabled\":false,\"dnssec_enabled\":false,\"disable_ipv6\":false,\"upstream_mode\":\"\",\"cache_size\":0,\"cache_ttl_min\":0,\"cache_ttl_max\":0}"
testCases := []struct {
name string
req string
wantSet string
wantGet string
}{{
name: "upstream_dns",
req: "{\"upstream_dns\":[\"8.8.8.8:77\",\"8.8.4.4:77\"]}",
wantSet: "",
wantGet: "{\"upstream_dns\":[\"8.8.8.8:77\",\"8.8.4.4:77\"],\"upstream_dns_file\":\"\",\"bootstrap_dns\":[\"9.9.9.10\",\"149.112.112.10\",\"2620:fe::10\",\"2620:fe::fe:10\"],\"protection_enabled\":true,\"ratelimit\":0,\"blocking_mode\":\"\",\"blocking_ipv4\":\"\",\"blocking_ipv6\":\"\",\"edns_cs_enabled\":false,\"dnssec_enabled\":false,\"disable_ipv6\":false,\"upstream_mode\":\"\",\"cache_size\":0,\"cache_ttl_min\":0,\"cache_ttl_max\":0}",
}, {
name: "bootstraps",
req: "{\"bootstrap_dns\":[\"9.9.9.10\"]}",
wantSet: "",
wantGet: "{\"upstream_dns\":[\"8.8.8.8:53\",\"8.8.4.4:53\"],\"upstream_dns_file\":\"\",\"bootstrap_dns\":[\"9.9.9.10\"],\"protection_enabled\":true,\"ratelimit\":0,\"blocking_mode\":\"\",\"blocking_ipv4\":\"\",\"blocking_ipv6\":\"\",\"edns_cs_enabled\":false,\"dnssec_enabled\":false,\"disable_ipv6\":false,\"upstream_mode\":\"\",\"cache_size\":0,\"cache_ttl_min\":0,\"cache_ttl_max\":0}",
}, {
name: "blocking_mode_good",
req: "{\"blocking_mode\":\"refused\"}",
wantSet: "",
wantGet: "{\"upstream_dns\":[\"8.8.8.8:53\",\"8.8.4.4:53\"],\"upstream_dns_file\":\"\",\"bootstrap_dns\":[\"9.9.9.10\",\"149.112.112.10\",\"2620:fe::10\",\"2620:fe::fe:10\"],\"protection_enabled\":true,\"ratelimit\":0,\"blocking_mode\":\"refused\",\"blocking_ipv4\":\"\",\"blocking_ipv6\":\"\",\"edns_cs_enabled\":false,\"dnssec_enabled\":false,\"disable_ipv6\":false,\"upstream_mode\":\"\",\"cache_size\":0,\"cache_ttl_min\":0,\"cache_ttl_max\":0}",
}, {
name: "blocking_mode_bad",
req: "{\"blocking_mode\":\"custom_ip\"}",
wantSet: "blocking_mode: incorrect value\n",
wantGet: "{\"upstream_dns\":[\"8.8.8.8:53\",\"8.8.4.4:53\"],\"upstream_dns_file\":\"\",\"bootstrap_dns\":[\"9.9.9.10\",\"149.112.112.10\",\"2620:fe::10\",\"2620:fe::fe:10\"],\"protection_enabled\":true,\"ratelimit\":0,\"blocking_mode\":\"\",\"blocking_ipv4\":\"\",\"blocking_ipv6\":\"\",\"edns_cs_enabled\":false,\"dnssec_enabled\":false,\"disable_ipv6\":false,\"upstream_mode\":\"\",\"cache_size\":0,\"cache_ttl_min\":0,\"cache_ttl_max\":0}",
}, {
name: "ratelimit",
req: "{\"ratelimit\":6}",
wantSet: "",
wantGet: "{\"upstream_dns\":[\"8.8.8.8:53\",\"8.8.4.4:53\"],\"upstream_dns_file\":\"\",\"bootstrap_dns\":[\"9.9.9.10\",\"149.112.112.10\",\"2620:fe::10\",\"2620:fe::fe:10\"],\"protection_enabled\":true,\"ratelimit\":6,\"blocking_mode\":\"\",\"blocking_ipv4\":\"\",\"blocking_ipv6\":\"\",\"edns_cs_enabled\":false,\"dnssec_enabled\":false,\"disable_ipv6\":false,\"upstream_mode\":\"\",\"cache_size\":0,\"cache_ttl_min\":0,\"cache_ttl_max\":0}",
}, {
name: "edns_cs_enabled",
req: "{\"edns_cs_enabled\":true}",
wantSet: "",
wantGet: "{\"upstream_dns\":[\"8.8.8.8:53\",\"8.8.4.4:53\"],\"upstream_dns_file\":\"\",\"bootstrap_dns\":[\"9.9.9.10\",\"149.112.112.10\",\"2620:fe::10\",\"2620:fe::fe:10\"],\"protection_enabled\":true,\"ratelimit\":0,\"blocking_mode\":\"\",\"blocking_ipv4\":\"\",\"blocking_ipv6\":\"\",\"edns_cs_enabled\":true,\"dnssec_enabled\":false,\"disable_ipv6\":false,\"upstream_mode\":\"\",\"cache_size\":0,\"cache_ttl_min\":0,\"cache_ttl_max\":0}",
}, {
name: "dnssec_enabled",
req: "{\"dnssec_enabled\":true}",
wantSet: "",
wantGet: "{\"upstream_dns\":[\"8.8.8.8:53\",\"8.8.4.4:53\"],\"upstream_dns_file\":\"\",\"bootstrap_dns\":[\"9.9.9.10\",\"149.112.112.10\",\"2620:fe::10\",\"2620:fe::fe:10\"],\"protection_enabled\":true,\"ratelimit\":0,\"blocking_mode\":\"\",\"blocking_ipv4\":\"\",\"blocking_ipv6\":\"\",\"edns_cs_enabled\":false,\"dnssec_enabled\":true,\"disable_ipv6\":false,\"upstream_mode\":\"\",\"cache_size\":0,\"cache_ttl_min\":0,\"cache_ttl_max\":0}",
}, {
name: "cache_size",
req: "{\"cache_size\":1024}",
wantSet: "",
wantGet: "{\"upstream_dns\":[\"8.8.8.8:53\",\"8.8.4.4:53\"],\"upstream_dns_file\":\"\",\"bootstrap_dns\":[\"9.9.9.10\",\"149.112.112.10\",\"2620:fe::10\",\"2620:fe::fe:10\"],\"protection_enabled\":true,\"ratelimit\":0,\"blocking_mode\":\"\",\"blocking_ipv4\":\"\",\"blocking_ipv6\":\"\",\"edns_cs_enabled\":false,\"dnssec_enabled\":false,\"disable_ipv6\":false,\"upstream_mode\":\"\",\"cache_size\":1024,\"cache_ttl_min\":0,\"cache_ttl_max\":0}",
}, {
name: "upstream_mode_parallel",
req: "{\"upstream_mode\":\"parallel\"}",
wantSet: "",
wantGet: "{\"upstream_dns\":[\"8.8.8.8:53\",\"8.8.4.4:53\"],\"upstream_dns_file\":\"\",\"bootstrap_dns\":[\"9.9.9.10\",\"149.112.112.10\",\"2620:fe::10\",\"2620:fe::fe:10\"],\"protection_enabled\":true,\"ratelimit\":0,\"blocking_mode\":\"\",\"blocking_ipv4\":\"\",\"blocking_ipv6\":\"\",\"edns_cs_enabled\":false,\"dnssec_enabled\":false,\"disable_ipv6\":false,\"upstream_mode\":\"parallel\",\"cache_size\":0,\"cache_ttl_min\":0,\"cache_ttl_max\":0}",
}, {
name: "upstream_mode_fastest_addr",
req: "{\"upstream_mode\":\"fastest_addr\"}",
wantSet: "",
wantGet: "{\"upstream_dns\":[\"8.8.8.8:53\",\"8.8.4.4:53\"],\"upstream_dns_file\":\"\",\"bootstrap_dns\":[\"9.9.9.10\",\"149.112.112.10\",\"2620:fe::10\",\"2620:fe::fe:10\"],\"protection_enabled\":true,\"ratelimit\":0,\"blocking_mode\":\"\",\"blocking_ipv4\":\"\",\"blocking_ipv6\":\"\",\"edns_cs_enabled\":false,\"dnssec_enabled\":false,\"disable_ipv6\":false,\"upstream_mode\":\"fastest_addr\",\"cache_size\":0,\"cache_ttl_min\":0,\"cache_ttl_max\":0}",
}, {
name: "upstream_dns_bad",
req: "{\"upstream_dns\":[\"\"]}",
wantSet: "wrong upstreams specification: missing port in address\n",
wantGet: defaultConfJSON,
}, {
name: "bootstraps_bad",
req: "{\"bootstrap_dns\":[\"a\"]}",
wantSet: "a can not be used as bootstrap dns cause: invalid bootstrap server address: Resolver a is not eligible to be a bootstrap DNS server\n",
wantGet: defaultConfJSON,
}, {
name: "cache_bad_ttl",
req: "{\"cache_ttl_min\":1024,\"cache_ttl_max\":512}",
wantSet: "cache_ttl_min must be less or equal than cache_ttl_max\n",
wantGet: defaultConfJSON,
}, {
name: "upstream_mode_bad",
req: "{\"upstream_mode\":\"somethingelse\"}",
wantSet: "upstream_mode: incorrect value\n",
wantGet: defaultConfJSON,
}}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
rBody := ioutil.NopCloser(strings.NewReader(tc.req))
r, err := http.NewRequest(http.MethodPost, "http://example.com", rBody)
assert.Nil(t, err)
s.handleSetConfig(w, r)
assert.Equal(t, tc.wantSet, w.Body.String())
w.Body.Reset()
s.handleGetConfig(w, nil)
assert.Equal(t, tc.wantGet, w.Body.String())
w.Body.Reset()
})
s.conf = defaultConf
}
}

View File

@@ -18,6 +18,7 @@ import (
"testing"
"time"
"github.com/AdguardTeam/AdGuardHome/internal/testutil"
"github.com/AdguardTeam/AdGuardHome/internal/util"
"github.com/AdguardTeam/AdGuardHome/internal/dhcpd"
@@ -28,6 +29,10 @@ import (
"github.com/stretchr/testify/assert"
)
func TestMain(m *testing.M) {
testutil.DiscardLogOutput(m)
}
const (
tlsServerName = "testdns.adguard.com"
testMessagesCount = 10
@@ -751,11 +756,14 @@ func createTestServer(t *testing.T) *Server {
c.CacheTime = 30
f := dnsfilter.New(&c, filters)
s := NewServer(DNSCreateParams{DNSFilter: f})
s.conf.UDPListenAddr = &net.UDPAddr{Port: 0}
s.conf.TCPListenAddr = &net.TCPAddr{Port: 0}
s.conf.UpstreamDNS = []string{"8.8.8.8:53", "8.8.4.4:53"}
s.conf.FilteringConfig.ProtectionEnabled = true
s.conf.ConfigModified = func() {}
err := s.Prepare(nil)
assert.True(t, err == nil)
return s

View File

@@ -9,9 +9,14 @@ import (
"testing"
"time"
"github.com/AdguardTeam/AdGuardHome/internal/testutil"
"github.com/stretchr/testify/assert"
)
func TestMain(m *testing.M) {
testutil.DiscardLogOutput(m)
}
func prepareTestDir() string {
const dir = "./agh-test"
_ = os.RemoveAll(dir)
@@ -85,9 +90,11 @@ type testResponseWriter struct {
func (w *testResponseWriter) Header() http.Header {
return w.hdr
}
func (w *testResponseWriter) Write([]byte) (int, error) {
return 0, nil
}
func (w *testResponseWriter) WriteHeader(statusCode int) {
w.statusCode = statusCode
}

View File

@@ -6,6 +6,7 @@ import (
"net"
"net/http"
"net/url"
"runtime"
"strconv"
"strings"
@@ -46,6 +47,7 @@ func handleStatus(w http.ResponseWriter, r *http.Request) {
if Context.dnsServer != nil {
Context.dnsServer.WriteDiskConfig(&c)
}
data := map[string]interface{}{
"dns_addresses": getDNSAddresses(),
"http_port": config.BindPort,
@@ -56,7 +58,17 @@ func handleStatus(w http.ResponseWriter, r *http.Request) {
"protection_enabled": c.ProtectionEnabled,
}
data["dhcp_available"] = (Context.dhcpServer != nil)
if runtime.GOOS == "windows" {
// Set the DHCP to false explicitly, because Context.dhcpServer
// is probably not nil, despite the fact that there is no
// support for DHCP on Windows in AdGuardHome.
//
// See also the TODO in dhcpd.Create.
data["dhcp_available"] = false
} else {
data["dhcp_available"] = (Context.dhcpServer != nil)
}
jsonVal, err := json.Marshal(data)
if err != nil {

View File

@@ -20,18 +20,16 @@ import (
"syscall"
"time"
"gopkg.in/natefinch/lumberjack.v2"
"github.com/AdguardTeam/AdGuardHome/internal/agherr"
"github.com/AdguardTeam/AdGuardHome/internal/update"
"github.com/AdguardTeam/AdGuardHome/internal/util"
"github.com/AdguardTeam/AdGuardHome/internal/dhcpd"
"github.com/AdguardTeam/AdGuardHome/internal/dnsfilter"
"github.com/AdguardTeam/AdGuardHome/internal/dnsforward"
"github.com/AdguardTeam/AdGuardHome/internal/querylog"
"github.com/AdguardTeam/AdGuardHome/internal/stats"
"github.com/AdguardTeam/AdGuardHome/internal/update"
"github.com/AdguardTeam/AdGuardHome/internal/util"
"github.com/AdguardTeam/golibs/log"
"gopkg.in/natefinch/lumberjack.v2"
)
const (
@@ -216,12 +214,12 @@ func run(args options) {
config.DHCP.WorkDir = Context.workDir
config.DHCP.HTTPRegister = httpRegister
config.DHCP.ConfigModified = onConfigModified
if runtime.GOOS != "windows" {
Context.dhcpServer = dhcpd.Create(config.DHCP)
if Context.dhcpServer == nil {
log.Fatalf("Can't initialize DHCP module")
}
Context.dhcpServer = dhcpd.Create(config.DHCP)
if Context.dhcpServer == nil {
log.Fatalf("can't initialize dhcp module")
}
Context.autoHosts.Init("")
Context.updater = update.NewUpdater(update.Config{

View File

@@ -1,5 +1,7 @@
// +build !race
// TODO(e.burkov): remove this weird buildtag.
package home
import (

View File

@@ -7,6 +7,7 @@ import (
"net"
"net/http"
"strconv"
"strings"
"sync"
"github.com/AdguardTeam/AdGuardHome/internal/util"
@@ -141,6 +142,7 @@ func (web *Web) Start() {
web.httpServer = &http.Server{
ErrorLog: web.errLogger,
Addr: address,
Handler: filterPPROF(http.DefaultServeMux),
}
err := web.httpServer.ListenAndServe()
if err != http.ErrServerClosed {
@@ -151,6 +153,22 @@ func (web *Web) Start() {
}
}
// TODO(a.garipov): We currently have to use this, because everything registers
// its HTTP handlers in http.DefaultServeMux. In the future, refactor our HTTP
// API initialization process and stop using the gosh darn http.DefaultServeMux
// for anything at all. Gosh darn global variables.
func filterPPROF(h http.Handler) (filtered http.Handler) {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if strings.HasPrefix(r.URL.Path, "/debug/pprof") {
http.NotFound(w, r)
return
}
h.ServeHTTP(w, r)
})
}
// Close - stop HTTP server, possibly waiting for all active connections to be closed
func (web *Web) Close() {
log.Info("Stopping HTTP server...")

View File

@@ -1,11 +1,54 @@
package querylog
import (
"bytes"
"strings"
"testing"
"github.com/AdguardTeam/AdGuardHome/internal/testutil"
"github.com/AdguardTeam/golibs/log"
"github.com/stretchr/testify/assert"
)
func TestDecode_decodeQueryLog(t *testing.T) {
logOutput := &bytes.Buffer{}
testutil.ReplaceLogWriter(t, logOutput)
testutil.ReplaceLogLevel(t, log.DEBUG)
testCases := []struct {
name string
log string
want string
}{{
name: "back_compatibility_all_right",
log: `{"Question":"ULgBAAABAAAAAAAAC2FkZ3VhcmR0ZWFtBmdpdGh1YgJpbwAAHAAB","Answer":"ULiBgAABAAAAAQAAC2FkZ3VhcmR0ZWFtBmdpdGh1YgJpbwAAHAABwBgABgABAAADQgBLB25zLTE2MjIJYXdzZG5zLTEwAmNvAnVrABFhd3NkbnMtaG9zdG1hc3RlcgZhbWF6b24DY29tAAAAAAEAABwgAAADhAASdQAAAVGA","Result":{},"Time":"2020-11-13T12:41:25.970861+03:00","Elapsed":244066501,"IP":"127.0.0.1","Upstream":"https://1.1.1.1:443/dns-query"}`,
want: "default",
}, {
name: "back_compatibility_bad_msg",
log: `{"Question":"","Answer":"ULiBgAABAAAAAQAAC2FkZ3VhcmR0ZWFtBmdpdGh1YgJpbwAAHAABwBgABgABAAADQgBLB25zLTE2MjIJYXdzZG5zLTEwAmNvAnVrABFhd3NkbnMtaG9zdG1hc3RlcgZhbWF6b24DY29tAAAAAAEAABwgAAADhAASdQAAAVGA","Result":{},"Time":"2020-11-13T12:41:25.970861+03:00","Elapsed":244066501,"IP":"127.0.0.1","Upstream":"https://1.1.1.1:443/dns-query"}`,
want: "decodeLogEntry err: dns: overflow unpacking uint16\n",
}, {
name: "back_compatibility_bad_decoding",
log: `{"Question":"LgBAAABAAAAAAAAC2FkZ3VhcmR0ZWFtBmdpdGh1YgJpbwAAHAAB","Answer":"ULiBgAABAAAAAQAAC2FkZ3VhcmR0ZWFtBmdpdGh1YgJpbwAAHAABwBgABgABAAADQgBLB25zLTE2MjIJYXdzZG5zLTEwAmNvAnVrABFhd3NkbnMtaG9zdG1hc3RlcgZhbWF6b24DY29tAAAAAAEAABwgAAADhAASdQAAAVGA","Result":{},"Time":"2020-11-13T12:41:25.970861+03:00","Elapsed":244066501,"IP":"127.0.0.1","Upstream":"https://1.1.1.1:443/dns-query"}`,
want: "decodeLogEntry err: illegal base64 data at input byte 48\n",
}}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
_, err := logOutput.Write([]byte("default"))
assert.Nil(t, err)
l := &logEntry{}
decodeLogEntry(l, tc.log)
assert.True(t, strings.HasSuffix(logOutput.String(), tc.want), logOutput.String())
logOutput.Reset()
})
}
}
func TestJSON(t *testing.T) {
s := `
{"keystr":"val","obj":{"keybool":true,"keyint":123456}}

View File

@@ -1,6 +1,7 @@
package querylog
import (
"fmt"
"io"
"os"
"sync"
@@ -10,12 +11,12 @@ import (
"github.com/AdguardTeam/golibs/log"
)
// ErrSeekNotFound is returned from Seek if when it fails to find the requested
// record.
const ErrSeekNotFound agherr.Error = "seek: record not found"
// ErrEndOfLog is returned from Seek when the end of the current log is reached.
const ErrEndOfLog agherr.Error = "seek: end of log"
// Timestamp not found errors.
const (
ErrTSNotFound agherr.Error = "ts not found"
ErrTSTooLate agherr.Error = "ts too late"
ErrTSTooEarly agherr.Error = "ts too early"
)
// TODO: Find a way to grow buffer instead of relying on this value when reading strings
const maxEntrySize = 16 * 1024
@@ -68,7 +69,7 @@ func NewQLogFile(path string) (*QLogFile, error) {
// * It returns the position of the the line with the timestamp we were looking for
// so that when we call "ReadNext" this line was returned.
// * Depth of the search (how many times we compared timestamps).
// * If we could not find it, it returns ErrSeekNotFound
// * If we could not find it, it returns one of the errors described above.
func (q *QLogFile) Seek(timestamp int64) (int64, int, error) {
q.lock.Lock()
defer q.lock.Unlock()
@@ -103,13 +104,17 @@ func (q *QLogFile) Seek(timestamp int64) (int64, int, error) {
return 0, depth, err
}
if lineIdx < start || lineEndIdx > end || lineIdx == lastProbeLineIdx {
if lineIdx == lastProbeLineIdx {
if lineIdx == 0 {
return 0, depth, ErrTSTooEarly
}
// If we're testing the same line twice then most likely
// the scope is too narrow and we won't find anything anymore
log.Error("querylog: didn't find timestamp:%v", timestamp)
return 0, depth, ErrSeekNotFound
} else if lineIdx == end && lineEndIdx == end {
return 0, depth, ErrEndOfLog
// the scope is too narrow and we won't find anything
// anymore in any other file.
return 0, depth, fmt.Errorf("looking up timestamp %d in %q: %w", timestamp, q.file.Name(), ErrTSNotFound)
} else if lineIdx == fileInfo.Size() {
return 0, depth, ErrTSTooLate
}
// Save the last found idx
@@ -117,9 +122,8 @@ func (q *QLogFile) Seek(timestamp int64) (int64, int, error) {
// Get the timestamp from the query log record
ts := readQLogTimestamp(line)
if ts == 0 {
return 0, depth, ErrSeekNotFound
return 0, depth, fmt.Errorf("looking up timestamp %d in %q: record %q has empty timestamp", timestamp, q.file.Name(), line)
}
if ts == timestamp {
@@ -141,8 +145,7 @@ func (q *QLogFile) Seek(timestamp int64) (int64, int, error) {
depth++
if depth >= 100 {
log.Error("Seek depth is too high, aborting. File %s, ts %v", q.file.Name(), timestamp)
return 0, depth, ErrSeekNotFound
return 0, depth, fmt.Errorf("looking up timestamp %d in %q: depth %d too high: %w", timestamp, q.file.Name(), depth, ErrTSNotFound)
}
}

View File

@@ -243,10 +243,10 @@ func prepareTestFiles(dir string, filesCount, linesCount int) []string {
lineTime, _ := time.Parse(time.RFC3339Nano, "2020-02-18T22:36:35.920973+03:00")
lineIP := uint32(0)
files := make([]string, 0)
files := make([]string, filesCount)
for j := 0; j < filesCount; j++ {
f, _ := ioutil.TempFile(dir, "*.txt")
files = append(files, f.Name())
files[filesCount-j-1] = f.Name()
for i := 0; i < linesCount; i++ {
lineIP += 1
@@ -289,7 +289,7 @@ func TestQLogSeek(t *testing.T) {
assert.Equal(t, 1, depth)
}
func TestQLogSeek_ErrEndOfLog(t *testing.T) {
func TestQLogSeek_ErrTSTooLate(t *testing.T) {
testDir := prepareTestDir()
t.Cleanup(func() {
_ = os.RemoveAll(testDir)
@@ -314,6 +314,35 @@ func TestQLogSeek_ErrEndOfLog(t *testing.T) {
assert.Nil(t, err)
_, depth, err := q.Seek(target.UnixNano() + int64(time.Second))
assert.Equal(t, ErrEndOfLog, err)
assert.Equal(t, ErrTSTooLate, err)
assert.Equal(t, 2, depth)
}
func TestQLogSeek_ErrTSTooEarly(t *testing.T) {
testDir := prepareTestDir()
t.Cleanup(func() {
_ = os.RemoveAll(testDir)
})
d := `{"T":"2020-08-31T18:44:23.911246629+03:00","QH":"wfqvjymurpwegyv","QT":"A","QC":"IN","CP":"","Answer":"","Result":{},"Elapsed":66286385,"Upstream":"tls://dns-unfiltered.adguard.com:853"}
{"T":"2020-08-31T18:44:25.376690873+03:00"}
{"T":"2020-08-31T18:44:25.382540454+03:00"}
`
f, err := ioutil.TempFile(testDir, "*.txt")
assert.Nil(t, err)
defer f.Close()
_, err = f.WriteString(d)
assert.Nil(t, err)
q, err := NewQLogFile(f.Name())
assert.Nil(t, err)
defer q.Close()
target, err := time.Parse(time.RFC3339, "2020-08-31T18:44:23.911246629+03:00")
assert.Nil(t, err)
_, depth, err := q.Seek(target.UnixNano() - int64(time.Second))
assert.Equal(t, ErrTSTooEarly, err)
assert.Equal(t, 1, depth)
}

View File

@@ -2,6 +2,7 @@ package querylog
import (
"errors"
"fmt"
"io"
"github.com/AdguardTeam/AdGuardHome/internal/agherr"
@@ -49,22 +50,32 @@ func NewQLogReader(files []string) (*QLogReader, error) {
//
// Returns nil if the record is successfully found.
// Returns an error if for some reason we could not find a record with the specified timestamp.
func (r *QLogReader) Seek(timestamp int64) error {
func (r *QLogReader) Seek(timestamp int64) (err error) {
for i := len(r.qFiles) - 1; i >= 0; i-- {
q := r.qFiles[i]
_, _, err := q.Seek(timestamp)
if err == nil || errors.Is(err, ErrEndOfLog) {
// Our search is finished, and we either found the
// element we were looking for or reached the end of the
// log. Update currentFile only, position is already
// set properly in QLogFile.
_, _, err = q.Seek(timestamp)
if err == nil {
// Search is finished, and the searched element have
// been found. Update currentFile only, position is
// already set properly in QLogFile.
r.currentFile = i
return err
return nil
} else if errors.Is(err, ErrTSTooEarly) {
// Look at the next file, since we've reached the end of
// this one.
continue
} else if errors.Is(err, ErrTSTooLate) {
// Just seek to the start then. timestamp is probably
// between the end of the previous one and the start of
// this one.
return r.SeekStart()
} else if errors.Is(err, ErrTSNotFound) {
break
}
}
return ErrSeekNotFound
return fmt.Errorf("querylog: %w", err)
}
// SeekStart changes the current position to the end of the newest file

View File

@@ -1,6 +1,7 @@
package querylog
import (
"errors"
"io"
"os"
"testing"
@@ -90,6 +91,116 @@ func TestQLogReaderMultipleFiles(t *testing.T) {
assert.Equal(t, io.EOF, err)
}
func TestQLogReader_Seek(t *testing.T) {
count := 10000
filesCount := 2
testDir := prepareTestDir()
t.Cleanup(func() {
_ = os.RemoveAll(testDir)
})
testFiles := prepareTestFiles(testDir, filesCount, count)
r, err := NewQLogReader(testFiles)
assert.Nil(t, err)
assert.NotNil(t, r)
t.Cleanup(func() {
_ = r.Close()
})
testCases := []struct {
name string
time string
want error
}{{
name: "not_too_old",
time: "2020-02-19T04:04:56.920973+03:00",
want: nil,
}, {
name: "old",
time: "2020-02-19T01:28:16.920973+03:00",
want: nil,
}, {
name: "first",
time: "2020-02-19T04:09:55.920973+03:00",
want: nil,
}, {
name: "last",
time: "2020-02-19T01:23:16.920973+03:00",
want: nil,
}, {
name: "non-existent_long_ago",
time: "2000-02-19T01:23:16.920973+03:00",
want: ErrTSTooEarly,
}, {
name: "non-existent_far_ahead",
time: "2100-02-19T01:23:16.920973+03:00",
want: nil,
}, {
name: "non-existent_but_could",
time: "2020-02-18T22:36:37.000000+03:00",
want: ErrTSNotFound,
}}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
timestamp, err := time.Parse(time.RFC3339Nano, tc.time)
assert.Nil(t, err)
err = r.Seek(timestamp.UnixNano())
assert.True(t, errors.Is(err, tc.want), err)
})
}
}
func TestQLogReader_ReadNext(t *testing.T) {
count := 10
filesCount := 1
testDir := prepareTestDir()
t.Cleanup(func() {
_ = os.RemoveAll(testDir)
})
testFiles := prepareTestFiles(testDir, filesCount, count)
r, err := NewQLogReader(testFiles)
assert.Nil(t, err)
assert.NotNil(t, r)
t.Cleanup(func() {
_ = r.Close()
})
testCases := []struct {
name string
start int
want error
}{{
name: "ok",
start: 0,
want: nil,
}, {
name: "too_big",
start: count + 1,
want: io.EOF,
}}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
err := r.SeekStart()
assert.Nil(t, err, err)
for i := 1; i < tc.start; i++ {
_, err := r.ReadNext()
assert.Nil(t, err)
}
_, err = r.ReadNext()
assert.Equal(t, tc.want, err)
})
}
}
// TODO(e.burkov): Remove the tests below. Make tests above more compelling.
func TestQLogReaderSeek(t *testing.T) {
// more or less big file
count := 10000

View File

@@ -8,10 +8,15 @@ import (
"github.com/AdguardTeam/dnsproxy/proxyutil"
"github.com/AdguardTeam/AdGuardHome/internal/dnsfilter"
"github.com/AdguardTeam/AdGuardHome/internal/testutil"
"github.com/miekg/dns"
"github.com/stretchr/testify/assert"
)
func TestMain(m *testing.M) {
testutil.DiscardLogOutput(m)
}
func prepareTestDir() string {
const dir = "./agh-test"
_ = os.RemoveAll(dir)
@@ -226,13 +231,20 @@ func addEntry(l *queryLog, host, answerStr, client string) {
}
answer.A = net.ParseIP(answerStr)
a.Answer = append(a.Answer, answer)
res := dnsfilter.Result{}
res := dnsfilter.Result{
IsFiltered: true,
Rule: "SomeRule",
Reason: dnsfilter.ReasonRewrite,
ServiceName: "SomeService",
FilterID: 1,
}
params := AddParams{
Question: &q,
Answer: &a,
Result: &res,
ClientIP: net.ParseIP(client),
Upstream: "upstream",
Question: &q,
Answer: &a,
OrigAnswer: &a,
Result: &res,
ClientIP: net.ParseIP(client),
Upstream: "upstream",
}
l.Add(params)
}

View File

@@ -1,7 +1,6 @@
package querylog
import (
"errors"
"io"
"time"
@@ -95,9 +94,6 @@ func (l *queryLog) searchFiles(params *searchParams) ([]*logEntry, time.Time, in
// The one that was specified in the "oldest" param is not needed,
// we need only the one next to it
_, err = r.ReadNext()
} else if errors.Is(err, ErrEndOfLog) {
// We've reached the end of the log.
return entries, time.Time{}, 0
}
}

View File

@@ -7,9 +7,14 @@ import (
"sync/atomic"
"testing"
"github.com/AdguardTeam/AdGuardHome/internal/testutil"
"github.com/stretchr/testify/assert"
)
func TestMain(m *testing.M) {
testutil.DiscardLogOutput(m)
}
func UIntArrayEquals(a, b []uint64) bool {
if len(a) != len(b) {
return false

View File

@@ -0,0 +1,47 @@
// Package testutil contains utilities for testing.
package testutil
import (
"io"
"io/ioutil"
"os"
"testing"
"github.com/AdguardTeam/golibs/log"
)
// DiscardLogOutput runs tests with discarded logger output.
func DiscardLogOutput(m *testing.M) {
// TODO(e.burkov): Refactor code and tests to not use the global mutable
// logger.
log.SetOutput(ioutil.Discard)
os.Exit(m.Run())
}
// ReplaceLogWriter moves logger output to w and uses Cleanup method of t to
// revert changes.
func ReplaceLogWriter(t *testing.T, w io.Writer) {
stdWriter := log.Writer()
t.Cleanup(func() {
log.SetOutput(stdWriter)
})
log.SetOutput(w)
}
// ReplaceLogLevel sets logging level to l and uses Cleanup method of t to
// revert changes.
func ReplaceLogLevel(t *testing.T, l int) {
switch l {
case log.INFO, log.DEBUG, log.ERROR:
// Go on.
default:
t.Fatalf("wrong l value (must be one of %v, %v, %v)", log.INFO, log.DEBUG, log.ERROR)
}
stdLevel := log.GetLevel()
t.Cleanup(func() {
log.SetLevel(stdLevel)
})
log.SetLevel(l)
}

View File

@@ -8,9 +8,14 @@ import (
"os"
"testing"
"github.com/AdguardTeam/AdGuardHome/internal/testutil"
"github.com/stretchr/testify/assert"
)
func TestMain(m *testing.M) {
testutil.DiscardLogOutput(m)
}
func startHTTPServer(data string) (net.Listener, uint16) {
mux := http.NewServeMux()
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {

View File

@@ -8,10 +8,15 @@ import (
"testing"
"time"
"github.com/AdguardTeam/AdGuardHome/internal/testutil"
"github.com/miekg/dns"
"github.com/stretchr/testify/assert"
)
func TestMain(m *testing.M) {
testutil.DiscardLogOutput(m)
}
func prepareTestDir() string {
const dir = "./agh-test"
_ = os.RemoveAll(dir)

View File

@@ -1,3 +1,7 @@
// Package util contains various utilities.
//
// TODO(a.garipov): Such packages are widely considered an antipattern. Remove
// this when we refactor our project structure.
package util
import (

View File

@@ -339,6 +339,12 @@ paths:
application/json:
schema:
$ref: "#/components/schemas/DhcpStatus"
"501":
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
description: Not implemented (for example, on Windows).
/dhcp/set_config:
post:
tags:
@@ -353,6 +359,12 @@ paths:
responses:
"200":
description: OK
"501":
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
description: Not implemented (for example, on Windows).
/dhcp/find_active_dhcp:
post:
tags:
@@ -366,6 +378,12 @@ paths:
application/json:
schema:
$ref: "#/components/schemas/DhcpSearchResult"
"501":
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
description: Not implemented (for example, on Windows).
/dhcp/add_static_lease:
post:
tags:
@@ -377,6 +395,12 @@ paths:
responses:
"200":
description: OK
"501":
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
description: Not implemented (for example, on Windows).
/dhcp/remove_static_lease:
post:
tags:
@@ -388,6 +412,12 @@ paths:
responses:
"200":
description: OK
"501":
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
description: Not implemented (for example, on Windows).
/dhcp/reset:
post:
tags:
@@ -397,6 +427,12 @@ paths:
responses:
"200":
description: OK
"501":
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
description: Not implemented (for example, on Windows).
/filtering/status:
get:
tags:
@@ -1976,3 +2012,10 @@ components:
password:
type: string
description: Password
Error:
description: A generic JSON error response.
properties:
message:
type: string
description: The error message, an opaque string.
type: object