diff --git a/go.mod b/go.mod index 2e7e4aeb..67a067eb 100644 --- a/go.mod +++ b/go.mod @@ -7,8 +7,8 @@ require ( github.com/abema/go-mp4 v1.1.1 github.com/alecthomas/kong v0.8.1 github.com/aler9/writerseeker v1.1.0 - github.com/bluenviron/gohlslib v1.0.4 - github.com/bluenviron/gortsplib/v4 v4.4.0 + github.com/bluenviron/gohlslib v1.0.5 + github.com/bluenviron/gortsplib/v4 v4.5.0 github.com/bluenviron/mediacommon v1.5.0 github.com/datarhei/gosrt v0.5.4 github.com/fsnotify/fsnotify v1.7.0 @@ -65,7 +65,7 @@ require ( github.com/ugorji/go/codec v1.2.11 // indirect github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 // indirect golang.org/x/arch v0.3.0 // indirect - golang.org/x/net v0.17.0 // indirect + golang.org/x/net v0.18.0 // indirect golang.org/x/sys v0.14.0 // indirect golang.org/x/text v0.14.0 // indirect google.golang.org/protobuf v1.30.0 // indirect diff --git a/go.sum b/go.sum index e45777f3..cea1f615 100644 --- a/go.sum +++ b/go.sum @@ -22,10 +22,10 @@ github.com/asticode/go-astits v1.13.0 h1:XOgkaadfZODnyZRR5Y0/DWkA9vrkLLPLeeOvDwf github.com/asticode/go-astits v1.13.0/go.mod h1:QSHmknZ51pf6KJdHKZHJTLlMegIrhega3LPWz3ND/iI= github.com/benburkert/openpgp v0.0.0-20160410205803-c2471f86866c h1:8XZeJrs4+ZYhJeJ2aZxADI2tGADS15AzIF8MQ8XAhT4= github.com/benburkert/openpgp v0.0.0-20160410205803-c2471f86866c/go.mod h1:x1vxHcL/9AVzuk5HOloOEPrtJY0MaalYr78afXZ+pWI= -github.com/bluenviron/gohlslib v1.0.4 h1:cNpNQSPzomM7fqSaGPbdRxpq5QtI3b0vjT3nWQ5/LrU= -github.com/bluenviron/gohlslib v1.0.4/go.mod h1:yMw/Gm+SeC498fHc7DnqKvczTMZGBdJdJUmAM+k+pu0= -github.com/bluenviron/gortsplib/v4 v4.4.0 h1:6dP2MtADHXgnRcxfred+wFjsjyCqfFnh/x6crhV2g00= -github.com/bluenviron/gortsplib/v4 v4.4.0/go.mod h1:4XBcXsbK4MDFqnraexSDeKj++ZzrSd81CVplSpSNqKk= +github.com/bluenviron/gohlslib v1.0.5 h1:AZsNdMI2ZvPHE0Yi3ZjGJO7DGhBh4bZAYgiGocYYPWs= +github.com/bluenviron/gohlslib v1.0.5/go.mod h1:yMw/Gm+SeC498fHc7DnqKvczTMZGBdJdJUmAM+k+pu0= +github.com/bluenviron/gortsplib/v4 v4.5.0 h1:bTF244GOx5GVwfwA4vYYDNoAql9c9/WhfBPqGc3pH20= +github.com/bluenviron/gortsplib/v4 v4.5.0/go.mod h1:hb4lwJ+LMLfk0YbImTIrWLA8u3yWj77z4nzv2kxYLdk= github.com/bluenviron/mediacommon v1.5.0 h1:lS0YKNo22ZOyCsYcLh3jn3TgUALqYw0f7RVwalC09vI= github.com/bluenviron/mediacommon v1.5.0/go.mod h1:Ij/kE1LEucSjryNBVTyPL/gBI0d6/Css3f5PyrM957w= github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM= @@ -224,8 +224,8 @@ golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.11.0/go.mod h1:2L/ixqYpgIVXmeoSA/4Lu7BzTG4KIyPIryS4IsOd1oQ= golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= -golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/net v0.18.0 h1:mIYleuAkSbHh0tCv7RvjL3F6ZVbLjq4+R7zbOn3Kokg= +golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= diff --git a/internal/conf/path.go b/internal/conf/path.go index 5f01746b..82b240ae 100644 --- a/internal/conf/path.go +++ b/internal/conf/path.go @@ -10,8 +10,8 @@ import ( "strings" "time" + "github.com/bluenviron/gortsplib/v4/pkg/base" "github.com/bluenviron/gortsplib/v4/pkg/headers" - "github.com/bluenviron/gortsplib/v4/pkg/url" ) var rePathName = regexp.MustCompile(`^[0-9a-zA-Z_\-/\.~]+$`) @@ -244,7 +244,7 @@ func (pconf *Path) check(conf *Conf, name string) error { return fmt.Errorf("a path with a regular expression (or path 'all') cannot have a RTSP source. use another path") } - _, err := url.Parse(pconf.Source) + _, err := base.ParseURL(pconf.Source) if err != nil { return fmt.Errorf("'%s' is not a valid URL", pconf.Source) } @@ -398,7 +398,7 @@ func (pconf *Path) check(conf *Conf, name string) error { return fmt.Errorf("'%s': %s", pconf.Fallback, err) } } else { - _, err := url.Parse(pconf.Fallback) + _, err := base.ParseURL(pconf.Fallback) if err != nil { return fmt.Errorf("'%s' is not a valid RTSP URL", pconf.Fallback) } @@ -431,7 +431,7 @@ func (pconf *Path) check(conf *Conf, name string) error { return fmt.Errorf("source redirect must be filled") } - _, err := url.Parse(pconf.SourceRedirect) + _, err := base.ParseURL(pconf.SourceRedirect) if err != nil { return fmt.Errorf("'%s' is not a valid RTSP URL", pconf.SourceRedirect) } diff --git a/internal/core/path.go b/internal/core/path.go index 62ac397f..f6b70aba 100644 --- a/internal/core/path.go +++ b/internal/core/path.go @@ -11,7 +11,6 @@ import ( "github.com/bluenviron/gortsplib/v4/pkg/base" "github.com/bluenviron/gortsplib/v4/pkg/description" - "github.com/bluenviron/gortsplib/v4/pkg/url" "github.com/google/uuid" "github.com/bluenviron/mediamtx/internal/conf" @@ -66,7 +65,7 @@ type pathAccessRequest struct { proto authProtocol id *uuid.UUID rtspRequest *base.Request - rtspBaseURL *url.URL + rtspBaseURL *base.URL rtspNonce string } @@ -555,7 +554,7 @@ func (pa *path) doDescribe(req pathDescribeReq) { if pa.conf.Fallback != "" { fallbackURL := func() string { if strings.HasPrefix(pa.conf.Fallback, "/") { - ur := url.URL{ + ur := base.URL{ Scheme: req.accessRequest.rtspRequest.URL.Scheme, User: req.accessRequest.rtspRequest.URL.User, Host: req.accessRequest.rtspRequest.URL.Host, diff --git a/internal/core/path_manager_test.go b/internal/core/path_manager_test.go index 4542fae8..dcb062f3 100644 --- a/internal/core/path_manager_test.go +++ b/internal/core/path_manager_test.go @@ -7,7 +7,6 @@ import ( "github.com/bluenviron/gortsplib/v4/pkg/base" "github.com/bluenviron/gortsplib/v4/pkg/headers" - "github.com/bluenviron/gortsplib/v4/pkg/url" "github.com/stretchr/testify/require" ) @@ -26,7 +25,7 @@ func TestPathAutoDeletion(t *testing.T) { br := bufio.NewReader(conn) if ca == "describe" { - u, err := url.Parse("rtsp://localhost:8554/mypath") + u, err := base.ParseURL("rtsp://localhost:8554/mypath") require.NoError(t, err) byts, _ := base.Request{ @@ -44,7 +43,7 @@ func TestPathAutoDeletion(t *testing.T) { require.NoError(t, err) require.Equal(t, base.StatusNotFound, res.StatusCode) } else { - u, err := url.Parse("rtsp://localhost:8554/mypath/trackID=0") + u, err := base.ParseURL("rtsp://localhost:8554/mypath/trackID=0") require.NoError(t, err) byts, _ := base.Request{ diff --git a/internal/core/path_test.go b/internal/core/path_test.go index ae1d4fb4..6baf0db6 100644 --- a/internal/core/path_test.go +++ b/internal/core/path_test.go @@ -19,7 +19,6 @@ import ( "github.com/bluenviron/gortsplib/v4/pkg/description" "github.com/bluenviron/gortsplib/v4/pkg/headers" "github.com/bluenviron/gortsplib/v4/pkg/sdp" - rtspurl "github.com/bluenviron/gortsplib/v4/pkg/url" "github.com/datarhei/gosrt" "github.com/pion/rtp" "github.com/stretchr/testify/require" @@ -126,7 +125,7 @@ func TestPathRunOnDemand(t *testing.T) { br := bufio.NewReader(conn) if ca == "describe" || ca == "describe and setup" { - u, err := rtspurl.Parse("rtsp://localhost:8554/ondemand?param=value") + u, err := base.ParseURL("rtsp://localhost:8554/ondemand?param=value") require.NoError(t, err) byts, _ := base.Request{ @@ -153,7 +152,7 @@ func TestPathRunOnDemand(t *testing.T) { } if ca == "setup" || ca == "describe and setup" { - u, err := rtspurl.Parse(control) + u, err := base.ParseURL(control) require.NoError(t, err) byts, _ := base.Request{ @@ -328,7 +327,7 @@ func TestPathRunOnRead(t *testing.T) { case "rtsp": reader := gortsplib.Client{} - u, err := rtspurl.Parse("rtsp://127.0.0.1:8554/test?query=value") + u, err := base.ParseURL("rtsp://127.0.0.1:8554/test?query=value") require.NoError(t, err) err = reader.Start(u.Scheme, u.Host) @@ -428,7 +427,7 @@ func TestPathMaxReaders(t *testing.T) { for i := 0; i < 2; i++ { reader := gortsplib.Client{} - u, err := rtspurl.Parse("rtsp://127.0.0.1:8554/mystream") + u, err := base.ParseURL("rtsp://127.0.0.1:8554/mystream") require.NoError(t, err) err = reader.Start(u.Scheme, u.Host) diff --git a/internal/core/rtsp_server_test.go b/internal/core/rtsp_server_test.go index ea64ad7d..7efebe79 100644 --- a/internal/core/rtsp_server_test.go +++ b/internal/core/rtsp_server_test.go @@ -4,8 +4,8 @@ import ( "testing" "github.com/bluenviron/gortsplib/v4" + "github.com/bluenviron/gortsplib/v4/pkg/base" "github.com/bluenviron/gortsplib/v4/pkg/description" - "github.com/bluenviron/gortsplib/v4/pkg/url" "github.com/pion/rtp" "github.com/stretchr/testify/require" ) @@ -70,7 +70,7 @@ func TestRTSPServer(t *testing.T) { reader := gortsplib.Client{} - u, err := url.Parse("rtsp://testreader:testpass@127.0.0.1:8554/teststream?param=value") + u, err := base.ParseURL("rtsp://testreader:testpass@127.0.0.1:8554/teststream?param=value") require.NoError(t, err) err = reader.Start(u.Scheme, u.Host) @@ -191,7 +191,7 @@ func TestRTSPServerAuthFail(t *testing.T) { c := gortsplib.Client{} - u, err := url.Parse("rtsp://" + ca.user + ":" + ca.pass + "@localhost:8554/test/stream") + u, err := base.ParseURL("rtsp://" + ca.user + ":" + ca.pass + "@localhost:8554/test/stream") require.NoError(t, err) err = c.Start(u.Scheme, u.Host) @@ -288,7 +288,7 @@ func TestRTSPServerPublisherOverride(t *testing.T) { c := gortsplib.Client{} - u, err := url.Parse("rtsp://localhost:8554/teststream") + u, err := base.ParseURL("rtsp://localhost:8554/teststream") require.NoError(t, err) err = c.Start(u.Scheme, u.Host) @@ -378,7 +378,7 @@ func TestRTSPServerFallback(t *testing.T) { require.NoError(t, err) defer source.Close() - u, err := url.Parse("rtsp://localhost:8554/path1") + u, err := base.ParseURL("rtsp://localhost:8554/path1") require.NoError(t, err) dest := gortsplib.Client{} diff --git a/internal/core/rtsp_session.go b/internal/core/rtsp_session.go index 0cf791c1..715b6b88 100644 --- a/internal/core/rtsp_session.go +++ b/internal/core/rtsp_session.go @@ -10,7 +10,6 @@ import ( "github.com/bluenviron/gortsplib/v4" "github.com/bluenviron/gortsplib/v4/pkg/auth" "github.com/bluenviron/gortsplib/v4/pkg/base" - "github.com/bluenviron/gortsplib/v4/pkg/url" "github.com/google/uuid" "github.com/pion/rtp" @@ -199,7 +198,7 @@ func (s *rtspSession) onSetup(c *rtspConn, ctx *gortsplib.ServerHandlerOnSetupCt switch s.session.State() { case gortsplib.ServerSessionStateInitial, gortsplib.ServerSessionStatePrePlay: // play - baseURL := &url.URL{ + baseURL := &base.URL{ Scheme: ctx.Request.URL.Scheme, Host: ctx.Request.URL.Host, Path: ctx.Path, diff --git a/internal/core/webrtc_manager_test.go b/internal/core/webrtc_manager_test.go index fd7b57ee..72ed4f49 100644 --- a/internal/core/webrtc_manager_test.go +++ b/internal/core/webrtc_manager_test.go @@ -9,9 +9,9 @@ import ( "time" "github.com/bluenviron/gortsplib/v4" + "github.com/bluenviron/gortsplib/v4/pkg/base" "github.com/bluenviron/gortsplib/v4/pkg/description" "github.com/bluenviron/gortsplib/v4/pkg/format" - rtspurl "github.com/bluenviron/gortsplib/v4/pkg/url" "github.com/pion/rtp" pwebrtc "github.com/pion/webrtc/v3" "github.com/stretchr/testify/require" @@ -317,7 +317,7 @@ func TestWebRTCPublish(t *testing.T) { }, } - u, err := rtspurl.Parse("rtsp://testreader:testpass@127.0.0.1:8554/teststream?param=value") + u, err := base.ParseURL("rtsp://testreader:testpass@127.0.0.1:8554/teststream?param=value") require.NoError(t, err) err = c.Start(u.Scheme, u.Host) diff --git a/internal/staticsources/rtsp/source.go b/internal/staticsources/rtsp/source.go index 4c7debd8..3ad612ab 100644 --- a/internal/staticsources/rtsp/source.go +++ b/internal/staticsources/rtsp/source.go @@ -9,7 +9,6 @@ import ( "github.com/bluenviron/gortsplib/v4/pkg/headers" "github.com/pion/rtp" - "github.com/bluenviron/gortsplib/v4/pkg/url" "github.com/bluenviron/mediamtx/internal/conf" "github.com/bluenviron/mediamtx/internal/defs" "github.com/bluenviron/mediamtx/internal/logger" @@ -104,7 +103,7 @@ func (s *Source) Run(params defs.StaticSourceRunParams) error { }, } - u, err := url.Parse(params.Conf.Source) + u, err := base.ParseURL(params.Conf.Source) if err != nil { return err }