fix: forward forgejo to right port

This commit is contained in:
Patrick 2024-12-22 20:21:56 +01:00
parent 556cfab0df
commit 40696db2f6
Signed by: patrick
GPG key ID: 451F95EFB8BECD0F

View file

@ -5,12 +5,14 @@ let
net net
toUpper toUpper
mkMerge mkMerge
optionalString
; ;
forward = forward =
{ {
service, service,
ports, ports,
protocol, protocol,
fport ? null,
... ...
}: }:
{ {
@ -21,10 +23,10 @@ let
rules = [ rules = [
"iifname { vlan-fritz, lan-home } ip daddr { ${net.cidr.host 1 globals.net.vlans.services.cidrv4}, ${net.cidr.host 2 "10.99.2.0/24"} } ${protocol} dport { ${concatStringsSep ", " (map toString ports)} } dnat ip to ${ "iifname { vlan-fritz, lan-home } ip daddr { ${net.cidr.host 1 globals.net.vlans.services.cidrv4}, ${net.cidr.host 2 "10.99.2.0/24"} } ${protocol} dport { ${concatStringsSep ", " (map toString ports)} } dnat ip to ${
net.cidr.host globals.services.${service}.ip globals.net.vlans.services.cidrv4 net.cidr.host globals.services.${service}.ip globals.net.vlans.services.cidrv4
}" }${optionalString (fport != null) ":${toString fport}"}"
"iifname { vlan-fritz, lan-home } ip6 daddr ${net.cidr.host 1 globals.net.vlans.services.cidrv6} ${protocol} dport { ${concatStringsSep ", " (map toString ports)} } dnat ip6 to ${ "iifname { vlan-fritz, lan-home } ip6 daddr ${net.cidr.host 1 globals.net.vlans.services.cidrv6} ${protocol} dport { ${concatStringsSep ", " (map toString ports)} } dnat ip6 to ${
net.cidr.host globals.services.${service}.ip globals.net.vlans.services.cidrv6 net.cidr.host globals.services.${service}.ip globals.net.vlans.services.cidrv6
}" }${optionalString (fport != null) ":${toString fport}"}"
]; ];
}; };
}; };
@ -63,6 +65,7 @@ mkMerge [
9922 9922
]; ];
protocol = "tcp"; protocol = "tcp";
fport = 22;
}) })
(forward { (forward {
service = "murmur"; service = "murmur";