Skip to content

Commit

Permalink
another try for #12
Browse files Browse the repository at this point in the history
  • Loading branch information
firefart committed Jul 11, 2022
1 parent 4f5e170 commit ddc2fcf
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions internal/requests_turn.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ func AllocateRequest(targetProtocol RequestedTransport, allocateProtcol Allocate

if allocateProtcol != AllocateProtocolIgnore {
s.Attributes = append(s.Attributes, Attribute{
Type: AttrRequestedAddressFamily,
Value: []byte{byte(allocateProtcol), 0x00, 0x00, 0x00, 0x00}, // 1 byte to pad the single byte allocateProtocol to the needed 2 bytes and 3 reserved
Type: AttrRequestedAddressFamily,
// https://docs.microsoft.com/en-us/openspecs/office_protocols/ms-turn/e7efc457-9312-4a6b-8089-94032a599198
// manually add the reserved bytes
Value: []byte{byte(allocateProtcol), 0x00, 0x00, 0x00},
})
}

Expand Down Expand Up @@ -63,8 +65,10 @@ func AllocateRequestAuth(username, password, nonce, realm string, targetProtocol

if allocateProtcol != AllocateProtocolIgnore {
s.Attributes = append(s.Attributes, Attribute{
Type: AttrRequestedAddressFamily,
Value: []byte{byte(allocateProtcol), 0x00, 0x00, 0x00, 0x00}, // 1 byte to pad the single byte allocateProtocol to the needed 2 bytes and 3 reserved bytes
Type: AttrRequestedAddressFamily,
// https://docs.microsoft.com/en-us/openspecs/office_protocols/ms-turn/e7efc457-9312-4a6b-8089-94032a599198
// manually add the reserved bytes
Value: []byte{byte(allocateProtcol), 0x00, 0x00, 0x00},
})
}

Expand Down

0 comments on commit ddc2fcf

Please sign in to comment.