Skip to content

Commit

Permalink
Disable key verification if unset
Browse files Browse the repository at this point in the history
  • Loading branch information
Thor77 committed Nov 26, 2019
1 parent e823d54 commit 17a5d48
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ If config path not provided, config will be read from `config.toml` in the curre
`<streamname><segment index>.ts` segments and `<streamname>.m3u8` playlist are written to the current directory.

### Streaming
Using [ffmpeg](https://ffmpeg.org/) (assuming `Key` set to `key`)
Using [ffmpeg](https://ffmpeg.org/)
```
ffmpeg -i <input file> -f flv "rtmp://localhost/stream01?key=key"
ffmpeg -i <input file> -f flv "rtmp://localhost/stream01"
```

## Configuration
| key | type | default | description |
|-----|------|---------|-------------|
| Addr | `string` | `":1935"` | RTMP server listen address |
| Key | `string` | | Expected value of `key` query parameter for connecting clients |
| Key | `string` | | Expected value of `key` query parameter for connecting clients (disabled if unset) |
| MsPerSegment | `int64` | `15000` | Milliseconds of video/audio written to one segment file |
| LogLevel | `log.Level` | `"info"` | Level for the internal logger |
8 changes: 5 additions & 3 deletions handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,11 @@ func publishHandler(conn *rtmp.Conn) {
log.Debugf("Handling request %s\n", conn.URL.RequestURI())

// verify key
if conn.URL.Query().Get("key") != config.Key {
log.Errorln("Key mismatch, aborting request")
return
if config.Key != "" {
if conn.URL.Query().Get("key") != config.Key {
log.Errorln("Key mismatch, aborting request")
return
}
}

// verify stream has a name
Expand Down

0 comments on commit 17a5d48

Please sign in to comment.