moq: rename moqHTTPS2Address into moqHTTP2Address, moqHTTPS3Address into moqHTTP3Address (#5841)
This commit is contained in:
+10
-2
@@ -609,9 +609,9 @@ components:
|
||||
# MoQ server
|
||||
moq:
|
||||
type: boolean
|
||||
moqHTTPS2Address:
|
||||
moqHTTP2Address:
|
||||
type: string
|
||||
moqHTTPS3Address:
|
||||
moqHTTP3Address:
|
||||
type: string
|
||||
moqServerKey:
|
||||
type: string
|
||||
@@ -625,6 +625,14 @@ components:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
moqHTTPS2Address:
|
||||
type: string
|
||||
nullable: true
|
||||
deprecated: true
|
||||
moqHTTPS3Address:
|
||||
type: string
|
||||
nullable: true
|
||||
deprecated: true
|
||||
|
||||
# Record (deprecated)
|
||||
record:
|
||||
|
||||
+18
-4
@@ -398,12 +398,14 @@ type Conf struct {
|
||||
|
||||
// MoQ server
|
||||
MoQ bool `json:"moq"`
|
||||
MoQHTTPS2Address string `json:"moqHTTPS2Address"`
|
||||
MoQHTTPS3Address string `json:"moqHTTPS3Address"`
|
||||
MoQHTTP2Address string `json:"moqHTTP2Address"`
|
||||
MoQHTTP3Address string `json:"moqHTTP3Address"`
|
||||
MoQServerKey string `json:"moqServerKey"`
|
||||
MoQServerCert string `json:"moqServerCert"`
|
||||
MoQAllowOrigins []string `json:"moqAllowOrigins"`
|
||||
MoQTrustedProxies IPNetworks `json:"moqTrustedProxies"`
|
||||
MoQHTTPS2Address *string `json:"moqHTTPS2Address,omitempty" deprecated:"true"`
|
||||
MoQHTTPS3Address *string `json:"moqHTTPS3Address,omitempty" deprecated:"true"`
|
||||
|
||||
// Record (deprecated)
|
||||
Record *bool `json:"record,omitempty" deprecated:"true"`
|
||||
@@ -535,8 +537,8 @@ func (conf *Conf) setDefaults() {
|
||||
|
||||
// MoQ server
|
||||
conf.MoQ = true
|
||||
conf.MoQHTTPS2Address = ":8892"
|
||||
conf.MoQHTTPS3Address = ":8892"
|
||||
conf.MoQHTTP2Address = ":8892"
|
||||
conf.MoQHTTP3Address = ":8892"
|
||||
conf.MoQServerKey = "auto.key"
|
||||
conf.MoQServerCert = "auto.crt"
|
||||
conf.MoQAllowOrigins = []string{"*"}
|
||||
@@ -1042,6 +1044,18 @@ func (conf *Conf) Validate(l logger.Writer) error {
|
||||
}
|
||||
}
|
||||
|
||||
if conf.MoQHTTPS2Address != nil {
|
||||
l.Log(logger.Warn, "parameter 'moqHTTPS2Address' is deprecated "+
|
||||
"and has been replaced with 'moqHTTP2Address'")
|
||||
conf.MoQHTTP2Address = *conf.MoQHTTPS2Address
|
||||
}
|
||||
|
||||
if conf.MoQHTTPS3Address != nil {
|
||||
l.Log(logger.Warn, "parameter 'moqHTTPS3Address' is deprecated "+
|
||||
"and has been replaced with 'moqHTTP3Address'")
|
||||
conf.MoQHTTP3Address = *conf.MoQHTTPS3Address
|
||||
}
|
||||
|
||||
// Record (deprecated)
|
||||
|
||||
if conf.Record != nil {
|
||||
|
||||
@@ -703,8 +703,8 @@ func (p *Core) createResources(initial bool) error {
|
||||
if p.conf.MoQ &&
|
||||
p.moqServer == nil {
|
||||
i := &moq.Server{
|
||||
HTTPS2Address: p.conf.MoQHTTPS2Address,
|
||||
HTTPS3Address: p.conf.MoQHTTPS3Address,
|
||||
HTTP2Address: p.conf.MoQHTTP2Address,
|
||||
HTTP3Address: p.conf.MoQHTTP3Address,
|
||||
ServerKey: p.conf.MoQServerKey,
|
||||
ServerCert: p.conf.MoQServerCert,
|
||||
AllowOrigins: p.conf.MoQAllowOrigins,
|
||||
@@ -1010,8 +1010,8 @@ func (p *Core) closeResources(newConf *conf.Conf, calledByAPI bool) {
|
||||
|
||||
closeMoQServer := newConf == nil ||
|
||||
newConf.MoQ != p.conf.MoQ ||
|
||||
newConf.MoQHTTPS2Address != p.conf.MoQHTTPS2Address ||
|
||||
newConf.MoQHTTPS3Address != p.conf.MoQHTTPS3Address ||
|
||||
newConf.MoQHTTP2Address != p.conf.MoQHTTP2Address ||
|
||||
newConf.MoQHTTP3Address != p.conf.MoQHTTP3Address ||
|
||||
newConf.MoQServerKey != p.conf.MoQServerKey ||
|
||||
newConf.MoQServerCert != p.conf.MoQServerCert ||
|
||||
!slices.Equal(newConf.MoQAllowOrigins, p.conf.MoQAllowOrigins) ||
|
||||
|
||||
@@ -86,8 +86,8 @@ type httpServerParent interface {
|
||||
}
|
||||
|
||||
type httpServer struct {
|
||||
https2Address string
|
||||
https3Address string
|
||||
http2Address string
|
||||
http3Address string
|
||||
serverCert string
|
||||
serverKey string
|
||||
allowOrigins []string
|
||||
@@ -98,18 +98,18 @@ type httpServer struct {
|
||||
pathManager serverPathManager
|
||||
parent httpServerParent
|
||||
|
||||
innerHTTPS2 *httpp.Server
|
||||
innerHTTPS3 *httpp3.Server
|
||||
innerHTTP2 *httpp.Server
|
||||
innerHTTP3 *httpp3.Server
|
||||
}
|
||||
|
||||
func (s *httpServer) initialize() error {
|
||||
routerHTTPS2 := gin.New()
|
||||
routerHTTPS2.SetTrustedProxies(s.trustedProxies.ToTrustedProxies()) //nolint:errcheck
|
||||
routerHTTPS2.Use(s.middlewarePreflightRequests)
|
||||
routerHTTPS2.Use(s.onRequestHTTPS2)
|
||||
routerHTTP2 := gin.New()
|
||||
routerHTTP2.SetTrustedProxies(s.trustedProxies.ToTrustedProxies()) //nolint:errcheck
|
||||
routerHTTP2.Use(s.middlewarePreflightRequests)
|
||||
routerHTTP2.Use(s.onRequestHTTPS2)
|
||||
|
||||
s.innerHTTPS2 = &httpp.Server{
|
||||
Address: s.https2Address,
|
||||
s.innerHTTP2 = &httpp.Server{
|
||||
Address: s.http2Address,
|
||||
AllowOrigins: s.allowOrigins,
|
||||
ReadTimeout: time.Duration(s.readTimeout),
|
||||
WriteTimeout: time.Duration(s.writeTimeout),
|
||||
@@ -117,27 +117,27 @@ func (s *httpServer) initialize() error {
|
||||
ServerKey: s.serverKey,
|
||||
ServerCert: s.serverCert,
|
||||
AllowAutoCert: true,
|
||||
Handler: routerHTTPS2,
|
||||
Handler: routerHTTP2,
|
||||
Parent: s,
|
||||
}
|
||||
err := s.innerHTTPS2.Initialize()
|
||||
err := s.innerHTTP2.Initialize()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
routerHTTPS3 := gin.New()
|
||||
routerHTTPS3.Use(s.onRequestHTTPS3)
|
||||
routerHTTP3 := gin.New()
|
||||
routerHTTP3.Use(s.onRequestHTTPS3)
|
||||
|
||||
s.innerHTTPS3 = &httpp3.Server{
|
||||
Address: s.https3Address,
|
||||
s.innerHTTP3 = &httpp3.Server{
|
||||
Address: s.http3Address,
|
||||
UDPReadBufferSize: s.udpReadBufferSize,
|
||||
EnableWebTransport: true,
|
||||
Handler: routerHTTPS3,
|
||||
Handler: routerHTTP3,
|
||||
Parent: s,
|
||||
}
|
||||
err = s.innerHTTPS3.Initialize()
|
||||
err = s.innerHTTP3.Initialize()
|
||||
if err != nil {
|
||||
s.innerHTTPS2.Close()
|
||||
s.innerHTTP2.Close()
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -150,8 +150,8 @@ func (s *httpServer) Log(level logger.Level, format string, args ...any) {
|
||||
}
|
||||
|
||||
func (s *httpServer) close() {
|
||||
s.innerHTTPS3.Close()
|
||||
s.innerHTTPS2.Close()
|
||||
s.innerHTTP3.Close()
|
||||
s.innerHTTP2.Close()
|
||||
}
|
||||
|
||||
func (s *httpServer) middlewarePreflightRequests(ctx *gin.Context) {
|
||||
@@ -245,7 +245,7 @@ func (s *httpServer) onAuthMirror(ctx *gin.Context) {
|
||||
}
|
||||
|
||||
func (s *httpServer) onFingerprint(ctx *gin.Context) {
|
||||
fp, err := certFingerprint(s.innerHTTPS3.Certificate())
|
||||
fp, err := certFingerprint(s.innerHTTP3.Certificate())
|
||||
if err != nil {
|
||||
s.writeErrorNoLog(ctx, http.StatusInternalServerError, err)
|
||||
return
|
||||
@@ -319,7 +319,7 @@ func (s *httpServer) onRequestHTTPS3(ctx *gin.Context) {
|
||||
w.Header().Set(wtProtocolHeader, `"`+moqtVersion+`"`)
|
||||
}
|
||||
|
||||
wt, err := s.innerHTTPS3.Upgrade(w, ctx.Request)
|
||||
wt, err := s.innerHTTP3.Upgrade(w, ctx.Request)
|
||||
if err != nil {
|
||||
s.writeErrorNoLog(ctx, http.StatusBadRequest, fmt.Errorf("webtransport upgrade failed: %w", err))
|
||||
return
|
||||
|
||||
@@ -78,8 +78,8 @@ type serverMetrics interface {
|
||||
|
||||
// Server is a Media over QUIC server.
|
||||
type Server struct {
|
||||
HTTPS2Address string
|
||||
HTTPS3Address string
|
||||
HTTP2Address string
|
||||
HTTP3Address string
|
||||
ServerKey string
|
||||
ServerCert string
|
||||
AllowOrigins []string
|
||||
@@ -107,8 +107,8 @@ type Server struct {
|
||||
// Initialize initializes the server.
|
||||
func (s *Server) Initialize() error {
|
||||
s.httpServer = &httpServer{
|
||||
https2Address: s.HTTPS2Address,
|
||||
https3Address: s.HTTPS3Address,
|
||||
http2Address: s.HTTP2Address,
|
||||
http3Address: s.HTTP3Address,
|
||||
serverKey: s.ServerKey,
|
||||
serverCert: s.ServerCert,
|
||||
allowOrigins: s.AllowOrigins,
|
||||
@@ -133,7 +133,7 @@ func (s *Server) Initialize() error {
|
||||
s.chAPISessionsKick = make(chan serverAPISessionsKickReq)
|
||||
s.done = make(chan struct{})
|
||||
|
||||
s.Log(logger.Info, "started with listeners on %s (TCP/HTTPS2), %s (UDP/HTTP3)", s.HTTPS2Address, s.HTTPS3Address)
|
||||
s.Log(logger.Info, "started with listeners on %s (TCP/HTTP2), %s (UDP/HTTP3)", s.HTTP2Address, s.HTTP3Address)
|
||||
|
||||
go s.run()
|
||||
|
||||
|
||||
@@ -63,8 +63,8 @@ func TestServer(t *testing.T) {
|
||||
serverKeyFile := test.CreateTempFile(t, test.TLSCertKey)
|
||||
|
||||
s := &Server{
|
||||
HTTPS2Address: "127.0.0.1:19895",
|
||||
HTTPS3Address: "127.0.0.1:19896",
|
||||
HTTP2Address: "127.0.0.1:19895",
|
||||
HTTP3Address: "127.0.0.1:19896",
|
||||
ServerCert: serverCertFile,
|
||||
ServerKey: serverKeyFile,
|
||||
AllowOrigins: []string{"*"},
|
||||
|
||||
+4
-4
@@ -443,12 +443,12 @@ srtAddress: :8890
|
||||
|
||||
# Enable the MoQ (Media over QUIC) server, which allows to publish and read streams with the MoQ protocol.
|
||||
moq: true
|
||||
# Address of the TCP/HTTPS2 listener.
|
||||
# Address of the TCP/HTTP2 listener.
|
||||
# This hosts the web client.
|
||||
moqHTTPS2Address: :8892
|
||||
# Address of the UDP/HTTPS3 listener.
|
||||
moqHTTP2Address: :8892
|
||||
# Address of the UDP/HTTP3 listener.
|
||||
# This hosts the WebTransport endpoint.
|
||||
moqHTTPS3Address: :8892
|
||||
moqHTTP3Address: :8892
|
||||
# Path to the server key.
|
||||
# This can be generated with:
|
||||
# openssl genrsa -out server.key 2048
|
||||
|
||||
Reference in New Issue
Block a user