clightning: refactor bind-addr to be IP address only
With typecheck
This commit is contained in:
parent
d99ccc8445
commit
43da15557d
@ -11,7 +11,7 @@ let
|
||||
bitcoin-datadir=${config.services.bitcoind.dataDir}
|
||||
${optionalString (cfg.proxy != null) "proxy=${cfg.proxy}"}
|
||||
always-use-proxy=${if cfg.always-use-proxy then "true" else "false"}
|
||||
${optionalString (cfg.bind-addr != null) "bind-addr=${cfg.bind-addr}"}
|
||||
${optionalString (cfg.bind-addr != null) "bind-addr=${cfg.bind-addr}:${toString cfg.bindport}"}
|
||||
${optionalString (cfg.bitcoin-rpcconnect != null) "bitcoin-rpcconnect=${cfg.bitcoin-rpcconnect}"}
|
||||
bitcoin-rpcuser=${config.services.bitcoind.rpc.users.public.name}
|
||||
rpc-file-mode=0660
|
||||
@ -46,8 +46,8 @@ in {
|
||||
'';
|
||||
};
|
||||
bind-addr = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
type = types.addCheck types.str (s: builtins.length (builtins.split ":" s) == 1);
|
||||
default = "127.0.0.1";
|
||||
description = "Set an IP address or UNIX domain socket to listen to";
|
||||
};
|
||||
bindport = mkOption {
|
||||
|
@ -70,8 +70,7 @@ in {
|
||||
};
|
||||
};
|
||||
|
||||
config = mkMerge [
|
||||
(mkIf cfg.enable {
|
||||
config = mkIf cfg.enable {
|
||||
# Prerequisites
|
||||
networking.dhcpcd.denyInterfaces = [ "br0" "br-nb*" "nb-veth*" ];
|
||||
services.tor.client.socksListenAddress = "${bridgeIp}:9050";
|
||||
@ -227,7 +226,7 @@ in {
|
||||
# clightning: Custom netns configs
|
||||
services.clightning = mkIf config.services.clightning.enable {
|
||||
bitcoin-rpcconnect = netns.bitcoind.address;
|
||||
bind-addr = "${netns.clightning.address}:${toString config.services.clightning.bindport}";
|
||||
bind-addr = netns.clightning.address;
|
||||
};
|
||||
|
||||
# lnd: Custom netns configs
|
||||
@ -303,11 +302,5 @@ in {
|
||||
netns-exec nb-lightning-loop sudo -u lnd ${config.services.lightning-loop.package}/bin/loop "$@"
|
||||
'';
|
||||
};
|
||||
})
|
||||
# Custom netns config option values if netns-isolation not enabled
|
||||
(mkIf (!cfg.enable) {
|
||||
# clightning
|
||||
services.clightning.bind-addr = "127.0.0.1:${toString config.services.clightning.bindport}";
|
||||
})
|
||||
];
|
||||
};
|
||||
}
|
||||
|
@ -152,7 +152,11 @@ in {
|
||||
enforceTor = true;
|
||||
always-use-proxy = true;
|
||||
};
|
||||
services.tor.hiddenServices.clightning = mkIf cfg.clightning.enable (mkHiddenService { port = cfg.clightning.onionport; toHost = (builtins.head (builtins.split ":" cfg.clightning.bind-addr)); toPort = cfg.clightning.bindport; });
|
||||
services.tor.hiddenServices.clightning = mkIf cfg.clightning.enable (mkHiddenService {
|
||||
port = cfg.clightning.onionport;
|
||||
toHost = cfg.clightning.bind-addr;
|
||||
toPort = cfg.clightning.bindport;
|
||||
});
|
||||
|
||||
# lnd
|
||||
services.lnd = {
|
||||
|
Loading…
Reference in New Issue
Block a user