diff --git a/go.mod b/go.mod index 83b4f264..b39c86ae 100644 --- a/go.mod +++ b/go.mod @@ -3,20 +3,22 @@ module github.com/langhuihui/monibuca go 1.16 require ( - github.com/Monibuca/engine/v3 v3.3.6 - github.com/Monibuca/plugin-gateway/v3 v3.0.0-20210822074036-b8c3fa9424cd - github.com/Monibuca/plugin-gb28181/v3 v3.0.0-20210825014341-4e25222df81e + github.com/Monibuca/engine/v3 v3.3.7 + github.com/Monibuca/plugin-gateway/v3 v3.0.0-20211007125400-7bb43ea85dc9 + github.com/Monibuca/plugin-gb28181/v3 v3.0.0-20211009015954-97d65b9710c3 github.com/Monibuca/plugin-hdl/v3 v3.0.0-20210807135828-9d98f5b8dd6c github.com/Monibuca/plugin-hls/v3 v3.0.0-20210821065544-cb61e2220aac github.com/Monibuca/plugin-jessica/v3 v3.0.0-20210807235919-48ac5fbec646 github.com/Monibuca/plugin-logrotate/v3 v3.0.0-20210710104346-3db68431dcab github.com/Monibuca/plugin-record/v3 v3.0.0-20210813073316-79dce1e0dc70 github.com/Monibuca/plugin-rtmp/v3 v3.0.0-20210819063901-526f2917b16d - github.com/Monibuca/plugin-rtsp/v3 v3.0.0-20210808000722-f267b1ca527b + github.com/Monibuca/plugin-rtsp/v3 v3.0.0-20211011074050-bbd668796ef3 github.com/Monibuca/plugin-summary v0.0.0-20210821070131-2261e0efb7b9 github.com/Monibuca/plugin-ts/v3 v3.0.0-20210710125303-3fb5757b7c5b github.com/Monibuca/plugin-webrtc/v3 v3.0.0-20210817013155-6993496f6d3c ) +//replace github.com/Monibuca/plugin-gateway/v3 => ../plugin-gateway + // replace github.com/Monibuca/engine/v3 => ../engine // replace github.com/Monibuca/plugin-summary => ../plugin-summary diff --git a/go.sum b/go.sum index 1fee9c61..00a548a8 100644 --- a/go.sum +++ b/go.sum @@ -5,26 +5,14 @@ github.com/Monibuca/engine/v3 v3.1.0/go.mod h1:yz6cssED2VlYu+g/LrxseBB9pcvsLM/o2 github.com/Monibuca/engine/v3 v3.1.1/go.mod h1:yz6cssED2VlYu+g/LrxseBB9pcvsLM/o2QXa4gVY650= github.com/Monibuca/engine/v3 v3.2.3/go.mod h1:odyqD/VTQDN4qgzajsgn7kW7MWDIzTHt+j+BcI8i+4g= github.com/Monibuca/engine/v3 v3.3.0/go.mod h1:odyqD/VTQDN4qgzajsgn7kW7MWDIzTHt+j+BcI8i+4g= -github.com/Monibuca/engine/v3 v3.3.2 h1:IzzrAWhg8BZgUsa77GbGvjnf7NSSsF8bMs5i6hBia/w= -github.com/Monibuca/engine/v3 v3.3.2/go.mod h1:odyqD/VTQDN4qgzajsgn7kW7MWDIzTHt+j+BcI8i+4g= -github.com/Monibuca/engine/v3 v3.3.4 h1:bTCWxx5qnyt9a6+mZo/5fu0PmbyFF//NAt0bmM6D+hU= -github.com/Monibuca/engine/v3 v3.3.4/go.mod h1:odyqD/VTQDN4qgzajsgn7kW7MWDIzTHt+j+BcI8i+4g= -github.com/Monibuca/engine/v3 v3.3.6 h1:5mWkfl4HJEymj3IHnGSqx3hpHvSFRlIizsQyH6A3EFQ= -github.com/Monibuca/engine/v3 v3.3.6/go.mod h1:odyqD/VTQDN4qgzajsgn7kW7MWDIzTHt+j+BcI8i+4g= -github.com/Monibuca/plugin-gateway/v3 v3.0.0-20210820143202-ef17974159c4 h1:QpJZpjVgpo1+ukviJh1djepx3N/s5ZdPvYyC0RlEntc= -github.com/Monibuca/plugin-gateway/v3 v3.0.0-20210820143202-ef17974159c4/go.mod h1:bDI6d64yb50+3rMczouVQoTYWbGOZhVFgu3k/yKJdXU= -github.com/Monibuca/plugin-gateway/v3 v3.0.0-20210822074036-b8c3fa9424cd h1:XJyUxnGW/4BODj8vzeDPGjqjWBuEF6qXdhP7ayxwpLc= -github.com/Monibuca/plugin-gateway/v3 v3.0.0-20210822074036-b8c3fa9424cd/go.mod h1:bDI6d64yb50+3rMczouVQoTYWbGOZhVFgu3k/yKJdXU= -github.com/Monibuca/plugin-gb28181/v3 v3.0.0-20210810033348-cb10ae14bfdd h1:fzcXnNYjLCyHjo3g4LQHODzoLyzA8FdoyNkUw+6Eg7U= -github.com/Monibuca/plugin-gb28181/v3 v3.0.0-20210810033348-cb10ae14bfdd/go.mod h1:GOo5h5svtdYJnqKH1WtZx02p9wGIoWEMpLht8RTHQEc= -github.com/Monibuca/plugin-gb28181/v3 v3.0.0-20210822073246-2f7a6e617d01 h1:rbmlC/fCkAmfel94gR1YJowpdYZIX/ZCGae4DM2PpO4= -github.com/Monibuca/plugin-gb28181/v3 v3.0.0-20210822073246-2f7a6e617d01/go.mod h1:WvMoRJ8SfGctwtx/9jvY6s5FPJanJSxtfW3+A1TR1E0= -github.com/Monibuca/plugin-gb28181/v3 v3.0.0-20210825014341-4e25222df81e h1:+4oSbhw4/FOAK/NaVLtLxljPLqZx3Q6cJrpAM61Yc4A= -github.com/Monibuca/plugin-gb28181/v3 v3.0.0-20210825014341-4e25222df81e/go.mod h1:WvMoRJ8SfGctwtx/9jvY6s5FPJanJSxtfW3+A1TR1E0= +github.com/Monibuca/engine/v3 v3.3.7 h1:EB77gSzvu4ThRWcWBWPmqWcCmMqC4B21/sUQmf/i2XU= +github.com/Monibuca/engine/v3 v3.3.7/go.mod h1:odyqD/VTQDN4qgzajsgn7kW7MWDIzTHt+j+BcI8i+4g= +github.com/Monibuca/plugin-gateway/v3 v3.0.0-20211007125400-7bb43ea85dc9 h1:6bSg16Jmml8Fpofu9hPPzXjKaN8HXdux6eXt5RNprqE= +github.com/Monibuca/plugin-gateway/v3 v3.0.0-20211007125400-7bb43ea85dc9/go.mod h1:bDI6d64yb50+3rMczouVQoTYWbGOZhVFgu3k/yKJdXU= +github.com/Monibuca/plugin-gb28181/v3 v3.0.0-20211009015954-97d65b9710c3 h1:KouylijcQ/vfobxLJZmaM2/vfXzHHHV+0tkajIEgLOo= +github.com/Monibuca/plugin-gb28181/v3 v3.0.0-20211009015954-97d65b9710c3/go.mod h1:WvMoRJ8SfGctwtx/9jvY6s5FPJanJSxtfW3+A1TR1E0= github.com/Monibuca/plugin-hdl/v3 v3.0.0-20210807135828-9d98f5b8dd6c h1:crcVwFF4qW8b3UoucGIK+wG0U03cx7numcI+bkRV9ng= github.com/Monibuca/plugin-hdl/v3 v3.0.0-20210807135828-9d98f5b8dd6c/go.mod h1:T4LdSfJIAMqmvmy9lXUL1RJ73JvhSBH2RdMKvs4N858= -github.com/Monibuca/plugin-hls/v3 v3.0.0-20210816130143-30255c2cc047 h1:o0vQ/UEvB7Is3XvFsrhQts1duzI5YVZfGfnK3f6GeNo= -github.com/Monibuca/plugin-hls/v3 v3.0.0-20210816130143-30255c2cc047/go.mod h1:Hlxpv0GFAwC0gy71U1Hku5Fs/I1VEd/N4IX+cVavz9o= github.com/Monibuca/plugin-hls/v3 v3.0.0-20210821065544-cb61e2220aac h1:PtI1vGH3qZOXT0GnyMdvU+gmkXtJHnEtjHPjpbkrZTQ= github.com/Monibuca/plugin-hls/v3 v3.0.0-20210821065544-cb61e2220aac/go.mod h1:Hlxpv0GFAwC0gy71U1Hku5Fs/I1VEd/N4IX+cVavz9o= github.com/Monibuca/plugin-jessica/v3 v3.0.0-20210807235919-48ac5fbec646 h1:wfge6Eakjoh+j6kRb8JlTazLWImWVbRqAVB/FlB4nHk= @@ -35,10 +23,8 @@ github.com/Monibuca/plugin-record/v3 v3.0.0-20210813073316-79dce1e0dc70 h1:NO3NL github.com/Monibuca/plugin-record/v3 v3.0.0-20210813073316-79dce1e0dc70/go.mod h1:CusWmmgSjE1rRaGO9O06LOvXSpKilfiFgRsUlYHvFq0= github.com/Monibuca/plugin-rtmp/v3 v3.0.0-20210819063901-526f2917b16d h1:6NQ6KaQyvyS9e5ELmQzKF0gmGx0wzotsWpIqhe5X748= github.com/Monibuca/plugin-rtmp/v3 v3.0.0-20210819063901-526f2917b16d/go.mod h1:dYR+AnljA8fGh29tmojgP1r+/MA+Bfwgpt2UsBD4wnM= -github.com/Monibuca/plugin-rtsp/v3 v3.0.0-20210808000722-f267b1ca527b h1:NXf3xctpa3AluaVINdJTwWkilgVYAzlHF9DMNrX6n84= -github.com/Monibuca/plugin-rtsp/v3 v3.0.0-20210808000722-f267b1ca527b/go.mod h1:jXXib77eJyWtddeZ46LSi/6l9n+E8OkvrqGMcPQGeZc= -github.com/Monibuca/plugin-summary v0.0.0-20210710132803-53cdcef14699 h1:XV+JSOS+iyJsnB+sTDWtxhIetOCa8fLOVFC2r3KcvoU= -github.com/Monibuca/plugin-summary v0.0.0-20210710132803-53cdcef14699/go.mod h1:1kiDXMF82y299q2+KKEeaKRpQFvVkiGAIGg8OhYk9Qk= +github.com/Monibuca/plugin-rtsp/v3 v3.0.0-20211011074050-bbd668796ef3 h1:u487yxglRQM1cahqwUzFDMgP8HJfY47mBDRuDOE0JTk= +github.com/Monibuca/plugin-rtsp/v3 v3.0.0-20211011074050-bbd668796ef3/go.mod h1:jXXib77eJyWtddeZ46LSi/6l9n+E8OkvrqGMcPQGeZc= github.com/Monibuca/plugin-summary v0.0.0-20210821070131-2261e0efb7b9 h1:8JVquYo8PUQtc75vFa8ovPvsXSmU0N2twfD+8hOoZeM= github.com/Monibuca/plugin-summary v0.0.0-20210821070131-2261e0efb7b9/go.mod h1:1kiDXMF82y299q2+KKEeaKRpQFvVkiGAIGg8OhYk9Qk= github.com/Monibuca/plugin-ts/v3 v3.0.0-20210710125303-3fb5757b7c5b h1:rGxDDb1Evkdzgmdqm1x5MCw6QtkGr7N6mgOBHqxZNnU= diff --git a/main.go b/main.go index 9e2c0057..72ab7636 100644 --- a/main.go +++ b/main.go @@ -30,18 +30,19 @@ import ( func main() { addr := flag.String("c", "config.toml", "config file") flag.Parse() + ctx, cancel := context.WithCancel(context.Background()) if _, err := os.Stat(*addr); err == nil { - Run(*addr) + Run(ctx, *addr) } else { - Run(filepath.Join(filepath.Dir(os.Args[0]), *addr)) + Run(ctx, filepath.Join(filepath.Dir(os.Args[0]), *addr)) } - waiter(context.Background()) + waiter(cancel) } -func waiter(ctx context.Context) { +func waiter(cancel context.CancelFunc) { sigc := make(chan os.Signal, 1) signal.Notify(sigc, syscall.SIGINT, syscall.SIGTERM) defer signal.Stop(sigc) <-sigc - ctx.Done() + cancel() }