Loading nixos/tests/sing-box.nix +13 −7 Original line number Diff line number Diff line Loading @@ -314,6 +314,9 @@ in services.sing-box = { enable = true; settings = { inbounds = [ tunInbound ]; outbounds = [ { type = "block"; Loading @@ -324,7 +327,6 @@ in { type = "wireguard"; tag = "outbound:wireguard"; name = "wg0"; address = [ "10.23.42.2/32" ]; mtu = 1280; private_key = wg-keys.peer1.privateKey; Loading @@ -336,12 +338,19 @@ in allowed_ips = [ "0.0.0.0/0" ]; } ]; system = true; } ]; route = { default_interface = "eth1"; final = "outbound:block"; rules = [ { inbound = [ "inbound:tun" ]; outbound = "outbound:wireguard"; } ]; }; }; }; Loading Loading @@ -527,7 +536,6 @@ in with subtest("tun"): tun.wait_for_unit("sing-box.service") tun.wait_for_unit("sys-devices-virtual-net-${tunInbound.interface_name}.device") tun.wait_until_succeeds("ip route get ${hosts."${target_host}"} | grep 'dev ${tunInbound.interface_name}'") tun.succeed("ip addr show ${tunInbound.interface_name}") tun.succeed("ip route show table ${toString tunInbound.iproute2_table_index} | grep ${tunInbound.interface_name}") Loading @@ -539,9 +547,8 @@ in with subtest("wireguard"): wireguard.wait_for_unit("sing-box.service") wireguard.wait_for_unit("sys-devices-virtual-net-wg0.device") wireguard.succeed("ip addr show wg0") test_curl(wireguard, "--interface wg0") fakeip.wait_until_succeeds("ip route get ${hosts."${target_host}"} | grep 'dev ${tunInbound.interface_name}'") test_curl(wireguard) with subtest("tproxy"): tproxy.wait_for_unit("sing-box.service") Loading @@ -549,7 +556,6 @@ in with subtest("fakeip"): fakeip.wait_for_unit("sing-box.service") fakeip.wait_for_unit("sys-devices-virtual-net-${tunInbound.interface_name}.device") fakeip.wait_until_succeeds("ip route get ${hosts."${target_host}"} | grep 'dev ${tunInbound.interface_name}'") fakeip.succeed("dig +short A ${target_host} @${target_host} | grep '^198.18.'") ''; Loading Loading
nixos/tests/sing-box.nix +13 −7 Original line number Diff line number Diff line Loading @@ -314,6 +314,9 @@ in services.sing-box = { enable = true; settings = { inbounds = [ tunInbound ]; outbounds = [ { type = "block"; Loading @@ -324,7 +327,6 @@ in { type = "wireguard"; tag = "outbound:wireguard"; name = "wg0"; address = [ "10.23.42.2/32" ]; mtu = 1280; private_key = wg-keys.peer1.privateKey; Loading @@ -336,12 +338,19 @@ in allowed_ips = [ "0.0.0.0/0" ]; } ]; system = true; } ]; route = { default_interface = "eth1"; final = "outbound:block"; rules = [ { inbound = [ "inbound:tun" ]; outbound = "outbound:wireguard"; } ]; }; }; }; Loading Loading @@ -527,7 +536,6 @@ in with subtest("tun"): tun.wait_for_unit("sing-box.service") tun.wait_for_unit("sys-devices-virtual-net-${tunInbound.interface_name}.device") tun.wait_until_succeeds("ip route get ${hosts."${target_host}"} | grep 'dev ${tunInbound.interface_name}'") tun.succeed("ip addr show ${tunInbound.interface_name}") tun.succeed("ip route show table ${toString tunInbound.iproute2_table_index} | grep ${tunInbound.interface_name}") Loading @@ -539,9 +547,8 @@ in with subtest("wireguard"): wireguard.wait_for_unit("sing-box.service") wireguard.wait_for_unit("sys-devices-virtual-net-wg0.device") wireguard.succeed("ip addr show wg0") test_curl(wireguard, "--interface wg0") fakeip.wait_until_succeeds("ip route get ${hosts."${target_host}"} | grep 'dev ${tunInbound.interface_name}'") test_curl(wireguard) with subtest("tproxy"): tproxy.wait_for_unit("sing-box.service") Loading @@ -549,7 +556,6 @@ in with subtest("fakeip"): fakeip.wait_for_unit("sing-box.service") fakeip.wait_for_unit("sys-devices-virtual-net-${tunInbound.interface_name}.device") fakeip.wait_until_succeeds("ip route get ${hosts."${target_host}"} | grep 'dev ${tunInbound.interface_name}'") fakeip.succeed("dig +short A ${target_host} @${target_host} | grep '^198.18.'") ''; Loading