XMediaLib.Stun.encode
You're seeing just the function
encode
, go back to XMediaLib.Stun module for more information.
Accepts data and attempts to convert it to a STUN specific stream as a response to the calling client.
Example
iex> response = %Stun{class: :success, method: :binding,
...> transactionid: 123456789012, fingerprint: false, attrs: %{
...> xor_mapped_address: {{127,0,0,1}, 12345},
...> mapped_address: {{127,0,0,1}, 12345},
...> source_address: {{127,0,0,1}, 12346},
...> software: <<"XMediaLib-stun">>
...> }}
iex> XMediaLib.Stun.encode(response)
<<1, 1, 0, 56, 33, 18, 164, 66, 0, 0, 0, 0, 0, 0, 0, 28, 190, 153, 26, 20, 0, 1, 0, 8, 0, 1, 48, 57, 127, 0, 0, 1, 128, 34, 0, 14, 88, 77, 101, 100, 105, 97, 76, 105, 98, 45, 115, 116, 117, 110, 0, 0, 0, 4, 0, 8, 0, 1, 48, 58, 127, 0, 0, 1, 0, 32, 0, 8, 0, 1, 17, 43, 94, 18, 164, 67>>