XMediaLib.Stun.pretty
You're seeing just the function
pretty
, 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, formatted to a string.
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">>
...> }} |> Stun.encode()
iex> XMediaLib.Stun.pretty(response)
{:ok,
%{
attrs: %{
mapped_address: "127.0.0.1:12345",
software: "XMediaLib-stun",
source_address: "127.0.0.1:12346",
xor_mapped_address: "127.0.0.1:12345"
},
class: :success,
method: :binding,
transactionid: 123456789012
}}