Add listenIp for turn
This commit is contained in:
1 parent
6bb9ceefb8
commit
cccfcb255d
3 files changed
+34
-20
No files matched your search
@@ -163,6 +163,7 @@ in
|
|||||||
turn = {
|
turn = {
|
||||||
enable = true;
|
enable = true;
|
||||||
name = "turn-server";
|
name = "turn-server";
|
||||||
|
listenIP = "172.30.0.28";
|
||||||
listenPort = 3479;
|
listenPort = 3479;
|
||||||
minPort = 49160;
|
minPort = 49160;
|
||||||
maxPort = 49200;
|
maxPort = 49200;
|
||||||
|
|||||||
@@ -12,19 +12,27 @@ in
|
|||||||
"turn/public-ip" = { };
|
"turn/public-ip" = { };
|
||||||
};
|
};
|
||||||
|
|
||||||
sops.templates."turnserver.conf".content = ''
|
sops.templates."turnserver.conf" = {
|
||||||
listening-port=${toString cfg.listenPort}
|
owner = "nobody";
|
||||||
fingerprint
|
group = "nogroup";
|
||||||
lt-cred-mech
|
mode = "0400";
|
||||||
realm=${realm}
|
restartUnits = [ "docker-turn-server.service" ];
|
||||||
user=turn:${config.sops.placeholder."turn/password"}
|
content = ''
|
||||||
min-port=${toString cfg.minPort}
|
listening-port=${toString cfg.listenPort}
|
||||||
max-port=${toString cfg.maxPort}
|
listening-ip=${cfg.listenIP}
|
||||||
external-ip=${config.sops.placeholder."turn/public-ip"}
|
fingerprint
|
||||||
log-file=stdout
|
lt-cred-mech
|
||||||
no-cli
|
realm=${realm}
|
||||||
no-tls
|
user=turn:${config.sops.placeholder."turn/password"}
|
||||||
no-dtls
|
min-port=${toString cfg.minPort}
|
||||||
'';
|
max-port=${toString cfg.maxPort}
|
||||||
|
relay-ip=${cfg.listenIP}
|
||||||
|
external-ip=${config.sops.placeholder."turn/public-ip"}/${cfg.listenIP}
|
||||||
|
log-file=stdout
|
||||||
|
no-cli
|
||||||
|
no-tls
|
||||||
|
no-dtls
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -12,6 +12,9 @@ in
|
|||||||
name = mkOption {
|
name = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
};
|
};
|
||||||
|
listenIP = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
};
|
||||||
listenPort = mkOption {
|
listenPort = mkOption {
|
||||||
type = types.port;
|
type = types.port;
|
||||||
};
|
};
|
||||||
@@ -27,14 +30,16 @@ in
|
|||||||
virtualisation.oci-containers.containers.${cfg.name} = {
|
virtualisation.oci-containers.containers.${cfg.name} = {
|
||||||
image = "docker.io/coturn/coturn:4.6.3";
|
image = "docker.io/coturn/coturn:4.6.3";
|
||||||
cmd = [ "-c" "/etc/turnserver.conf" ];
|
cmd = [ "-c" "/etc/turnserver.conf" ];
|
||||||
ports =
|
ports = [
|
||||||
[ "0.0.0.0:${toString cfg.listenPort}:${toString cfg.listenPort}/udp" ]
|
"0.0.0.0:${toString cfg.listenPort}:${toString cfg.listenPort}/udp"
|
||||||
++ map (port: "0.0.0.0:${toString port}:${toString port}/udp") (
|
]
|
||||||
range cfg.minPort cfg.maxPort
|
++ map (port: "0.0.0.0:${toString port}:${toString port}/udp") (range cfg.minPort cfg.maxPort);
|
||||||
);
|
|
||||||
volumes = [ "${config.sops.templates."turnserver.conf".path}:/etc/turnserver.conf:ro" ];
|
volumes = [ "${config.sops.templates."turnserver.conf".path}:/etc/turnserver.conf:ro" ];
|
||||||
log-driver = "journald";
|
log-driver = "journald";
|
||||||
extraOptions = [ "--network=${common.network.name}" ];
|
extraOptions = [
|
||||||
|
"--network=${common.network.name}"
|
||||||
|
"--ip=172.30.0.28"
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.services."${common.backend}-${cfg.name}" = {
|
systemd.services."${common.backend}-${cfg.name}" = {
|
||||||
|
|||||||
Reference in new issue
Block a user