This repository has no description
1.3 kB
51 lines
1{ config, lib, ... }:
2let
3 tcpports = [
4 4443 # jitsi
5 64738 # murmur
6 ];
7 udpports = [
8 10000 # jitsi
9 64738 # murmur
10 ];
11 target = "orange.r";
12in
13{
14 networking.firewall.allowedTCPPorts = tcpports;
15 networking.firewall.allowedUDPPorts = udpports;
16 services.nginx.streamConfig = ''
17 ${lib.concatMapStringsSep "\n" (port: ''
18 server {
19 listen [::]:${toString port};
20 listen ${toString port};
21 proxy_pass ${target}:${toString port};
22 }
23 '') tcpports}
24 '';
25
26 krebs.iptables.tables.nat.PREROUTING.rules = lib.flatten (
27 map (port: [
28 {
29 predicate = "-p udp --dport ${toString port}";
30 target = "DNAT --to-destination ${config.krebs.hosts.orange.nets.retiolum.ip4.addr}:${toString port}";
31 v6 = false;
32 }
33 {
34 predicate = "-p udp --dport ${toString port}";
35 target = "DNAT --to-destination [${config.krebs.hosts.orange.nets.retiolum.ip6.addr}]:${toString port}";
36 v4 = false;
37 }
38 ]) udpports
39 );
40
41 services.nginx.virtualHosts."jitsi.lassul.us" = {
42 enableACME = true;
43 acmeFallbackHost = "${target}";
44 addSSL = true;
45 locations."/" = {
46 recommendedProxySettings = true;
47 proxyWebsockets = true;
48 proxyPass = "https://${target}";
49 };
50 };
51}