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