Browse Source

added hls via https support

pull/205/head
Gwestonem 3 years ago
parent
commit
f24aaa62ee
  1. 3
      README.md
  2. 1
      livego.yaml
  3. 8
      protocol/hls/hls.go

3
README.md

@ -45,7 +45,8 @@ Run `docker run -p 1935:1935 -p 7001:7001 -p 7002:7002 -p 8090:8090 -d gwuhaolin @@ -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

1
livego.yaml

@ -14,6 +14,7 @@ @@ -14,6 +14,7 @@
# # HLS Options
# hls_addr: ":7002"
#use_hls_https: true
# # API Options
# api_addr: ":8090"

8
protocol/hls/hls.go

@ -53,7 +53,13 @@ func (server *Server) Serve(listener net.Listener) error { @@ -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
}

Loading…
Cancel
Save