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 = {
|
||||
enable = true;
|
||||
name = "turn-server";
|
||||
listenIP = "172.30.0.28";
|
||||
listenPort = 3479;
|
||||
minPort = 49160;
|
||||
maxPort = 49200;
|
||||
|
||||
@@ -12,19 +12,27 @@ in
|
||||
"turn/public-ip" = { };
|
||||
};
|
||||
|
||||
sops.templates."turnserver.conf".content = ''
|
||||
listening-port=${toString cfg.listenPort}
|
||||
fingerprint
|
||||
lt-cred-mech
|
||||
realm=${realm}
|
||||
user=turn:${config.sops.placeholder."turn/password"}
|
||||
min-port=${toString cfg.minPort}
|
||||
max-port=${toString cfg.maxPort}
|
||||
external-ip=${config.sops.placeholder."turn/public-ip"}
|
||||
log-file=stdout
|
||||
no-cli
|
||||
no-tls
|
||||
no-dtls
|
||||
'';
|
||||
sops.templates."turnserver.conf" = {
|
||||
owner = "nobody";
|
||||
group = "nogroup";
|
||||
mode = "0400";
|
||||
restartUnits = [ "docker-turn-server.service" ];
|
||||
content = ''
|
||||
listening-port=${toString cfg.listenPort}
|
||||
listening-ip=${cfg.listenIP}
|
||||
fingerprint
|
||||
lt-cred-mech
|
||||
realm=${realm}
|
||||
user=turn:${config.sops.placeholder."turn/password"}
|
||||
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 {
|
||||
type = types.str;
|
||||
};
|
||||
listenIP = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
listenPort = mkOption {
|
||||
type = types.port;
|
||||
};
|
||||
@@ -27,14 +30,16 @@ in
|
||||
virtualisation.oci-containers.containers.${cfg.name} = {
|
||||
image = "docker.io/coturn/coturn:4.6.3";
|
||||
cmd = [ "-c" "/etc/turnserver.conf" ];
|
||||
ports =
|
||||
[ "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
|
||||
);
|
||||
ports = [
|
||||
"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);
|
||||
volumes = [ "${config.sops.templates."turnserver.conf".path}:/etc/turnserver.conf:ro" ];
|
||||
log-driver = "journald";
|
||||
extraOptions = [ "--network=${common.network.name}" ];
|
||||
extraOptions = [
|
||||
"--network=${common.network.name}"
|
||||
"--ip=172.30.0.28"
|
||||
];
|
||||
};
|
||||
|
||||
systemd.services."${common.backend}-${cfg.name}" = {
|
||||
|
||||
Reference in new issue
Block a user