-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ca236c6
commit 3108c31
Showing
12 changed files
with
180 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
TURN_SECRET=COTURN_SECRET_STRING | ||
TURN_TTL=3600 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
node_modules | ||
.env | ||
config.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"iceServers": [ | ||
{ | ||
"urls": [ | ||
"stun:somehost:port" | ||
] | ||
}, | ||
{ | ||
"urls": [ | ||
"turn:somehost:port" | ||
], | ||
"username": "someuser", | ||
"credential": "somepassword" | ||
} | ||
], | ||
"iceTransportPolicy": "all" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Install coturn | ||
sudo apt-get update -y | ||
sudo apt-get install coturn | ||
|
||
# Configure coturn | ||
sudo mv /etc/turnserver.conf /etc/turnserver.conf.backup | ||
sudo cp turnserver.conf /etc/turnserver.conf | ||
|
||
# Update IPs in config | ||
private_ip=$(ip route get 1 | awk '{print $7}') | ||
public_ip=$(curl ifconfig.me) | ||
sudo sed -i "s/PRIVATE_IP/$private_ip/g" /etc/turnserver.conf | ||
sudo sed -i "s/PUBLIC_IP/$public_ip/g" /etc/turnserver.conf | ||
|
||
if [ -z "$1" ]; then | ||
read -p "Enter the coturn auth secret: " secret | ||
else | ||
secret=$1 | ||
fi | ||
sudo sed -i "s/COTURN_AUTH_SECRET/$secret/g" /etc/turnserver.conf | ||
|
||
# Open firewall | ||
sudo iptables -I INPUT -p tcp -m tcp --dport 3478 -j ACCEPT | ||
sudo iptables -I INPUT -p udp -m udp --dport 3478 -j ACCEPT | ||
sudo iptables -I INPUT -p udp -m udp --dport 49152:65535 -j ACCEPT | ||
|
||
# Restart service | ||
sudo systemctl restart coturn.service |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# WebRTC Demo Coturn Config | ||
realm=somedomain | ||
server-name=somedomain | ||
listening-ip=PRIVATE_IP | ||
external-ip=PUBLIC_IP | ||
min-port=49152 | ||
max-port=65535 | ||
# verbose | ||
fingerprint | ||
# lt-cred-mech | ||
# user=someusername:somepassword | ||
use-auth-secret | ||
status-auth-secret=COTURN_AUTH_SECRET | ||
# log-file=/var/tmp/turn.log | ||
syslog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# | ||
# $1 = private_key_path | ||
# $2 = username@server | ||
# | ||
rsync -avzP --exclude node_modules -e "ssh -i \"$1\"" . $2:~/WebRTC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Setup reverse proxy | ||
sudo apt-get update | ||
sudo apt-get install nginx | ||
|
||
# Generate a self signed certificate | ||
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -sha256 -days 3650 -nodes -subj "/C=XX/ST=StateName/L=CityName/O=CompanyName/OU=CompanySectionName/CN=CommonNameOrHostname" | ||
sudo cp *.pem /etc/ssl | ||
|
||
# Set up the reverse proxy to the node app | ||
sudo cp webrtc /etc/nginx/sites-available/ | ||
sudo ln -s /etc/nginx/sites-available/webrtc /etc/nginx/sites-enabled | ||
|
||
sudo iptables -I INPUT -p tcp -m tcp --dport 80 -j ACCEPT | ||
sudo iptables -I INPUT -p tcp -m tcp --dport 443 -j ACCEPT | ||
|
||
sudo systemctl restart nginx.service |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
server { | ||
listen 80; | ||
listen 443 ssl; | ||
server_name webrtc; | ||
|
||
ssl_certificate /etc/ssl/cert.pem; | ||
ssl_certificate_key /etc/ssl/key.pem; | ||
|
||
location / { | ||
proxy_pass http://127.0.0.1:3000/; | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Setup services | ||
cd coturn | ||
source ./setup.sh | ||
cd .. | ||
cd nginx | ||
source ./nginx/setup.sh | ||
cd .. | ||
|
||
# Run app | ||
sudo apt-get install nodejs npm | ||
npm install | ||
node index.js |