Commit Graph

45 Commits

Author SHA1 Message Date
Simon Zolin 6563886b49 Merge: - install: recover from error on DNS server start
Close #1293

Squashed commit of the following:

commit 0981754c5c2c67f2567ee4af0d9ab24377c53413
Merge: ef81f2c8 a6d75118
Author: Simon Zolin <s.zolin@adguard.com>
Date:   Thu Jan 16 14:19:20 2020 +0300

    Merge remote-tracking branch 'origin/master' into 1293-install

commit ef81f2c886f3bfcff4e4352d7ecea6642be7d8e1
Author: Simon Zolin <s.zolin@adguard.com>
Date:   Mon Dec 30 18:32:11 2019 +0300

    linter

commit 9e205be53d9de25bd2ad63398644e14b09f95238
Author: Simon Zolin <s.zolin@adguard.com>
Date:   Mon Dec 30 17:22:17 2019 +0300

    - install: recover from error on DNS server start

    Close all modules properly
    Don't register HTTP handlers twice
2020-01-16 14:25:40 +03:00
Andrey Meshkov cdd55139fa *(dnsforward): cache upstream instances
 Closes: https://github.com/AdguardTeam/AdGuardHome/issues/1296
2019-12-23 19:31:27 +03:00
Simon Zolin 04de9d0f7b Merge: - DNS: "custom_ip" blocking mode didn't work after app restart
Close #1262

Squashed commit of the following:

commit bacd683ef5b52e275323a3c07b370ca08702403e
Author: Simon Zolin <s.zolin@adguard.com>
Date:   Mon Dec 16 17:00:49 2019 +0300

    fix

commit 3d4f9626460de3e13a621f2b8e535e9e0939e2bb
Author: Simon Zolin <s.zolin@adguard.com>
Date:   Mon Dec 16 16:54:23 2019 +0300

    fix

commit bf924bf90e9b705883bec88f8d7af11c39c1f322
Author: Simon Zolin <s.zolin@adguard.com>
Date:   Mon Dec 16 16:45:41 2019 +0300

    add test

commit 43338ea3645a025d69dd838bc732344255960bed
Author: Simon Zolin <s.zolin@adguard.com>
Date:   Mon Dec 16 16:07:51 2019 +0300

    - DNS: "custom_ip" blocking mode didn't work after app restart

commit 220f32e713a95d2c67355c61e419dd09df9d42b2
Author: Simon Zolin <s.zolin@adguard.com>
Date:   Mon Dec 16 15:46:01 2019 +0300

    - first run: fix panic on stop in case initialization didn't complete

    e.g. when Stats module can't be initialized because of incompatible file system
2019-12-16 17:04:30 +03:00
Simon Zolin 0a66913b4d Merge: * use upstream servers directly for the internal DNS resolver
Close #1212

* Server.Start(config *ServerConfig) -> Start()
+ Server.Prepare(config *ServerConfig)
+ Server.Resolve(host string)
+ Server.Exchange()
* rDNS: use internal DNS resolver
- clients: fix race in WriteDiskConfig()
- fix race: move 'clients' object from 'configuration' to 'HomeContext'
    Go race detector didn't like our 'clients' object in 'configuration'.
+ add AGH startup test
    . Create a configuration file
    . Start AGH instance
    . Check Web server
    . Check DNS server
    . Wait until the filters are downloaded
    . Stop and cleanup
* move module objects from config.* to Context.*
* don't call log.SetLevel() if not necessary
    This helps to avoid Go race detector's warning
* ci.sh: 'make' and then run tests

Squashed commit of the following:

commit 86500c7f749307f37af4cc8c2a1066f679d0cfad
Author: Simon Zolin <s.zolin@adguard.com>
Date:   Tue Dec 10 18:08:53 2019 +0300

    minor

commit 6e6abb9dca3cd250c458bec23aa30d2250a9eb40
Author: Simon Zolin <s.zolin@adguard.com>
Date:   Tue Dec 10 18:08:31 2019 +0300

    * ci.sh: 'make' and then run tests

commit 114192eefea6800e565ba9ab238202c006516c27
Author: Simon Zolin <s.zolin@adguard.com>
Date:   Tue Dec 10 17:50:04 2019 +0300

    fix

commit d426deea7f02cdfd4c7217a38c59e51251956a0f
Author: Simon Zolin <s.zolin@adguard.com>
Date:   Tue Dec 10 17:46:33 2019 +0300

    tests

commit 7b350edf03027895b4e43dee908d0155a9b0ac9b
Author: Simon Zolin <s.zolin@adguard.com>
Date:   Tue Dec 10 15:56:12 2019 +0300

    fix test

commit 2f5f116873bbbfdd4bb7f82a596f9e1f5c2bcfd8
Author: Simon Zolin <s.zolin@adguard.com>
Date:   Tue Dec 10 15:48:56 2019 +0300

    fix tests

commit 3fbdc77f9c34726e2295185279444983652d559e
Author: Simon Zolin <s.zolin@adguard.com>
Date:   Tue Dec 10 15:45:00 2019 +0300

    linter

commit 9da0b6965a2b6863bcd552fa83a4de2866600bb8
Author: Simon Zolin <s.zolin@adguard.com>
Date:   Tue Dec 10 15:33:23 2019 +0300

    * config.dnsctx.whois -> Context.whois

commit c71ebdbdf6efd88c877b2f243c69d3bc00a997d7
Author: Simon Zolin <s.zolin@adguard.com>
Date:   Tue Dec 10 15:31:08 2019 +0300

    * don't call log.SetLevel() if not necessary

    This helps to avoid Go race detector's warning

commit 0f250220133cefdcb0843a50000cb932802b8324
Author: Simon Zolin <s.zolin@adguard.com>
Date:   Tue Dec 10 15:28:19 2019 +0300

    * rdns: refactor

