Skip to content

Commit

Permalink
Merge pull request gwuhaolin#205 from Gwestone/master
Browse files Browse the repository at this point in the history
added hls via https support
  • Loading branch information
gwuhaolin authored Mar 31, 2022
2 parents 0fd0e41 + f24aaa6 commit 0e247e1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ Run `docker run -p 1935:1935 -p 7001:7001 -p 7002:7002 -p 8090:8090 -d gwuhaolin
- `RTMP`:`rtmp://localhost:1935/{appname}/movie`
- `FLV`:`http://127.0.0.1:7001/{appname}/movie.flv`
- `HLS`:`http://127.0.0.1:7002/{appname}/movie.m3u8`

5. Use hls via https: generate ssl certificate(server.key, server.crt files), place them in directory with executable file, change "use_hls_https" option in livego.yaml to true (false by default)

all options:
```bash
./livego -h
Expand Down
1 change: 1 addition & 0 deletions livego.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

# # HLS Options
# hls_addr: ":7002"
#use_hls_https: true

# # API Options
# api_addr: ":8090"
Expand Down
8 changes: 7 additions & 1 deletion protocol/hls/hls.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,13 @@ func (server *Server) Serve(listener net.Listener) error {
server.handle(w, r)
})
server.listener = listener
http.Serve(listener, mux)

if configure.Config.GetBool("use_hls_https") {
http.ServeTLS(listener, mux, "server.crt", "server.key")
} else {
http.Serve(listener, mux)
}

return nil
}

Expand Down

0 comments on commit 0e247e1

Please sign in to comment.