-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add socks support for tcp lookups (#85)
* add initial socks support, only socks5 and only works for tcp, doh, no tests and no dot yet * export ttl metrics for all rrs in all rrsets for #81 * add PySocks to pyproject.toml * parse socks proxy with urllib.parse.urlsplit and require scheme, support socks4+5+http proxies * fix json dump when socks_proxy is empty * improve unit tests for socks proxy code * rename socks_proxy to proxy, catch errors when starting listener, improve tests * add port busy test * fix a few comments and debug log entries * http proxies default to port 8080, proxy only works for plain tcp queries, include proxy in labels, fix unit test
- Loading branch information
Showing
10 changed files
with
124 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# type: ignore | ||
import time | ||
|
||
import pytest | ||
|
||
import dns_exporter.entrypoint | ||
|
||
mockargs = [ | ||
"-c", | ||
"dns_exporter/dns_exporter_example.yml", | ||
"-d", | ||
"-p", | ||
"25353", | ||
] | ||
|
||
|
||
def test_listen_port_busy(dns_exporter_example_config, caplog): | ||
"""Test calling main() on a port which is already busy.""" | ||
with pytest.raises(SystemExit): | ||
dns_exporter.entrypoint.main(mockargs) | ||
time.sleep(2) | ||
assert "is in use?" in caplog.text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters