Commit Graph
107 Commits
Author SHA1 Message Date
Mcat12 ebe0631e5c Add dummy POST handling for whitelist and blacklist
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2017-08-08 23:08:54 -04:00
Mcat12 4762b8a55c Reorganize to split up API functions
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2017-08-06 19:06:12 -04:00
Mcat12 345ac16558 Revert "Sanitize domains when outputting /stats/history"
This reverts commit 0a6f5a5
The sanitizing will instead be implemented off of dev in the log parsing section.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2017-07-29 12:36:38 -04:00
Mcat12 0a6f5a5ad1 Sanitize domains when outputting /stats/history
This will have to be extended to the other domain-emitting API calls in future commits.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2017-07-28 23:06:45 -04:00
Mcat12 c9de13b492 Merge remote-tracking branch 'origin/development' into new/API 2017-07-17 22:13:12 -04:00
DL6ER 845bf8354f Offer unsorted list of forward destinations (test may fails) 2017-07-08 13:59:23 +02:00
DL6ER 32c2a414c0 Don't send header multiple times 2017-07-04 20:19:28 +02:00
DL6ER ccbf0ee552 Add "GET /stats/dashboard" 2017-07-04 20:16:14 +02:00
Mcat12 7c88707fef Rename /dns/recent_blocked to /stats/recent_blocked
As this is also shown on chronometer, it seems to be related to stats more than anything else.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2017-06-30 17:30:28 -04:00
Mcat12 52d336496f Rename /history to /stats/history
It provides stats more than DNS functionality. However, it is in more of a gray area than, say, queries over time.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2017-06-30 17:28:58 -04:00
Mcat12 08391f46fc Rename /stats/overTime/graphs to graph
It's returning one graph, not multiple.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2017-06-30 14:40:26 -04:00
Mcat12 e0f462e1bf The newline?
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2017-06-26 22:22:16 -04:00
Mcat12 542e26cbe4 Merge remote-tracking branch 'origin/new/API' into new/API 2017-06-26 21:32:36 -04:00
Mcat12 cfea5cfca3 Only give relevant total in top domain JSON output
If it's `top_ads`, give `ads_blocked_today`. If it's `top_domains`, give `dns_queries_tdoay`. Both are not needed at the same time.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2017-06-26 21:32:15 -04:00
DL6ER 0dfb855605 Merge branch 'development' into new/API
Conflicts:
	request.c
2017-06-26 16:08:38 +02:00
Mcat12 5df0395824 Change key name of forwards over time JSON
Previously, both `forward_dest` and `forward_destinations` were keys in the JSON output at the root level. Which contains the over time data, and which contains the forward destination hostnames + IP addresses? Because of this ambiguity, the over time section should be renamed to `over_time`.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2017-06-25 20:00:08 -04:00
DL6ER 01dc64cea4 Refactor DB thread to run exclusively either saving queries into the DB *or* deleting old queries (i.e. every hour at minute 59 no queries will be saved to the DB, but instead, two minutes of data will be saved at the full hour) 2017-06-22 23:14:13 +02:00
DL6ER cda02291ff Add number of unique clients to statistics 2017-06-19 19:39:44 +02:00
DL6ER 6cab55125c Merge branch 'development' into new/API 2017-06-16 12:42:55 +02:00
DL6ER 1755c71a2b Restructure DELETE statement because it didn't work as expected (#81)
* Restructure DELETE statement because it didn't work as expected

