Add option to change the RTMP listen address
A new setting has been added to change the address and port that the RTMP server listens on. `RtmpListenAddress` in the settings json and `-r` on the command line. Both options use the same format: `host:port`.
This commit is contained in:
parent
fa206980e7
commit
630abfe474
12
main.go
12
main.go
|
@ -16,6 +16,7 @@ import (
|
||||||
var (
|
var (
|
||||||
pullEmotes bool
|
pullEmotes bool
|
||||||
addr string
|
addr string
|
||||||
|
rtmpAddr string
|
||||||
sKey string
|
sKey string
|
||||||
stats = newStreamStats()
|
stats = newStreamStats()
|
||||||
sAdminPass string
|
sAdminPass string
|
||||||
|
@ -47,7 +48,8 @@ func setupSettings() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
flag.StringVar(&addr, "l", "", "host:port of the MovieNight")
|
flag.StringVar(&addr, "l", "", "host:port of the HTTP server")
|
||||||
|
flag.StringVar(&rtmpAddr, "r", "", "host:port of the RTMP server")
|
||||||
flag.StringVar(&sKey, "k", "", "Stream key, to protect your stream")
|
flag.StringVar(&sKey, "k", "", "Stream key, to protect your stream")
|
||||||
flag.StringVar(&sAdminPass, "a", "", "Set admin password. Overrides configuration in settings.json. This will not write the password to settings.json.")
|
flag.StringVar(&sAdminPass, "a", "", "Set admin password. Overrides configuration in settings.json. This will not write the password to settings.json.")
|
||||||
flag.BoolVar(&pullEmotes, "e", false, "Pull emotes")
|
flag.BoolVar(&pullEmotes, "e", false, "Pull emotes")
|
||||||
|
@ -90,8 +92,8 @@ func main() {
|
||||||
addr = settings.ListenAddress
|
addr = settings.ListenAddress
|
||||||
}
|
}
|
||||||
|
|
||||||
if addr[0] != ':' {
|
if rtmpAddr == "" {
|
||||||
addr = ":" + addr
|
rtmpAddr = settings.RtmpListenAddress
|
||||||
}
|
}
|
||||||
|
|
||||||
// A stream key was passed on the command line. Use it, but don't save
|
// A stream key was passed on the command line. Use it, but don't save
|
||||||
|
@ -102,7 +104,8 @@ func main() {
|
||||||
|
|
||||||
common.LogInfoln("Stream key: ", settings.GetStreamKey())
|
common.LogInfoln("Stream key: ", settings.GetStreamKey())
|
||||||
common.LogInfoln("Admin password: ", settings.AdminPassword)
|
common.LogInfoln("Admin password: ", settings.AdminPassword)
|
||||||
common.LogInfoln("Listen and serve ", addr)
|
common.LogInfoln("HTTP server listening on: ", addr)
|
||||||
|
common.LogInfoln("RTMP server listening on: ", rtmpAddr)
|
||||||
common.LogInfoln("RoomAccess: ", settings.RoomAccess)
|
common.LogInfoln("RoomAccess: ", settings.RoomAccess)
|
||||||
common.LogInfoln("RoomAccessPin: ", settings.RoomAccessPin)
|
common.LogInfoln("RoomAccessPin: ", settings.RoomAccessPin)
|
||||||
|
|
||||||
|
@ -116,6 +119,7 @@ func startRmtpServer() {
|
||||||
server := &rtmp.Server{
|
server := &rtmp.Server{
|
||||||
HandlePlay: handlePlay,
|
HandlePlay: handlePlay,
|
||||||
HandlePublish: handlePublish,
|
HandlePublish: handlePublish,
|
||||||
|
Addr: rtmpAddr,
|
||||||
}
|
}
|
||||||
err := server.ListenAndServe()
|
err := server.ListenAndServe()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -36,6 +36,7 @@ type Settings struct {
|
||||||
RegenAdminPass bool // regenerate admin password on start?
|
RegenAdminPass bool // regenerate admin password on start?
|
||||||
RoomAccess AccessMode
|
RoomAccess AccessMode
|
||||||
RoomAccessPin string // The current pin
|
RoomAccessPin string // The current pin
|
||||||
|
RtmpListenAddress string // host:port that the RTMP server listens on
|
||||||
SessionKey string // key for session data
|
SessionKey string // key for session data
|
||||||
StreamKey string
|
StreamKey string
|
||||||
StreamStats bool
|
StreamStats bool
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
"RateLimitDuplicate": 30,
|
"RateLimitDuplicate": 30,
|
||||||
"RateLimitNick": 300,
|
"RateLimitNick": 300,
|
||||||
"RegenAdminPass": true,
|
"RegenAdminPass": true,
|
||||||
|
"RtmpListenAddress": ":1935",
|
||||||
"StreamKey": "ALongStreamKey",
|
"StreamKey": "ALongStreamKey",
|
||||||
"TitleLength": 50,
|
"TitleLength": 50,
|
||||||
"TwitchClientID": "",
|
"TwitchClientID": "",
|
||||||
|
|
Loading…
Reference in New Issue