1 import ./make-test-python.nix ({ lib, pkgs, ... }: {
2 name = "doh-proxy-rust";
3 meta.maintainers = with lib.maintainers; [ stephank ];
6 machine = { pkgs, lib, ... }: {
9 extraOptions = "empty-zones-enable no;";
10 zones = lib.singleton {
13 file = pkgs.writeText "root.zone" ''
15 . IN SOA ns.example.org. admin.example.org. ( 1 3h 1h 1w 1d )
16 . IN NS ns.example.org.
17 ns.example.org. IN A 192.168.0.1
21 services.doh-proxy-rust = {
24 "--server-address=127.0.0.1:53"
30 testScript = { nodes, ... }: ''
31 url = "http://localhost:3000/dns-query"
32 query = "AAABAAABAAAAAAAAAm5zB2V4YW1wbGUDb3JnAAABAAE=" # IN A ns.example.org.
33 bin_ip = r"$'\xC0\xA8\x00\x01'" # 192.168.0.1, as shell binary string
35 machine.wait_for_unit("bind.service")
36 machine.wait_for_unit("doh-proxy-rust.service")
37 machine.wait_for_open_port(53)
38 machine.wait_for_open_port(3000)
39 machine.succeed(f"curl --fail -H 'Accept: application/dns-message' '{url}?dns={query}' | grep -F {bin_ip}")