commit c460d8c9414940dac852e390b6c1b4d4fb38dff9
Author: Simon Zolin <s.zolin@adguard.com>
Date:   Tue Dec 10 14:08:08 2019 +0300

    Revert: * stats: serialize access to 'limit'

    Use 'conf *Config' and update it atomically, as in querylog module.
    (Note: Race detector still doesn't like it)

commit 488bcb884971276de0d5629384b29e22c59ee7e6
Author: Simon Zolin <s.zolin@adguard.com>
Date:   Tue Dec 10 13:50:23 2019 +0300

    * config.dnsFilter -> Context.dnsFilter

commit 86c0a6827a450414b50acec7ebfc5220d13b81e4
Author: Simon Zolin <s.zolin@adguard.com>
Date:   Tue Dec 10 13:45:05 2019 +0300

    * config.dnsServer -> Context.dnsServer

commit ee35ef095ccaabc89e3de0ef52c9b5ed56b36873
Author: Simon Zolin <s.zolin@adguard.com>
Date:   Tue Dec 10 13:42:10 2019 +0300

    * config.dhcpServer -> Context.dhcpServer

commit 1537001cd211099d5fad01696c0b806ae5d257b1
Author: Simon Zolin <s.zolin@adguard.com>
Date:   Tue Dec 10 13:39:45 2019 +0300

    * config.queryLog -> Context.queryLog

commit e5955fe4ff1ef6f41763461b37b502ea25a3d04c
Author: Simon Zolin <s.zolin@adguard.com>
Date:   Tue Dec 10 13:03:18 2019 +0300

    * config.httpsServer -> Context.httpsServer

commit 6153c10a9ac173e159d1f05e0db1512579b9203c
Author: Simon Zolin <s.zolin@adguard.com>
Date:   Mon Dec 9 20:12:24 2019 +0300

    * config.httpServer -> Context.httpServer

commit abd021fb94039015cd45c97614e8b78d4694f956
Author: Simon Zolin <s.zolin@adguard.com>
Date:   Mon Dec 9 20:08:05 2019 +0300

    * stats: serialize access to 'limit'

commit 38c2decfd87c712100edcabe62a6d4518719cb53
Author: Simon Zolin <s.zolin@adguard.com>
Date:   Mon Dec 9 19:57:04 2019 +0300

    * config.stats -> Context.stats

commit 6caf8965ad44db9dce9a7a5103aa8fa305ad9a06
Author: Simon Zolin <s.zolin@adguard.com>
Date:   Mon Dec 9 19:45:23 2019 +0300

    fix Restart()

... and 6 more commits
2019-12-11 12:38:58 +03:00
Simon Zolin 7313c3bc53 + use per-client DNS servers 2019-12-05 13:16:41 +03:00
Simon Zolin 7e45c2fc24 + new setting "dns.querylog_memsize"
* set 1000 entries by default (not 5000)
2019-12-02 15:46:03 +03:00
Simon Zolin 7bb32eae3d + dnsforward: refactor
+ dnsforward: own HTTP handlers
* dnsforward: no DNS reload on ProtectionEnabled setting change
* dnsforward: move QueryLog* settings out
* dnsforward: move dnsfilter settings out
* clients,i18n: no DNS reload on settings change
2019-12-02 14:58:17 +03:00
Simon Zolin c9a6e4e018 + config: "web_session_ttl" setting 2019-11-20 13:15:08 +03:00
Simon Zolin ddfd53bf06 * rdns,whois: get client info for all question types (not just A/AAAA) 2019-10-22 13:10:40 +03:00
Simon Zolin e2ff8628ad - filters: auto-update didn't work 2019-10-17 14:33:38 +03:00
Simon Zolin 6a08a9faa6 - whois/rdns: start processing top clients on startup after DNS server is started 2019-10-10 14:00:02 +03:00
Simon Zolin 8676cabc42 * whois/rdns: process up to 100 top clients on startup 2019-10-10 13:55:44 +03:00
Simon Zolin a59e346d4a * dnsfilter: major refactoring
* dnsfilter is controlled by package home, not dnsforward
* move HTTP handlers to dnsfilter/
* apply filtering settings without DNS server restart
* use only 1 goroutine for filters update
* apply new filters quickly (after they are ready to be used)
2019-10-09 20:05:21 +03:00
Simon Zolin 90db91b0fd * querylog: refactor: move HTTP handlers to querylog/ 2019-10-09 19:38:58 +03:00
Simon Zolin 37fe3c148f * whois: use whois.arin.net
+ robust redirect mechanism
* decrease timeout 30sec -> 5sec
* faster response parsing
* don't use likexian/whois-go package
2019-10-09 18:03:22 +03:00
Simon Zolin d75620fdc0 + whois, rdns: begin getting info for the most active clients on startup 2019-10-09 18:03:22 +03:00
Andrey Meshkov 33ae359cc1 *: change initDNSServer method, add getDataDir 2019-10-02 16:53:23 +03:00
Andrey Meshkov 9b23acf6da *: fix linter warnings 2019-10-02 16:40:26 +03:00
Simon Zolin bbb5413331 * stats: refactor: move HTTP handlers to stats/
DNS module passes additional parameters to Stats module.
This allows Stats to handle HTTP requests by itself - completely removing
 all stats-related code from outside.
2019-09-26 16:52:28 +03:00
Andrey Meshkov 875905ce8a Merge: Add WHOIS info for clients
* commit 'a52715e0863af0a9e1b26dbf96fc7cced02ae4f6':
  + client: add whois info to dashboard and logs
  + client: add whois info to clients and auto clients table
  * rDNS: refactor
  + whois: add WHOIS information for a client
2019-09-23 20:07:05 +03:00
Simon Zolin 75b864f25e * dnsforward: create dnsfilter asynchronously 2019-09-23 20:00:11 +03:00
Simon Zolin 192b58b9d9 * rDNS: refactor 2019-09-23 18:14:00 +03:00
Simon Zolin fd592b4dc8 + whois: add WHOIS information for a client
+ return WHOIS info in GET /clients response
2019-09-23 18:12:54 +03:00
Simon Zolin d7f256ba7f - fix crash after stats module is closed
Close DNS forward module BEFORE stats.
2019-09-19 12:47:55 +03:00
Simon Zolin 6304a7b91b + Login page and web sessions
+ /control/login
+ /control/logout
2019-09-19 12:47:55 +03:00
Simon Zolin b8a98c1a77 * stats: pass configuration object via stats.New() 2019-09-16 16:17:39 +03:00
Simon Zolin adb422fedf filtering: refactor; change API; add "filters_update_interval" setting
+ config: "filters_update_interval"
* add /control/filtering_info
* remove /control/filtering/enable
* remove /control/filtering/disable

* add /control/filtering_config
* remove /control/filtering/status

* add /control/filtering/set_url
* remove /control/filtering/enable_url
* remove /control/filtering/disable_url
2019-09-12 18:38:13 +03:00
Simon Zolin 8104c902ee * querylog: move code to a separate package
+ config: "querylog_interval" setting
/control/querylog_config, /control/querylog_info
+ POST /control/querylog_clear
2019-09-12 18:35:13 +03:00
Simon Zolin 04e2566e9e * stats: use uint32 or uint64 integer values, not int 2019-09-12 17:53:27 +03:00
Simon Zolin 97684368b9 - stats: use --workdir 2019-09-12 14:48:13 +03:00
Simon Zolin 4a58266ba3 + statistics: store in separate file
+ GET /control/stats handler
2019-09-04 10:12:02 +03:00
Simon Zolin 60eb55bdce * stats: remove old code 2019-09-04 10:12:01 +03:00
Simon Zolin 4f08f96607 * rDNS: refactor: move code to a separate file 2019-08-08 12:10:50 +03:00
Simon Zolin e81a9c7d56 + dnsfilter: use global and per-client BlockedServices array 2019-08-05 14:12:22 +03:00
Simon Zolin 6701e9ce06 * move "dnsctx" to "config" 2019-07-19 12:18:16 +03:00
Simon Zolin af21a5f17b * move "dnsServer" to "config" 2019-07-19 12:18:16 +03:00
Simon Zolin d51f43e27a * clients: move container object to "config"
Now the functions use parameter, not a global object.
2019-07-17 19:29:45 +03:00
Simon Zolin 94f3bf44d7 - filters: start DNS server after filter has been removed 2019-07-16 12:55:47 +03:00
Simon Zolin 375e410aa3 - /filtering/remove_url: windows: remove filter file only after DNS server has been stopped
Otherwise, os.Remove() will return with an error "file is being used".
2019-07-15 18:23:58 +03:00
Simon Zolin e2b518339f - don't load filter rules if filter is disabled 2019-07-15 12:49:48 +03:00
Simon Zolin 1445940473 Merge: * use urlfilter v0.4.0
Close #866

* commit '134d9275bba7de7d1550412310bc275c52bb340e':
  * use urlfilter v0.4.0
2019-07-05 12:33:30 +03:00
Simon Zolin 134d9275bb * use urlfilter v0.4.0
Now we pass filtering rules to urlfilter as filer file names,
 rather than the list of rule strings.
(Note: user rules are still passed as the list of rule strings).

As a result, we don't store the contents of filter files in memory.
2019-07-04 14:10:01 +03:00
Simon Zolin dc43ad9910 * dns: fail on starting DNS server if upstream servers configuration is incorrect 2019-07-03 17:59:19 +03:00
Simon Zolin 6a1edc45be - rDNS: don't try to resolve loopback IP addresses 2019-06-25 16:14:52 +03:00
Simon Zolin dc682763ff * move ./*.go files into ./home/ directory 2019-06-10 11:51:53 +03:00