Skip to content

Commit ff2ab39

Browse files
committed
Update.
1 parent 65db12c commit ff2ab39

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

pkg/signaler/signaler.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,12 +150,13 @@ func (s *Signaler) HandleTurnServerCredentials(writer http.ResponseWriter, reque
150150
151151
*/
152152
ttl := 86400
153+
host := fmt.Sprintf("%s:%d", s.turn.Config.PublicIP, s.turn.Config.Port)
153154
credential := TurnCredentials{
154155
Username: turnUsername,
155156
Password: turnPassword,
156157
TTL: ttl,
157158
Uris: []string{
158-
"turn:1.2.3.4:19302?transport=udp",
159+
"turn:" + host + "?transport=udp",
159160
},
160161
}
161162
s.expresMap.Set(turnUsername, credential, int64(ttl))

pkg/turn/turn.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,13 @@ if key, ok := usersMap[username]; ok {
3232
type TurnServer struct {
3333
udpListener net.PacketConn
3434
turnServer *turn.Server
35+
Config TurnServerConfig
3536
AuthHandler func(username string, realm string, srcAddr net.Addr) ([]byte, bool)
3637
}
3738

3839
func NewTurnServer(config TurnServerConfig) *TurnServer {
3940
server := &TurnServer{
41+
Config: config,
4042
AuthHandler: nil,
4143
}
4244
if len(config.PublicIP) == 0 {

0 commit comments

Comments
 (0)