aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-05-02 14:32:12 +0200
committerChocobozzz <me@florianbigard.com>2022-05-02 14:32:12 +0200
commitcfbe6be516808de4b45ca9d98f912999ef8daaab (patch)
treef458df7621833582ccd350a00c5c0404fe782a88
parent42efd780a2db0925b6befd308bd8fc6590117546 (diff)
downloadPeerTube-cfbe6be516808de4b45ca9d98f912999ef8daaab.tar.gz
PeerTube-cfbe6be516808de4b45ca9d98f912999ef8daaab.tar.zst
PeerTube-cfbe6be516808de4b45ca9d98f912999ef8daaab.zip
Add ability to provide rtmp listening hostname
-rw-r--r--config/default.yaml18
-rw-r--r--config/production.yaml.example18
-rw-r--r--server/initializers/config.ts4
-rw-r--r--server/initializers/constants.ts7
-rw-r--r--server/lib/live/live-manager.ts4
5 files changed, 38 insertions, 13 deletions
diff --git a/config/default.yaml b/config/default.yaml
index 017b63e49..7af9c929f 100644
--- a/config/default.yaml
+++ b/config/default.yaml
@@ -411,17 +411,27 @@ live:
411 # Your firewall should accept traffic from this port in TCP if you enable live 411 # Your firewall should accept traffic from this port in TCP if you enable live
412 rtmp: 412 rtmp:
413 enabled: true 413 enabled: true
414 port: 1935 414
415 hostname: 'localhost' 415 hostname: 'localhost'
416 port: 1935
417
418 # Public endpoint of your RTMP server
419 # Use null to use the same value than `webserver.hostname`
420 public_hostname: null
416 421
417 rtmps: 422 rtmps:
418 enabled: false 423 enabled: false
424
425 hostname: 'localhost'
419 port: 1936 426 port: 1936
420 # Absolute path 427
428 # Absolute paths
421 key_file: '' 429 key_file: ''
422 # Absolute path
423 cert_file: '' 430 cert_file: ''
424 hostname: 'localhost' 431
432 # Public endpoint of your RTMPS server
433 # Use null to use the same value than `webserver.hostname`
434 public_hostname: null
425 435
426 # Allow to transcode the live streaming in multiple live resolutions 436 # Allow to transcode the live streaming in multiple live resolutions
427 transcoding: 437 transcoding:
diff --git a/config/production.yaml.example b/config/production.yaml.example
index 8bdd30e2d..048cb37e8 100644
--- a/config/production.yaml.example
+++ b/config/production.yaml.example
@@ -419,17 +419,27 @@ live:
419 # Your firewall should accept traffic from this port in TCP if you enable live 419 # Your firewall should accept traffic from this port in TCP if you enable live
420 rtmp: 420 rtmp:
421 enabled: true 421 enabled: true
422 port: 1935 422
423 hostname: 'localhost' 423 hostname: 'localhost'
424 port: 1935
425
426 # Public endpoint of your RTMP server
427 # Use null to use the same value than `webserver.hostname`
428 public_hostname: null
424 429
425 rtmps: 430 rtmps:
426 enabled: false 431 enabled: false
432
433 hostname: 'localhost'
427 port: 1936 434 port: 1936
428 # Absolute path 435
436 # Absolute paths
429 key_file: '' 437 key_file: ''
430 # Absolute path
431 cert_file: '' 438 cert_file: ''
432 hostname: 'localhost' 439
440 # Public endpoint of your RTMPS server
441 # Use null to use the same value than `webserver.hostname`
442 public_hostname: null
433 443
434 # Allow to transcode the live streaming in multiple live resolutions 444 # Allow to transcode the live streaming in multiple live resolutions
435 transcoding: 445 transcoding:
diff --git a/server/initializers/config.ts b/server/initializers/config.ts
index d8f5f3496..59a65d6a5 100644
--- a/server/initializers/config.ts
+++ b/server/initializers/config.ts
@@ -313,13 +313,15 @@ const CONFIG = {
313 RTMP: { 313 RTMP: {
314 get ENABLED () { return config.get<boolean>('live.rtmp.enabled') }, 314 get ENABLED () { return config.get<boolean>('live.rtmp.enabled') },
315 get PORT () { return config.get<number>('live.rtmp.port') }, 315 get PORT () { return config.get<number>('live.rtmp.port') },
316 get HOSTNAME () { return config.get<number>('live.rtmp.hostname') } 316 get HOSTNAME () { return config.get<number>('live.rtmp.hostname') },
317 get PUBLIC_HOSTNAME () { return config.get<number>('live.rtmp.public_hostname') }
317 }, 318 },
318 319
319 RTMPS: { 320 RTMPS: {
320 get ENABLED () { return config.get<boolean>('live.rtmps.enabled') }, 321 get ENABLED () { return config.get<boolean>('live.rtmps.enabled') },
321 get PORT () { return config.get<number>('live.rtmps.port') }, 322 get PORT () { return config.get<number>('live.rtmps.port') },
322 get HOSTNAME () { return config.get<number>('live.rtmps.hostname') }, 323 get HOSTNAME () { return config.get<number>('live.rtmps.hostname') },
324 get PUBLIC_HOSTNAME () { return config.get<number>('live.rtmps.public_hostname') },
323 get KEY_FILE () { return config.get<string>('live.rtmps.key_file') }, 325 get KEY_FILE () { return config.get<string>('live.rtmps.key_file') },
324 get CERT_FILE () { return config.get<string>('live.rtmps.cert_file') } 326 get CERT_FILE () { return config.get<string>('live.rtmps.cert_file') }
325 }, 327 },
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index 4656ccdbc..9986dbf89 100644
--- a/server/initializers/constants.ts
+++ b/server/initializers/constants.ts
@@ -1074,8 +1074,11 @@ function updateWebserverUrls () {
1074 WEBSERVER.HOSTNAME = CONFIG.WEBSERVER.HOSTNAME 1074 WEBSERVER.HOSTNAME = CONFIG.WEBSERVER.HOSTNAME
1075 WEBSERVER.PORT = CONFIG.WEBSERVER.PORT 1075 WEBSERVER.PORT = CONFIG.WEBSERVER.PORT
1076 1076
1077 WEBSERVER.RTMP_URL = 'rtmp://' + CONFIG.LIVE.RTMP.HOSTNAME + ':' + CONFIG.LIVE.RTMP.PORT + '/' + VIDEO_LIVE.RTMP.BASE_PATH 1077 const rtmpHostname = CONFIG.LIVE.RTMP.PUBLIC_HOSTNAME || CONFIG.WEBSERVER.HOSTNAME
1078 WEBSERVER.RTMPS_URL = 'rtmps://' + CONFIG.LIVE.RTMPS.HOSTNAME + ':' + CONFIG.LIVE.RTMPS.PORT + '/' + VIDEO_LIVE.RTMP.BASE_PATH 1078 const rtmpsHostname = CONFIG.LIVE.RTMPS.PUBLIC_HOSTNAME || CONFIG.WEBSERVER.HOSTNAME
1079
1080 WEBSERVER.RTMP_URL = 'rtmp://' + rtmpHostname + ':' + CONFIG.LIVE.RTMP.PORT + '/' + VIDEO_LIVE.RTMP.BASE_PATH
1081 WEBSERVER.RTMPS_URL = 'rtmps://' + rtmpsHostname + ':' + CONFIG.LIVE.RTMPS.PORT + '/' + VIDEO_LIVE.RTMP.BASE_PATH
1079} 1082}
1080 1083
1081function updateWebserverConfig () { 1084function updateWebserverConfig () {
diff --git a/server/lib/live/live-manager.ts b/server/lib/live/live-manager.ts
index 5ffe41ee3..da09aa05c 100644
--- a/server/lib/live/live-manager.ts
+++ b/server/lib/live/live-manager.ts
@@ -118,7 +118,7 @@ class LiveManager {
118 logger.error('Cannot run RTMP server.', { err, ...lTags() }) 118 logger.error('Cannot run RTMP server.', { err, ...lTags() })
119 }) 119 })
120 120
121 this.rtmpServer.listen(CONFIG.LIVE.RTMP.PORT) 121 this.rtmpServer.listen(CONFIG.LIVE.RTMP.PORT, CONFIG.LIVE.RTMP.HOSTNAME)
122 } 122 }
123 123
124 if (CONFIG.LIVE.RTMPS.ENABLED) { 124 if (CONFIG.LIVE.RTMPS.ENABLED) {
@@ -141,7 +141,7 @@ class LiveManager {
141 logger.error('Cannot run RTMPS server.', { err, ...lTags() }) 141 logger.error('Cannot run RTMPS server.', { err, ...lTags() })
142 }) 142 })
143 143
144 this.rtmpsServer.listen(CONFIG.LIVE.RTMPS.PORT) 144 this.rtmpsServer.listen(CONFIG.LIVE.RTMPS.PORT, CONFIG.LIVE.RTMPS.HOSTNAME)
145 } 145 }
146 } 146 }
147 147