12 changed files with 91 additions and 71 deletions
@ -1,10 +0,0 @@ |
|||||||
package core |
|
||||||
|
|
||||||
import ( |
|
||||||
"github.com/gin-gonic/gin" |
|
||||||
) |
|
||||||
|
|
||||||
func httpServerHeaderMiddleware(ctx *gin.Context) { |
|
||||||
ctx.Writer.Header().Set("Server", "mediamtx") |
|
||||||
ctx.Next() |
|
||||||
} |
|
@ -1,15 +0,0 @@ |
|||||||
package core |
|
||||||
|
|
||||||
import ( |
|
||||||
"github.com/gin-gonic/gin" |
|
||||||
|
|
||||||
"github.com/bluenviron/mediamtx/internal/conf" |
|
||||||
) |
|
||||||
|
|
||||||
func httpSetTrustedProxies(router *gin.Engine, trustedProxies conf.IPsOrCIDRs) { |
|
||||||
tmp := make([]string, len(trustedProxies)) |
|
||||||
for i, entry := range trustedProxies { |
|
||||||
tmp[i] = entry.String() |
|
||||||
} |
|
||||||
router.SetTrustedProxies(tmp) |
|
||||||
} |
|
@ -0,0 +1,11 @@ |
|||||||
|
package httpserv |
||||||
|
|
||||||
|
import ( |
||||||
|
"github.com/gin-gonic/gin" |
||||||
|
) |
||||||
|
|
||||||
|
// MiddlewareServerHeader is a middleware that sets the Server header.
|
||||||
|
func MiddlewareServerHeader(ctx *gin.Context) { |
||||||
|
ctx.Writer.Header().Set("Server", "mediamtx") |
||||||
|
ctx.Next() |
||||||
|
} |
Loading…
Reference in new issue