4 certs = import ./common/acme/server/snakeoil-certs.nix;
11 meta.platforms = lib.platforms.linux;
15 virtualisation.vlans = [ 1 ];
17 security.pki.certificateFiles = [ certs.ca.cert ];
22 firewall.enable = false;
25 systemd.network.networks."01-eth1" = {
27 networkConfig.Address = "10.0.0.1/24";
37 tlsCertificate = certs.${domain}.cert;
38 tlsKey = certs.${domain}.key;
44 virtualisation.vlans = [ 1 ];
46 security.pki.certificateFiles = [ certs.ca.cert ];
51 firewall.enable = false;
57 systemd.network.networks."01-eth1" = {
59 networkConfig.Address = "10.0.0.2/24";
66 connectTo = "wss://${domain}:443";
67 localToRemote = [ "tcp://8080:localhost:2080" ];
68 remoteToLocal = [ "tcp://2081:localhost:8081" ];
77 server.wait_for_unit("wstunnel-server-my-server.service")
78 client.wait_for_open_port(443, "10.0.0.1")
80 client.systemctl("start wstunnel-client-my-client.service")
81 client.wait_for_unit("wstunnel-client-my-client.service")
83 with subtest("connection from client to server"):
84 server.succeed("nc -l 2080 >/tmp/msg &")
86 client.succeed('nc -w1 localhost 8080 <<<"Hello from client"')
87 server.succeed('grep "Hello from client" /tmp/msg')
89 with subtest("connection from server to client"):
90 client.succeed("nc -l 8081 >/tmp/msg &")
92 server.succeed('nc -w1 localhost 2081 <<<"Hello from server"')
93 client.succeed('grep "Hello from server" /tmp/msg')
95 client.systemctl("stop wstunnel-client-my-client.service")