rename httpserv into httpp (#3014)

This commit is contained in:
Alessandro Ros 2024-02-13 13:04:56 +01:00 committed by GitHub
parent 487f92ac55
commit 3161e73a58
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 35 additions and 35 deletions

View File

@ -20,7 +20,7 @@ import (
"github.com/bluenviron/mediamtx/internal/conf"
"github.com/bluenviron/mediamtx/internal/defs"
"github.com/bluenviron/mediamtx/internal/logger"
"github.com/bluenviron/mediamtx/internal/protocols/httpserv"
"github.com/bluenviron/mediamtx/internal/protocols/httpp"
"github.com/bluenviron/mediamtx/internal/record"
"github.com/bluenviron/mediamtx/internal/restrictnetwork"
"github.com/bluenviron/mediamtx/internal/servers/hls"
@ -169,7 +169,7 @@ type API struct {
SRTServer SRTServer
Parent apiParent
httpServer *httpserv.WrappedServer
httpServer *httpp.WrappedServer
mutex sync.RWMutex
}
@ -248,7 +248,7 @@ func (a *API) Initialize() error {
network, address := restrictnetwork.Restrict("tcp", a.Address)
var err error
a.httpServer, err = httpserv.NewWrappedServer(
a.httpServer, err = httpp.NewWrappedServer(
network,
address,
time.Duration(a.ReadTimeout),

View File

@ -14,7 +14,7 @@ import (
"github.com/bluenviron/mediamtx/internal/api"
"github.com/bluenviron/mediamtx/internal/conf"
"github.com/bluenviron/mediamtx/internal/logger"
"github.com/bluenviron/mediamtx/internal/protocols/httpserv"
"github.com/bluenviron/mediamtx/internal/protocols/httpp"
"github.com/bluenviron/mediamtx/internal/restrictnetwork"
)
@ -36,7 +36,7 @@ type Metrics struct {
ReadTimeout conf.StringDuration
Parent metricsParent
httpServer *httpserv.WrappedServer
httpServer *httpp.WrappedServer
mutex sync.Mutex
pathManager api.PathManager
rtspServer api.RTSPServer
@ -58,7 +58,7 @@ func (m *Metrics) Initialize() error {
network, address := restrictnetwork.Restrict("tcp", m.Address)
var err error
m.httpServer, err = httpserv.NewWrappedServer(
m.httpServer, err = httpp.NewWrappedServer(
network,
address,
time.Duration(m.ReadTimeout),

View File

@ -12,7 +12,7 @@ import (
"github.com/bluenviron/mediamtx/internal/conf"
"github.com/bluenviron/mediamtx/internal/logger"
"github.com/bluenviron/mediamtx/internal/protocols/httpserv"
"github.com/bluenviron/mediamtx/internal/protocols/httpp"
"github.com/bluenviron/mediamtx/internal/restrictnetwork"
"github.com/gin-gonic/gin"
)
@ -59,7 +59,7 @@ type Server struct {
PathConfs map[string]*conf.Path
Parent logger.Writer
httpServer *httpserv.WrappedServer
httpServer *httpp.WrappedServer
mutex sync.RWMutex
}
@ -76,7 +76,7 @@ func (p *Server) Initialize() error {
network, address := restrictnetwork.Restrict("tcp", p.Address)
var err error
p.httpServer, err = httpserv.NewWrappedServer(
p.httpServer, err = httpp.NewWrappedServer(
network,
address,
time.Duration(p.ReadTimeout),

View File

@ -10,7 +10,7 @@ import (
"github.com/bluenviron/mediamtx/internal/conf"
"github.com/bluenviron/mediamtx/internal/logger"
"github.com/bluenviron/mediamtx/internal/protocols/httpserv"
"github.com/bluenviron/mediamtx/internal/protocols/httpp"
"github.com/bluenviron/mediamtx/internal/restrictnetwork"
)
@ -24,7 +24,7 @@ type PPROF struct {
ReadTimeout conf.StringDuration
Parent pprofParent
httpServer *httpserv.WrappedServer
httpServer *httpp.WrappedServer
}
// Initialize initializes PPROF.
@ -32,7 +32,7 @@ func (pp *PPROF) Initialize() error {
network, address := restrictnetwork.Restrict("tcp", pp.Address)
var err error
pp.httpServer, err = httpserv.NewWrappedServer(
pp.httpServer, err = httpp.NewWrappedServer(
network,
address,
time.Duration(pp.ReadTimeout),

View File

@ -1,4 +1,4 @@
package httpserv
package httpp
import (
"fmt"

View File

@ -1,4 +1,4 @@
package httpserv
package httpp
import (
"net/http"

View File

@ -1,4 +1,4 @@
package httpserv
package httpp
import (
"bytes"

View File

@ -1,4 +1,4 @@
package httpserv
package httpp
import (
"net/http"

View File

@ -1,4 +1,4 @@
package httpserv
package httpp
import (
"net"

View File

@ -1,5 +1,5 @@
// Package httpserv contains HTTP server utilities.
package httpserv
// Package httpp contains HTTP utilities.
package httpp
import (
"context"

View File

@ -1,4 +1,4 @@
package httpserv
package httpp
import (
"io"

View File

@ -15,7 +15,7 @@ import (
"github.com/bluenviron/mediamtx/internal/conf"
"github.com/bluenviron/mediamtx/internal/defs"
"github.com/bluenviron/mediamtx/internal/logger"
"github.com/bluenviron/mediamtx/internal/protocols/httpserv"
"github.com/bluenviron/mediamtx/internal/protocols/httpp"
"github.com/bluenviron/mediamtx/internal/restrictnetwork"
)
@ -43,7 +43,7 @@ type httpServer struct {
pathManager defs.PathManager
parent *Server
inner *httpserv.WrappedServer
inner *httpp.WrappedServer
}
func (s *httpServer) initialize() error {
@ -64,7 +64,7 @@ func (s *httpServer) initialize() error {
network, address := restrictnetwork.Restrict("tcp", s.address)
var err error
s.inner, err = httpserv.NewWrappedServer(
s.inner, err = httpp.NewWrappedServer(
network,
address,
time.Duration(s.readTimeout),
@ -137,7 +137,7 @@ func (s *httpServer) onRequest(ctx *gin.Context) {
dir, fname = pa, ""
if !strings.HasSuffix(dir, "/") {
ctx.Writer.Header().Set("Location", httpserv.LocationWithTrailingSlash(ctx.Request.URL))
ctx.Writer.Header().Set("Location", httpp.LocationWithTrailingSlash(ctx.Request.URL))
ctx.Writer.WriteHeader(http.StatusMovedPermanently)
return
}
@ -170,7 +170,7 @@ func (s *httpServer) onRequest(ctx *gin.Context) {
return
}
s.Log(logger.Info, "connection %v failed to authenticate: %v", httpserv.RemoteAddr(ctx), terr.Message)
s.Log(logger.Info, "connection %v failed to authenticate: %v", httpp.RemoteAddr(ctx), terr.Message)
// wait some seconds to mitigate brute force attacks
<-time.After(pauseAfterAuthError)

View File

@ -11,7 +11,7 @@ import (
"github.com/bluenviron/mediamtx/internal/conf"
"github.com/bluenviron/mediamtx/internal/defs"
"github.com/bluenviron/mediamtx/internal/logger"
"github.com/bluenviron/mediamtx/internal/protocols/httpserv"
"github.com/bluenviron/mediamtx/internal/protocols/httpp"
)
// ErrMuxerNotFound is returned when a muxer is not found.
@ -154,7 +154,7 @@ outer:
r.processRequest(&req)
default:
r := s.createMuxer(req.path, httpserv.RemoteAddr(req.ctx))
r := s.createMuxer(req.path, httpp.RemoteAddr(req.ctx))
r.processRequest(&req)
}

View File

@ -17,7 +17,7 @@ import (
"github.com/bluenviron/mediamtx/internal/conf"
"github.com/bluenviron/mediamtx/internal/defs"
"github.com/bluenviron/mediamtx/internal/logger"
"github.com/bluenviron/mediamtx/internal/protocols/httpserv"
"github.com/bluenviron/mediamtx/internal/protocols/httpp"
"github.com/bluenviron/mediamtx/internal/protocols/webrtc"
"github.com/bluenviron/mediamtx/internal/restrictnetwork"
)
@ -61,7 +61,7 @@ type httpServer struct {
pathManager defs.PathManager
parent *Server
inner *httpserv.WrappedServer
inner *httpp.WrappedServer
}
func (s *httpServer) initialize() error {
@ -81,7 +81,7 @@ func (s *httpServer) initialize() error {
network, address := restrictnetwork.Restrict("tcp", s.address)
var err error
s.inner, err = httpserv.NewWrappedServer(
s.inner, err = httpp.NewWrappedServer(
network,
address,
time.Duration(s.readTimeout),
@ -129,7 +129,7 @@ func (s *httpServer) checkAuthOutsideSession(ctx *gin.Context, path string, publ
return false
}
s.Log(logger.Info, "connection %v failed to authenticate: %v", httpserv.RemoteAddr(ctx), terr.Message)
s.Log(logger.Info, "connection %v failed to authenticate: %v", httpp.RemoteAddr(ctx), terr.Message)
// wait some seconds to mitigate brute force attacks
<-time.After(pauseAfterAuthError)
@ -178,7 +178,7 @@ func (s *httpServer) onWHIPPost(ctx *gin.Context, path string, publish bool) {
res := s.parent.newSession(webRTCNewSessionReq{
pathName: path,
remoteAddr: httpserv.RemoteAddr(ctx),
remoteAddr: httpp.RemoteAddr(ctx),
query: ctx.Request.URL.RawQuery,
user: user,
pass: pass,
@ -330,7 +330,7 @@ func (s *httpServer) onRequest(ctx *gin.Context) {
s.onPage(ctx, ctx.Request.URL.Path[1:len(ctx.Request.URL.Path)-len("/publish")], true)
case ctx.Request.URL.Path[len(ctx.Request.URL.Path)-1] != '/':
ctx.Writer.Header().Set("Location", httpserv.LocationWithTrailingSlash(ctx.Request.URL))
ctx.Writer.Header().Set("Location", httpp.LocationWithTrailingSlash(ctx.Request.URL))
ctx.Writer.WriteHeader(http.StatusMovedPermanently)
default: