Skip to content

Commit

Permalink
Fix all errors with coturn
Browse files Browse the repository at this point in the history
* Requested Transport attr was add to non-allocate requests incorrectly
* Refresh request was missing username, realm, nonce and integrity
Resolves #74
  • Loading branch information
enobufs committed Jul 15, 2019
1 parent a985012 commit accf9b7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions internal/client/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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(),
Expand Down

0 comments on commit accf9b7

Please sign in to comment.