From dbb55e6267baae21e04bedc0093712d7e59d817c Mon Sep 17 00:00:00 2001 From: Yutaka Takeda Date: Sun, 14 Jul 2019 17:37:38 -0700 Subject: [PATCH] Fix all errors with coturn * Requested Transport attr was add to non-allocate requests incorrectly * Refresh request was missing username, realm, nonce and integrity Resolves #74 --- internal/client/conn.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/client/conn.go b/internal/client/conn.go index 870a2afe..24e69126 100644 --- a/internal/client/conn.go +++ b/internal/client/conn.go @@ -236,7 +236,6 @@ func (c *UDPConn) WriteTo(p []byte, addr net.Addr) (int, error) { msg, err = stun.Build( stun.TransactionID, stun.NewType(stun.MethodSend, stun.ClassIndication), - turn.RequestedTransportUDP, turn.Data(p), peerAddr, stun.Fingerprint, @@ -361,7 +360,6 @@ func (c *UDPConn) createPermissions(addrs ...net.Addr) error { setters := []stun.Setter{ stun.TransactionID, stun.NewType(stun.MethodCreatePermission, stun.ClassRequest), - turn.RequestedTransportUDP, } for _, addr := range addrs { @@ -427,8 +425,11 @@ func (c *UDPConn) refreshAllocation(lifetime time.Duration, dontWait bool) error msg, err := stun.Build( stun.TransactionID, stun.NewType(stun.MethodRefresh, stun.ClassRequest), - turn.RequestedTransportUDP, turn.Lifetime{Duration: lifetime}, + c.obs.Username(), + c.obs.Realm(), + c.nonce(), + c.integrity, stun.Fingerprint, ) if err != nil { @@ -500,7 +501,6 @@ func (c *UDPConn) bind(b *binding) error { setters := []stun.Setter{ stun.TransactionID, stun.NewType(stun.MethodChannelBind, stun.ClassRequest), - turn.RequestedTransportUDP, addr2PeerAddress(b.addr), turn.ChannelNumber(b.number), c.obs.Username(),