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 (
|
||||
pullEmotes bool
|
||||
addr string
|
||||
rtmpAddr string
|
||||
sKey string
|
||||
stats = newStreamStats()
|
||||
sAdminPass string
|
||||
|
@ -47,7 +48,8 @@ func setupSettings() error {
|
|||
}
|
||||
|
||||
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(&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")
|
||||
|
@ -90,8 +92,8 @@ func main() {
|
|||
addr = settings.ListenAddress
|
||||
}
|
||||
|
||||
if addr[0] != ':' {
|
||||
addr = ":" + addr
|
||||
if rtmpAddr == "" {
|
||||
rtmpAddr = settings.RtmpListenAddress
|
||||
}
|
||||
|
||||
// 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("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("RoomAccessPin: ", settings.RoomAccessPin)
|
||||
|
||||
|
@ -116,6 +119,7 @@ func startRmtpServer() {
|
|||
server := &rtmp.Server{
|
||||
HandlePlay: handlePlay,
|
||||
HandlePublish: handlePublish,
|
||||
Addr: rtmpAddr,
|
||||
}
|
||||
err := server.ListenAndServe()
|
||||
if err != nil {
|
||||
|
|
|
@ -36,6 +36,7 @@ type Settings struct {
|
|||
RegenAdminPass bool // regenerate admin password on start?
|
||||
RoomAccess AccessMode
|
||||
RoomAccessPin string // The current pin
|
||||
RtmpListenAddress string // host:port that the RTMP server listens on
|
||||
SessionKey string // key for session data
|
||||
StreamKey string
|
||||
StreamStats bool
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
"RateLimitDuplicate": 30,
|
||||
"RateLimitNick": 300,
|
||||
"RegenAdminPass": true,
|
||||
"RtmpListenAddress": ":1935",
|
||||
"StreamKey": "ALongStreamKey",
|
||||
"TitleLength": 50,
|
||||
"TwitchClientID": "",
|
||||
|
|
Loading…
Reference in New Issue