Add listenIp for turn

This commit is contained in:
aloslider committed 2026-10-23 22:03:08 +03:00
1 parent 6bb9ceefb8
commit cccfcb255d
3 files changed
+34 -20

No files matched your search

@@ -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}" = {