Reject invalid streaming key

This commit is contained in:
Gabe Kangas
2020-06-01 17:15:11 -07:00
parent ca622c85c7
commit 161aaeec8d
5 changed files with 60 additions and 45 deletions

View File

@@ -41,6 +41,12 @@ func (h *Handler) OnCreateStream(timestamp uint32, cmd *rtmpmsg.NetConnectionCre
func (h *Handler) OnPublish(timestamp uint32, cmd *rtmpmsg.NetStreamPublish) error {
// log.Printf("OnPublish: %#v", cmd)
log.Println("Incoming stream connected.")
if cmd.PublishingName != configuration.VideoSettings.StreamingKey {
return errors.New("Invalid streaming key! Rejecting incoming stream.")
}
// (example) Reject a connection when PublishingName is empty
if cmd.PublishingName == "" {
return errors.New("PublishingName is empty")