Browse Source

webrtc: show both IP and port during session creation and in API (#2096)

pull/2097/head
Alessandro Ros 2 years ago committed by GitHub
parent
commit
3bb12e2a0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      internal/core/webrtc_http_server.go

7
internal/core/webrtc_http_server.go

@ -291,6 +291,9 @@ func (s *webRTCHTTPServer) onRequest(ctx *gin.Context) {
return return
} }
ip := ctx.ClientIP()
_, port, _ := net.SplitHostPort(ctx.Request.RemoteAddr)
user, pass, hasCredentials := ctx.Request.BasicAuth() user, pass, hasCredentials := ctx.Request.BasicAuth()
res := s.pathManager.getConfForPath(pathGetConfForPathReq{ res := s.pathManager.getConfForPath(pathGetConfForPathReq{
@ -298,7 +301,7 @@ func (s *webRTCHTTPServer) onRequest(ctx *gin.Context) {
publish: publish, publish: publish,
credentials: authCredentials{ credentials: authCredentials{
query: ctx.Request.URL.RawQuery, query: ctx.Request.URL.RawQuery,
ip: net.ParseIP(ctx.ClientIP()), ip: net.ParseIP(ip),
user: user, user: user,
pass: pass, pass: pass,
proto: authProtocolWebRTC, proto: authProtocolWebRTC,
@ -353,7 +356,7 @@ func (s *webRTCHTTPServer) onRequest(ctx *gin.Context) {
res := s.parent.sessionNew(webRTCSessionNewReq{ res := s.parent.sessionNew(webRTCSessionNewReq{
pathName: dir, pathName: dir,
remoteAddr: ctx.ClientIP(), remoteAddr: net.JoinHostPort(ip, port),
offer: offer, offer: offer,
publish: (fname == "whip"), publish: (fname == "whip"),
}) })

Loading…
Cancel
Save