mirror of
https://github.com/YunoHost-Apps/synapse_ynh.git
synced 2024-09-03 20:26:38 +02:00
Fix and improve coturn config
This commit is contained in:
parent
4f4d742436
commit
ac78f19224
5 changed files with 13 additions and 29 deletions
|
@ -16,13 +16,13 @@ dh-file=/etc/ssl/private/dh2048.pem
|
|||
no-sslv2
|
||||
no-sslv3
|
||||
no-tlsv1
|
||||
no-tlsv1_1
|
||||
|
||||
no-loopback-peers
|
||||
no-multicast-peers
|
||||
|
||||
no-cli
|
||||
|
||||
log-file=/var/log/matrix-__APP__/turnserver.log
|
||||
pidfile=/var/run/coturn-__APP__/turnserver.pid
|
||||
simple-log
|
||||
|
||||
external-ip=__IPV4__,__IPV6__
|
||||
|
||||
|
|
|
@ -363,16 +363,12 @@ public_ip6="$(curl ipv6.yunohost.org)" || true
|
|||
|
||||
if [ -n "$public_ip4" ] && ynh_validate_ip4 --ip_address="$public_ip4"
|
||||
then
|
||||
ynh_replace_string --match_string='__IPV4__' --replace_string="$public_ip4" --target_file="$coturn_config_path"
|
||||
else
|
||||
ynh_replace_string --match_string='__IPV4__,' --replace_string="" --target_file="$coturn_config_path"
|
||||
echo "external-ip=$public_ip4" >> "$coturn_config_path"
|
||||
fi
|
||||
|
||||
if [ -n "$public_ip6" ] && ynh_validate_ip6 --ip_address="$public_ip6"
|
||||
then
|
||||
ynh_replace_string --match_string='__IPV6__' --replace_string="$public_ip6" --target_file="$coturn_config_path"
|
||||
else
|
||||
ynh_replace_string --match_string=',__IPV6__' --replace_string="" --target_file="$coturn_config_path"
|
||||
echo "external-ip=$public_ip6" >> "$coturn_config_path"
|
||||
fi
|
||||
|
||||
ynh_store_file_checksum --file="$coturn_config_path"
|
||||
|
|
|
@ -185,16 +185,12 @@ public_ip6="$(curl ipv6.yunohost.org)" || true
|
|||
|
||||
if [ -n "$public_ip4" ] && ynh_validate_ip4 --ip_address="$public_ip4"
|
||||
then
|
||||
ynh_replace_string --match_string='__IPV4__' --replace_string="$public_ip4" --target_file="$coturn_config_path"
|
||||
else
|
||||
ynh_replace_string --match_string='__IPV4__,' --replace_string="" --target_file="$coturn_config_path"
|
||||
echo "external-ip=$public_ip4" >> "$coturn_config_path"
|
||||
fi
|
||||
|
||||
if [ -n "$public_ip6" ] && ynh_validate_ip6 --ip_address="$public_ip6"
|
||||
then
|
||||
ynh_replace_string --match_string='__IPV6__' --replace_string="$public_ip6" --target_file="$coturn_config_path"
|
||||
else
|
||||
ynh_replace_string --match_string=',__IPV6__' --replace_string="" --target_file="$coturn_config_path"
|
||||
echo "external-ip=$public_ip6" >> "$coturn_config_path"
|
||||
fi
|
||||
|
||||
ynh_store_file_checksum --file="$coturn_config_path"
|
||||
|
|
|
@ -406,16 +406,12 @@ public_ip6="$(curl ipv6.yunohost.org)" || true
|
|||
|
||||
if [ -n "$public_ip4" ] && ynh_validate_ip4 --ip_address="$public_ip4"
|
||||
then
|
||||
ynh_replace_string --match_string='__IPV4__' --replace_string="$public_ip4" --target_file="$coturn_config_path"
|
||||
else
|
||||
ynh_replace_string --match_string='__IPV4__,' --replace_string="" --target_file="$coturn_config_path"
|
||||
echo "external-ip=$public_ip4" >> "$coturn_config_path"
|
||||
fi
|
||||
|
||||
if [ -n "$public_ip6" ] && ynh_validate_ip6 --ip_address="$public_ip6"
|
||||
then
|
||||
ynh_replace_string --match_string='__IPV6__' --replace_string="$public_ip6" --target_file="$coturn_config_path"
|
||||
else
|
||||
ynh_replace_string --match_string=',__IPV6__' --replace_string="" --target_file="$coturn_config_path"
|
||||
echo "external-ip=$public_ip6" >> "$coturn_config_path"
|
||||
fi
|
||||
|
||||
ynh_store_file_checksum --file="$coturn_config_path"
|
||||
|
|
|
@ -9,18 +9,14 @@ external_IP_line="external-ip=__IPV4__,__IPV6__"
|
|||
public_ip4="$(curl ip.yunohost.org)" || true
|
||||
public_ip6="$(curl ipv6.yunohost.org)" || true
|
||||
|
||||
if [[ -n "$public_ip4" ]] && ynh_validate_ip 4 "$public_ip4"
|
||||
if [ -n "$public_ip4" ] && ynh_validate_ip4 --ip_address="$public_ip4"
|
||||
then
|
||||
external_IP_line="${external_IP_line/'__IPV4__'/$public_ip4}"
|
||||
else
|
||||
external_IP_line="${external_IP_line/'__IPV4__,'/}"
|
||||
echo "external-ip=$public_ip4" >> "$coturn_config_path"
|
||||
fi
|
||||
|
||||
if [[ -n "$public_ip6" ]] && ynh_validate_ip 6 "$public_ip6"
|
||||
if [ -n "$public_ip6" ] && ynh_validate_ip6 --ip_address="$public_ip6"
|
||||
then
|
||||
external_IP_line="${external_IP_line/'__IPV6__'/$public_ip6}"
|
||||
else
|
||||
external_IP_line="${external_IP_line/',__IPV6__'/}"
|
||||
echo "external-ip=$public_ip6" >> "$coturn_config_path"
|
||||
fi
|
||||
|
||||
old_config_line=$(egrep "^external-ip=.*\$" "/etc/matrix-$app_instance/coturn.conf")
|
||||
|
|
Loading…
Reference in a new issue