nixos/i2pd: tunnel config fixes

Tunnel configuration has no member named "host" - i2pd does but it's called "address" in the options. As a result, no tunnel configuration is generated.

* Fix attribute check in inTunnels
* Fix integer to string coercion in inTunnels
* Add destinationPort option for outTunnels

Changed files
+12 -5
nixos
modules
services
networking
+12 -5
nixos/modules/services/networking/i2pd.nix
···
[${tun.name}]
type = client
destination = ${tun.destination}
+
destinationport = ${toString tun.destinationPort}
keys = ${tun.keys}
address = ${tun.address}
port = ${toString tun.port}
···
'')
}
${flip concatMapStrings
-
(collect (tun: tun ? port && tun ? host) cfg.inTunnels)
-
(tun: let portStr = toString tun.port; in ''
+
(collect (tun: tun ? port && tun ? address) cfg.inTunnels)
+
(tun: ''
[${tun.name}]
type = server
destination = ${tun.destination}
keys = ${tun.keys}
host = ${tun.address}
-
port = ${tun.port}
-
inport = ${tun.inPort}
+
port = ${toString tun.port}
+
inport = ${toString tun.inPort}
accesslist = ${builtins.concatStringsSep "," tun.accessList}
'')
}
···
default = {};
type = with types; loaOf (submodule (
{ name, config, ... }: {
-
options = commonTunOpts name;
+
options = {
+
destinationPort = mkOption {
+
type = types.int;
+
default = 0;
+
description = "Connect to particular port at destination.";
+
};
+
} // commonTunOpts name;
config = {
name = mkDefault name;
};