feat: add ICE servers and local IP address returned by the API to fix connectivity issues behind NAT (#146)

Add ICE servers and local IP address returned by the API to fix connectivity issues behind NAT
This commit is contained in:
Aveline
2025-02-11 15:45:14 +01:00
committed by GitHub
parent 15768ee0ab
commit 0d7efe5c0e
3 changed files with 43 additions and 9 deletions

View File

@@ -7,13 +7,14 @@ import (
"fmt"
"net/http"
"net/url"
"github.com/coder/websocket/wsjson"
"time"
"github.com/coder/websocket/wsjson"
"github.com/coreos/go-oidc/v3/oidc"
"github.com/gin-gonic/gin"
"github.com/coder/websocket"
"github.com/gin-gonic/gin"
)
type CloudRegisterRequest struct {
@@ -192,7 +193,11 @@ func handleSessionRequest(ctx context.Context, c *websocket.Conn, req WebRTCSess
return fmt.Errorf("google identity mismatch")
}
session, err := newSession()
session, err := newSession(SessionConfig{
ICEServers: req.ICEServers,
LocalIP: req.IP,
IsCloud: true,
})
if err != nil {
_ = wsjson.Write(context.Background(), c, gin.H{"error": err})
return err