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

authored by

John Boehr and committed by
John Boehr
67c3f7f6 ef893323

+12 -5
+12 -5
nixos/modules/services/networking/i2pd.nix
··· 126 126 [${tun.name}] 127 127 type = client 128 128 destination = ${tun.destination} 129 + destinationport = ${toString tun.destinationPort} 129 130 keys = ${tun.keys} 130 131 address = ${tun.address} 131 132 port = ${toString tun.port} ··· 137 138 '') 138 139 } 139 140 ${flip concatMapStrings 140 - (collect (tun: tun ? port && tun ? host) cfg.inTunnels) 141 - (tun: let portStr = toString tun.port; in '' 141 + (collect (tun: tun ? port && tun ? address) cfg.inTunnels) 142 + (tun: '' 142 143 [${tun.name}] 143 144 type = server 144 145 destination = ${tun.destination} 145 146 keys = ${tun.keys} 146 147 host = ${tun.address} 147 - port = ${tun.port} 148 - inport = ${tun.inPort} 148 + port = ${toString tun.port} 149 + inport = ${toString tun.inPort} 149 150 accesslist = ${builtins.concatStringsSep "," tun.accessList} 150 151 '') 151 152 } ··· 405 406 default = {}; 406 407 type = with types; loaOf (submodule ( 407 408 { name, config, ... }: { 408 - options = commonTunOpts name; 409 + options = { 410 + destinationPort = mkOption { 411 + type = types.int; 412 + default = 0; 413 + description = "Connect to particular port at destination."; 414 + }; 415 + } // commonTunOpts name; 409 416 config = { 410 417 name = mkDefault name; 411 418 };