clanService/phonebox: allow multi-clients to exist on one node
This commit is contained in:
@@ -155,6 +155,7 @@
|
|||||||
input = "clan-core";
|
input = "clan-core";
|
||||||
};
|
};
|
||||||
roles.default.tags."global-network" = { };
|
roles.default.tags."global-network" = { };
|
||||||
|
roles.default.settings.extraYggdrasilIPs = [ ];
|
||||||
roles.default.settings.extraPeers = [
|
roles.default.settings.extraPeers = [
|
||||||
"tls://ygg.jjolly.dev:3443"
|
"tls://ygg.jjolly.dev:3443"
|
||||||
"tls://[2602:fc24:18:7a42::1]:993"
|
"tls://[2602:fc24:18:7a42::1]:993"
|
||||||
@@ -186,7 +187,7 @@
|
|||||||
input = "clan-core";
|
input = "clan-core";
|
||||||
};
|
};
|
||||||
roles.default.tags."phonebox" = { };
|
roles.default.tags."phonebox" = { };
|
||||||
roles.default.settings.extraYggdrasilIPs = [ "200:c806:c13b:b855:723f:473:55:7904" ];
|
roles.default.settings.extraYggdrasilIPs = [ ];
|
||||||
roles.default.settings.extraPeers = [
|
roles.default.settings.extraPeers = [
|
||||||
"tls://ygg.jjolly.dev:3443"
|
"tls://ygg.jjolly.dev:3443"
|
||||||
"tls://[2602:fc24:18:7a42::1]:993"
|
"tls://[2602:fc24:18:7a42::1]:993"
|
||||||
@@ -204,6 +205,13 @@
|
|||||||
roles.default.machines."adhil".settings = {
|
roles.default.machines."adhil".settings = {
|
||||||
ata-ethernet-iface = "end0";
|
ata-ethernet-iface = "end0";
|
||||||
};
|
};
|
||||||
|
roles.default.machines."rigel".settings = {
|
||||||
|
extraClientNumbers = [
|
||||||
|
"01"
|
||||||
|
"02"
|
||||||
|
];
|
||||||
|
extraFixedIPClient = { };
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
pulse-stream = {
|
pulse-stream = {
|
||||||
|
|||||||
@@ -24,6 +24,36 @@
|
|||||||
description = "";
|
description = "";
|
||||||
default = "";
|
default = "";
|
||||||
};
|
};
|
||||||
|
options.extraClientNumbers = lib.mkOption {
|
||||||
|
type = with lib.types; listOf str;
|
||||||
|
description = "List of client suffix number.";
|
||||||
|
default = [ ];
|
||||||
|
};
|
||||||
|
|
||||||
|
options.extraFixedIPClient = lib.mkOption {
|
||||||
|
type = lib.types.attrsOf (
|
||||||
|
lib.types.submodule {
|
||||||
|
options = {
|
||||||
|
ip = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
description = "IP address for this client";
|
||||||
|
};
|
||||||
|
|
||||||
|
name = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
description = "Name of the client";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
description = "Extra client to be added to pjsip config as a fixed IP auth";
|
||||||
|
example = {
|
||||||
|
"01" = {
|
||||||
|
ip = "192.168.1.3";
|
||||||
|
name = "bob";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
perInstance =
|
perInstance =
|
||||||
{
|
{
|
||||||
@@ -126,6 +156,41 @@
|
|||||||
remove_existing=yes
|
remove_existing=yes
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
genLocalSIPEndpointV6 =
|
||||||
|
{ localNumber }:
|
||||||
|
''
|
||||||
|
[${localNumber}](internal_endpoint)
|
||||||
|
transport=transport-udp6
|
||||||
|
aors=${localNumber}
|
||||||
|
auth=${localNumber}
|
||||||
|
|
||||||
|
[${localNumber}](userpass_auth)
|
||||||
|
username=${localNumber}
|
||||||
|
password=${localNumber}
|
||||||
|
|
||||||
|
[${localNumber}](dynamiic_aor)
|
||||||
|
max_contacts=1
|
||||||
|
'';
|
||||||
|
|
||||||
|
genLocalSIPIPEndpoint = number: ''
|
||||||
|
|
||||||
|
[${number}](internal_endpoint)
|
||||||
|
aors=${number}
|
||||||
|
auth=${number}
|
||||||
|
contact_deny=0.0.0.0/0
|
||||||
|
contact_deny=::/0
|
||||||
|
contact_permit=${settings.extraFixedIPClient.${number}.ip}/128
|
||||||
|
|
||||||
|
[${number}](dynamiic_aor)
|
||||||
|
max_contacts=1
|
||||||
|
remove_existing=yes
|
||||||
|
|
||||||
|
[${number}](userpass_auth)
|
||||||
|
username=${number}
|
||||||
|
password=${number}
|
||||||
|
|
||||||
|
'';
|
||||||
|
|
||||||
genLocalExtenConf =
|
genLocalExtenConf =
|
||||||
{ localNumber }:
|
{ localNumber }:
|
||||||
''
|
''
|
||||||
@@ -356,6 +421,14 @@
|
|||||||
+ (genLocalExtenConf {
|
+ (genLocalExtenConf {
|
||||||
localNumber = config.clan.core.vars.generators.phonebox.files.ata-local-number.value;
|
localNumber = config.clan.core.vars.generators.phonebox.files.ata-local-number.value;
|
||||||
})
|
})
|
||||||
|
+ lib.concatStringsSep "\n" (
|
||||||
|
builtins.map (number: genLocalExtenConf { localNumber = number; }) settings.extraClientNumbers
|
||||||
|
)
|
||||||
|
+ lib.concatStringsSep "\n" (
|
||||||
|
lib.mapAttrsToList (
|
||||||
|
number: _: genLocalExtenConf { localNumber = number; }
|
||||||
|
) settings.extraFixedIPClient
|
||||||
|
)
|
||||||
+ serverConf;
|
+ serverConf;
|
||||||
|
|
||||||
"rtp.conf" = ''
|
"rtp.conf" = ''
|
||||||
@@ -409,6 +482,12 @@
|
|||||||
+ (genLocalSIPEndpoint {
|
+ (genLocalSIPEndpoint {
|
||||||
localNumber = config.clan.core.vars.generators.phonebox.files.ata-local-number.value;
|
localNumber = config.clan.core.vars.generators.phonebox.files.ata-local-number.value;
|
||||||
})
|
})
|
||||||
|
+ lib.concatStringsSep "\n" (
|
||||||
|
builtins.map (number: genLocalSIPEndpointV6 { localNumber = number; }) settings.extraClientNumbers
|
||||||
|
)
|
||||||
|
+ lib.concatStringsSep "\n" (
|
||||||
|
lib.mapAttrsToList (number: _: genLocalSIPIPEndpoint number) settings.extraFixedIPClient
|
||||||
|
)
|
||||||
+ serverConf;
|
+ serverConf;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user