@@ -28,15 +28,15 @@ let
30 mkKeyedEndpointOpt = name: addr: port: keyFile:
30 mkKeyedEndpointOpt = name: addr: port: keyFile:
31− (mkEndpointOpt name addr port) // {
31+ (mkEndpointOpt name addr port) // {
32− keys = mkOption {
32+ keys = mkOption {
33− type = types.str;
33+ type = types.str;
34− default = "";
34+ default = "";
35− description = ''
35+ description = ''
36− File to persist ${lib.toUpper name} keys.
36+ File to persist ${lib.toUpper name} keys.
41 commonTunOpts = let
41 commonTunOpts = let
42 i2cpOpts = {
42 i2cpOpts = {
@@ -59,7 +59,7 @@ let
59 description = "Number of ElGamal/AES tags to send.";
59 description = "Number of ElGamal/AES tags to send.";
60 default = 40;
60 default = 40;
62− destination = mkOption {
62+ destination = mkOption {
63 type = types.str;
63 type = types.str;
64 description = "Remote endpoint, I2P hostname or b32.i2p address.";
64 description = "Remote endpoint, I2P hostname or b32.i2p address.";
@@ -70,88 +70,91 @@ let
71 } // mkEndpointOpt name "127.0.0.1" 0;
71 } // mkEndpointOpt name "127.0.0.1" 0;
73− i2pdConf = pkgs.writeText "i2pd.conf"
73+ i2pdConf = pkgs.writeText "i2pd.conf" ''
74− ''
74+ # DO NOT EDIT -- this file has been generated automatically.
75+ loglevel = ${cfg.logLevel}
75− ipv4 = ${boolToString cfg.enableIPv4}
77+ ipv4 = ${boolToString cfg.enableIPv4}
76− ipv6 = ${boolToString cfg.enableIPv6}
78+ ipv6 = ${boolToString cfg.enableIPv6}
77− notransit = ${boolToString cfg.notransit}
79+ notransit = ${boolToString cfg.notransit}
78− floodfill = ${boolToString cfg.floodfill}
80+ floodfill = ${boolToString cfg.floodfill}
79− netid = ${toString cfg.netid}
81+ netid = ${toString cfg.netid}
80− ${if isNull cfg.bandwidth then "" else "bandwidth = ${toString cfg.bandwidth}" }
82+ ${if isNull cfg.bandwidth then "" else "bandwidth = ${toString cfg.bandwidth}" }
81− ${if isNull cfg.port then "" else "port = ${toString cfg.port}"}
83+ ${if isNull cfg.port then "" else "port = ${toString cfg.port}"}
84− transittunnels = ${toString cfg.limits.transittunnels}
86+ transittunnels = ${toString cfg.limits.transittunnels}
87− enabled = ${boolToString cfg.upnp.enable}
89+ enabled = ${boolToString cfg.upnp.enable}
88− name = ${cfg.upnp.name}
90+ name = ${cfg.upnp.name}
90− [precomputation]
92+ [precomputation]
91− elgamal = ${boolToString cfg.precomputation.elgamal}
93+ elgamal = ${boolToString cfg.precomputation.elgamal}
94− verify = ${boolToString cfg.reseed.verify}
96+ verify = ${boolToString cfg.reseed.verify}
95− file = ${cfg.reseed.file}
97+ file = ${cfg.reseed.file}
96− urls = ${builtins.concatStringsSep "," cfg.reseed.urls}
98+ urls = ${builtins.concatStringsSep "," cfg.reseed.urls}
98− [addressbook]
100+ [addressbook]
99− defaulturl = ${cfg.addressbook.defaulturl}
101+ defaulturl = ${cfg.addressbook.defaulturl}
100− subscriptions = ${builtins.concatStringsSep "," cfg.addressbook.subscriptions}
102+ subscriptions = ${builtins.concatStringsSep "," cfg.addressbook.subscriptions}
101− ${flip concatMapStrings
104+ ${flip concatMapStrings
102 (collect (proto: proto ? port && proto ? address && proto ? name) cfg.proto)
105 (collect (proto: proto ? port && proto ? address && proto ? name) cfg.proto)
103− (proto: let portStr = toString proto.port; in
106+ (proto: let portStr = toString proto.port; in ''
105− [${proto.name}]
107+ [${proto.name}]
106− enabled = ${boolToString proto.enable}
108+ enabled = ${boolToString proto.enable}
107− address = ${proto.address}
109+ address = ${proto.address}
108− port = ${toString proto.port}
110+ port = ${toString proto.port}
109− ${if proto ? keys then "keys = ${proto.keys}" else ""}
111+ ${if proto ? keys then "keys = ${proto.keys}" else ""}
110− ${if proto ? auth then "auth = ${boolToString proto.auth}" else ""}
112+ ${if proto ? auth then "auth = ${boolToString proto.auth}" else ""}
111− ${if proto ? user then "user = ${proto.user}" else ""}
113+ ${if proto ? user then "user = ${proto.user}" else ""}
112− ${if proto ? pass then "pass = ${proto.pass}" else ""}
114+ ${if proto ? pass then "pass = ${proto.pass}" else ""}
113− ${if proto ? outproxy then "outproxy = ${proto.outproxy}" else ""}
115+ ${if proto ? outproxy then "outproxy = ${proto.outproxy}" else ""}
114− ${if proto ? outproxyPort then "outproxyport = ${toString proto.outproxyPort}" else ""}
116+ ${if proto ? outproxyPort then "outproxyport = ${toString proto.outproxyPort}" else ""}
119 i2pdTunnelConf = pkgs.writeText "i2pd-tunnels.conf" ''
121 i2pdTunnelConf = pkgs.writeText "i2pd-tunnels.conf" ''
122+ # DO NOT EDIT -- this file has been generated automatically.
120− ${flip concatMapStrings
123+ ${flip concatMapStrings
121− (collect (tun: tun ? port && tun ? destination) cfg.outTunnels)
124+ (collect (tun: tun ? port && tun ? destination) cfg.outTunnels)
122− (tun: let portStr = toString tun.port; in ''
125+ (tun: let portStr = toString tun.port; in ''
123− [${tun.name}]
126+ [${tun.name}]
124− type = client
127+ type = client
125− destination = ${tun.destination}
128+ destination = ${tun.destination}
126− keys = ${tun.keys}
129+ keys = ${tun.keys}
127− address = ${tun.address}
130+ address = ${tun.address}
128− port = ${toString tun.port}
131+ port = ${toString tun.port}
129− inbound.length = ${toString tun.inbound.length}
132+ inbound.length = ${toString tun.inbound.length}
130− outbound.length = ${toString tun.outbound.length}
133+ outbound.length = ${toString tun.outbound.length}
131− inbound.quantity = ${toString tun.inbound.quantity}
134+ inbound.quantity = ${toString tun.inbound.quantity}
132− outbound.quantity = ${toString tun.outbound.quantity}
135+ outbound.quantity = ${toString tun.outbound.quantity}
133− crypto.tagsToSend = ${toString tun.crypto.tagsToSend}
136+ crypto.tagsToSend = ${toString tun.crypto.tagsToSend}
136− ${flip concatMapStrings
139+ ${flip concatMapStrings
137− (collect (tun: tun ? port && tun ? host) cfg.inTunnels)
140+ (collect (tun: tun ? port && tun ? host) cfg.inTunnels)
138− (tun: let portStr = toString tun.port; in ''
141+ (tun: let portStr = toString tun.port; in ''
139− [${tun.name}]
142+ [${tun.name}]
140− type = server
143+ type = server
141− destination = ${tun.destination}
144+ destination = ${tun.destination}
142− keys = ${tun.keys}
145+ keys = ${tun.keys}
143− host = ${tun.address}
146+ host = ${tun.address}
144− port = ${tun.port}
147+ port = ${tun.port}
145− inport = ${tun.inPort}
148+ inport = ${tun.inPort}
146− accesslist = ${builtins.concatStringsSep "," tun.accessList}
149+ accesslist = ${builtins.concatStringsSep "," tun.accessList}
151 i2pdSh = pkgs.writeScriptBin "i2pd" ''
154 i2pdSh = pkgs.writeScriptBin "i2pd" ''
152 #!/bin/sh
155 #!/bin/sh
153− ${pkgs.i2pd}/bin/i2pd \
156+ exec ${pkgs.i2pd}/bin/i2pd \
154− ${if isNull cfg.extIp then "" else "--host="+cfg.extIp} \
157+ ${if isNull cfg.address then "" else "--host="+cfg.address} \
155 --conf=${i2pdConf} \
158 --conf=${i2pdConf} \
156 --tunconf=${i2pdTunnelConf}
159 --tunconf=${i2pdTunnelConf}
@@ -176,11 +179,23 @@ in
182+ logLevel = mkOption {
183+ type = types.enum ["debug" "info" "warn" "error"];
186+ The log level. <command>i2pd</command> defaults to "info"
187+ but that generates copious amounts of log messages.
189+ We default to "error" which is similar to the default log
190+ level of <command>tor</command>.
179− extIp = mkOption {
194+ address = mkOption {
180 type = with types; nullOr str;
195 type = with types; nullOr str;
181 default = null;
196 default = null;
182 description = ''
197 description = ''
183− Your external IP.
198+ Your external IP or hostname.
@@ -213,7 +228,7 @@ in
213 default = null;
228 default = null;
214 description = ''
229 description = ''
215 Set a router bandwidth limit integer in KBps.
230 Set a router bandwidth limit integer in KBps.
216− If not set, i2pd defaults to 32KBps.
231+ If not set, <command>i2pd</command> defaults to 32KBps.
@@ -261,9 +276,14 @@ in
262 precomputation.elgamal = mkOption {
277 precomputation.elgamal = mkOption {
263 type = types.bool;
278 type = types.bool;
264− default = false;
279+ default = true;
265 description = ''
280 description = ''
266− Use ElGamal precomputated tables.
281+ Whenever to use precomputated tables for ElGamal.
282+ <command>i2pd</command> defaults to <literal>false</literal>
283+ to save 64M of memory (and looses some performance).
285+ We default to <literal>true</literal> as that is what most
@@ -353,7 +373,7 @@ in
356− proto.httpProxy = mkKeyedEndpointOpt "httpproxy" "127.0.0.1" 4446 "";
376+ proto.httpProxy = mkKeyedEndpointOpt "httpproxy" "127.0.0.1" 4444 "";
357 proto.socksProxy = (mkKeyedEndpointOpt "socksproxy" "127.0.0.1" 4447 "")
377 proto.socksProxy = (mkKeyedEndpointOpt "socksproxy" "127.0.0.1" 4447 "")
359 outproxy = mkOption {
379 outproxy = mkOption {