From 61bd5b59582eaecd32d9fc6e2145cd08a963a5e0 Mon Sep 17 00:00:00 2001 From: Evilham Date: Fri, 15 May 2020 22:12:52 +0200 Subject: [PATCH] [__coturn] Add support for common parameters and extra-config. extra-config allows for any complex setup to be defined and managed by the type user. --- type/__coturn/files/turnserver.conf.sh | 23 +++++++++-- type/__coturn/man.rst | 50 ++++++++++++++++++------ type/__coturn/manifest | 21 ++++++++-- type/__coturn/parameter/boolean | 1 + type/__coturn/parameter/default/max-port | 1 + type/__coturn/parameter/default/min-port | 1 + type/__coturn/parameter/optional | 3 ++ 7 files changed, 80 insertions(+), 20 deletions(-) create mode 100644 type/__coturn/parameter/default/max-port create mode 100644 type/__coturn/parameter/default/min-port diff --git a/type/__coturn/files/turnserver.conf.sh b/type/__coturn/files/turnserver.conf.sh index ccd01c5..d16131c 100755 --- a/type/__coturn/files/turnserver.conf.sh +++ b/type/__coturn/files/turnserver.conf.sh @@ -157,8 +157,8 @@ cat << EOF # Lower and upper bounds of the UDP relay endpoints: # (default values are 49152 and 65535) # -min-port=49152 -max-port=65535 +min-port=$MIN_PORT +max-port=$MAX_PORT # Uncomment to run TURN server in 'normal' 'moderate' verbose mode. # By default the verbose mode is off. @@ -437,7 +437,15 @@ cat << EOF # Uncomment if no UDP relay endpoints are allowed. # By default UDP relay endpoints are enabled (like in RFC 5766). # -#no-udp-relay +EOF + +if [ "$NO_UDP_RELAY" ]; then + echo 'no-udp-relay' +else + echo '#no-udp-relay' +fi + +cat << EOF # Uncomment if no TCP relay endpoints are allowed. # By default TCP relay endpoints are enabled (like in RFC 6062). @@ -445,7 +453,7 @@ cat << EOF EOF if [ "$NO_TCP_RELAY" ]; then - echo 'no-tcp-releay' + echo 'no-tcp-relay' else echo '#no-tcp-relay' fi @@ -781,3 +789,10 @@ cat << EOF #no-tlsv1_1 #no-tlsv1_2 EOF + +if [ -n "$EXTRA_CONFIG" ]; then + cat < "$__object/files/turnserver.conf" require="__package/coturn" __file $coturn_config \ --source "$__object/files/turnserver.conf" \ - --owner turnserver - -# Restart coturn server. -require="__file/$coturn_config" __service coturn --action restart + --owner turnserver \ + --onchange 'service coturn restart' diff --git a/type/__coturn/parameter/boolean b/type/__coturn/parameter/boolean index f9180db..65afc3b 100644 --- a/type/__coturn/parameter/boolean +++ b/type/__coturn/parameter/boolean @@ -1,4 +1,5 @@ use-auth-secret no-tcp-relay +no-udp-relay no-tls no-dtls diff --git a/type/__coturn/parameter/default/max-port b/type/__coturn/parameter/default/max-port new file mode 100644 index 0000000..7a53b35 --- /dev/null +++ b/type/__coturn/parameter/default/max-port @@ -0,0 +1 @@ +65535 diff --git a/type/__coturn/parameter/default/min-port b/type/__coturn/parameter/default/min-port new file mode 100644 index 0000000..3f1a082 --- /dev/null +++ b/type/__coturn/parameter/default/min-port @@ -0,0 +1 @@ +49152 diff --git a/type/__coturn/parameter/optional b/type/__coturn/parameter/optional index 515814d..f36d63d 100644 --- a/type/__coturn/parameter/optional +++ b/type/__coturn/parameter/optional @@ -2,3 +2,6 @@ static-auth-secret realm cert pkey +min-port +max-port +extra-config