From 23cd097b5ae84d8bc07db78ccb7a3675f495a5bb Mon Sep 17 00:00:00 2001 From: Evgeny Kurnevsky Date: Wed, 24 Sep 2025 17:21:29 +0200 Subject: [PATCH 1/4] nixos/i2pd: remove destination from incoming tunnels It's currently mandatory for incoming tunnels because it's defined as non-optional string. But it should be needed only for outgoing tunnels. --- nixos/modules/services/networking/i2pd.nix | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/nixos/modules/services/networking/i2pd.nix b/nixos/modules/services/networking/i2pd.nix index 15e86c4c342e..05148b469384 100644 --- a/nixos/modules/services/networking/i2pd.nix +++ b/nixos/modules/services/networking/i2pd.nix @@ -106,10 +106,6 @@ let description = "Number of ElGamal/AES tags to send."; default = 40; }; - destination = mkOption { - type = types.str; - description = "Remote endpoint, I2P hostname or b32.i2p address."; - }; keys = mkOption { type = types.str; default = name + "-keys.dat"; @@ -254,7 +250,6 @@ let (intOpt "port" tun.port) (strOpt "host" tun.address) ] - ++ (optionals (tun ? destination) (optionalNullString "destination" tun.destination)) ++ (optionals (tun ? keys) (optionalNullString "keys" tun.keys)) ++ (optionals (tun ? inPort) (optionalNullInt "inport" tun.inPort)) ++ (optionals (tun ? accessList) (optionalEmptyList "accesslist" tun.accessList)); @@ -685,6 +680,10 @@ in { name, ... }: { options = { + destination = mkOption { + type = types.str; + description = "Remote endpoint, I2P hostname or b32.i2p address."; + }; destinationPort = mkOption { type = with types; nullOr port; default = null; From 26cf7e6656dd941484c9a1553d655b612e0b0e19 Mon Sep 17 00:00:00 2001 From: Evgeny Kurnevsky Date: Wed, 24 Sep 2025 17:32:06 +0200 Subject: [PATCH 2/4] nixos/i2pd: dehardcode tunnel types Different types might have different behaviors, e.g irc tunnel replaces IP address to user's .b32 I2P address. --- nixos/modules/services/networking/i2pd.nix | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/nixos/modules/services/networking/i2pd.nix b/nixos/modules/services/networking/i2pd.nix index 05148b469384..07950676cbad 100644 --- a/nixos/modules/services/networking/i2pd.nix +++ b/nixos/modules/services/networking/i2pd.nix @@ -224,7 +224,7 @@ let let outTunOpts = [ (sec tun.name) - "type = client" + (intOpt "type" tun.type) (intOpt "port" tun.port) (strOpt "destination" tun.destination) ] @@ -246,7 +246,7 @@ let let inTunOpts = [ (sec tun.name) - "type = server" + (intOpt "type" tun.type) (intOpt "port" tun.port) (strOpt "host" tun.address) ] @@ -680,6 +680,14 @@ in { name, ... }: { options = { + type = mkOption { + type = types.enum [ + "client" + "udpclient" + ]; + default = "client"; + description = "Tunnel type."; + }; destination = mkOption { type = types.str; description = "Remote endpoint, I2P hostname or b32.i2p address."; @@ -709,6 +717,16 @@ in { name, ... }: { options = { + type = mkOption { + type = types.enum [ + "server" + "http" + "irc" + "udpserver" + ]; + default = "server"; + description = "Tunnel type."; + }; inPort = mkOption { type = types.port; default = 0; From 97eec826d5c0098dd34cc6c2c8b87d2aa702a656 Mon Sep 17 00:00:00 2001 From: Evgeny Kurnevsky Date: Wed, 24 Sep 2025 23:11:12 +0200 Subject: [PATCH 3/4] nixos/i2pd: add missing common parameters to incoming tunnels --- nixos/modules/services/networking/i2pd.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/nixos/modules/services/networking/i2pd.nix b/nixos/modules/services/networking/i2pd.nix index 07950676cbad..ac6c367e754c 100644 --- a/nixos/modules/services/networking/i2pd.nix +++ b/nixos/modules/services/networking/i2pd.nix @@ -252,7 +252,14 @@ let ] ++ (optionals (tun ? keys) (optionalNullString "keys" tun.keys)) ++ (optionals (tun ? inPort) (optionalNullInt "inport" tun.inPort)) - ++ (optionals (tun ? accessList) (optionalEmptyList "accesslist" tun.accessList)); + ++ (optionals (tun ? accessList) (optionalEmptyList "accesslist" tun.accessList)) + ++ (optionals (tun ? inbound.length) (optionalNullInt "inbound.length" tun.inbound.length)) + ++ (optionals (tun ? inbound.quantity) (optionalNullInt "inbound.quantity" tun.inbound.quantity)) + ++ (optionals (tun ? outbound.length) (optionalNullInt "outbound.length" tun.outbound.length)) + ++ (optionals (tun ? outbound.quantity) (optionalNullInt "outbound.quantity" tun.outbound.quantity)) + ++ (optionals (tun ? crypto.tagsToSend) ( + optionalNullInt "crypto.tagstosend" tun.crypto.tagsToSend + )); in lib.concatStringsSep "\n" inTunOpts; From 88c48246175570769f543761f9802a1872b0f3a1 Mon Sep 17 00:00:00 2001 From: Evgeny Kurnevsky Date: Thu, 25 Sep 2025 05:41:21 +0200 Subject: [PATCH 4/4] nixos/i2pd: correct floodfill description --- nixos/modules/services/networking/i2pd.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nixos/modules/services/networking/i2pd.nix b/nixos/modules/services/networking/i2pd.nix index ac6c367e754c..a8b04c4ebfe1 100644 --- a/nixos/modules/services/networking/i2pd.nix +++ b/nixos/modules/services/networking/i2pd.nix @@ -397,7 +397,8 @@ in floodfill = mkEnableOption "floodfill" // { description = '' - If the router is declared to be unreachable and needs introduction nodes. + Makes your router a floodfill, that means what other routers will + publish and get LeaseSets and RouterInfos on your router. ''; };