* Revert changes in the Makefile
2017-06-16 12:33:44 +02:00
Mcat12 693e69befc Send API headers every time & simplify getList 2017-06-15 20:13:18 -04:00
Mcat12 a06ecba711 Make sure to send API headers even if there's no data 2017-06-15 20:09:09 -04:00
DL6ER cb9d1cd617 Add "/dns/status" 2017-06-15 11:37:10 +02:00
DL6ER c8f349d8db Stop at "&" after domain/client filtering strings 2017-06-15 11:16:19 +02:00
DL6ER 7cef472876 Imporve triming of newline character when reading in the lists.
The function strcspn() counts the number of characters until it hits a '\r' or a '\n' (in other words, it finds the first '\r' or '\n').
If it doesn't hit anything, it stops at the '\0' (returning the length of the string).
Note that this works fine even if there is no newline, because strcspn stops at a '\0'.
In that case, the entire line is simply replacing '\0' with '\0'.
2017-06-15 10:27:11 +02:00
DL6ER 0e3f8b5f06 Use getline() instead of the deprecated fgets() to avoid havng to used a fixed size buffer 2017-06-15 10:15:28 +02:00
DL6ER 1905f9cb71 Return data with key "blacklist" or "whitelist" instead of "data". Use predefined constants for the location of the white- and blacklist so they can easily be changed in one place, if needed. 2017-06-15 10:12:14 +02:00
DL6ER cce43dc36e It is no severe issue if the lists (e.g. blacklist) are not there - so we should just return an empty array. 2017-06-15 10:07:54 +02:00
Mcat12 446a1b9707 Add GET /dns/whitelist and /dns/blacklist 2017-06-14 21:31:01 -04:00
Mcat12 ecc2ef3a13 Do some formatting 2017-06-14 20:47:04 -04:00
DL6ER 5df32339a8 Send two additional counter values along with the top lists 2017-06-14 17:39:57 +02:00
DL6ER 59fe8732bb Return what is aksed for (top_domains) 2017-06-14 16:54:05 +02:00
DL6ER 30a3f7e90f Also send "dns_queries_today" in Top Domains / Ads requests 2017-06-14 16:53:14 +02:00
DL6ER 942250e936 Also send "dns_queries_today" in Top Clients request 2017-06-14 16:52:24 +02:00
DL6ER 70e3b5d9f4 Move "/overTime/*" -> "/stats/overTime/*" 2017-06-14 16:31:43 +02:00
DL6ER 9d891d5f89 Added "/overTime/query_types" 2017-06-14 16:30:06 +02:00
DL6ER 2aa2ff1af2 Added "/overTime/forward_dest", renamed "/stats/overTime" -> "/overTime/graphs" 2017-06-14 16:16:25 +02:00
DL6ER b868c568eb Add "/dns/recent_blocked" (can take argument ?limit=123) 2017-06-14 14:39:20 +02:00
DL6ER 2179f5d5ca Don't put integer values in quotes 2017-06-14 14:33:05 +02:00
DL6ER b5c500fdcf Fix all queries time filtering and SOCKET output determination 2017-06-14 14:22:44 +02:00
DL6ER 48d355bab0 Add "/history" 2017-06-14 14:09:11 +02:00
DL6ER f2f9601fb5 Greatly simplify code by not sending Content-Length (optional according to RFC 2616) 2017-06-14 13:27:47 +02:00
DL6ER 9cff88566c Two improvements: 1. Analyze only first line of HTTP request (before the whole header was analyzed), 2. Anaylze passed GET arguments properly, e.g. allow ?limit=123, but ignore ?sfqw=123 2017-06-14 13:01:27 +02:00
Mcat12 ea0a7cc127 Make memory error in getQueryTypes not fatal 2017-06-13 22:48:09 -04:00
Mcat12 249b9e981d Add alias path for forward destinations
Also make query types output more like the other responses.
2017-06-13 22:21:48 -04:00
Mcat12 0e7f484673 Add /stats/query_types 2017-06-13 21:59:34 -04:00
Mcat12 7af31af652 Add /stats/forward_dest 2017-06-13 21:37:11 -04:00
DL6ER 776bf43e9e Added /stats/top_clients 2017-06-14 00:05:17 +02:00
DL6ER 2b439cfbb0 Remove cJSON files. Note that it can be re-added cleanly into the code by reverting this commit. 2017-06-13 23:57:16 +02:00
DL6ER 4643f97fbc Add /stats/top_domains and /stats/top_ads and parameters therein 2017-06-13 23:53:54 +02:00