Comparison

mod_turncredentials/mod_turncredentials.lua @ 3774:20346da6d241

mod_turncredentials: Fix reporting of expiry in extdisco:2 protocol Hm, this didn't look right: <service expires='1970-01-02T00:00:00Z' ..>
author Kim Alvefur <zash@zash.se>
date Mon, 23 Dec 2019 23:01:44 +0100
parent 3773:915c7bd5f754
child 3977:bbfcd786cc78
comparison
equal deleted inserted replaced
3773:915c7bd5f754 3774:20346da6d241
43 local expires_at = os_time() + ttl; 43 local expires_at = os_time() + ttl;
44 local userpart = tostring(expires_at); 44 local userpart = tostring(expires_at);
45 local nonce = base64.encode(hmac_sha1(secret, tostring(userpart), false)); 45 local nonce = base64.encode(hmac_sha1(secret, tostring(userpart), false));
46 origin.send(st.reply(stanza):tag("services", {xmlns = "urn:xmpp:extdisco:2"}) 46 origin.send(st.reply(stanza):tag("services", {xmlns = "urn:xmpp:extdisco:2"})
47 :tag("service", { type = "stun", host = host, port = ("%d"):format(port) }):up() 47 :tag("service", { type = "stun", host = host, port = ("%d"):format(port) }):up()
48 :tag("service", { type = "turn", host = host, port = ("%d"):format(port), username = userpart, password = nonce, expires = datetime(ttl), restricted = "1" }):up() 48 :tag("service", { type = "turn", host = host, port = ("%d"):format(port), username = userpart, password = nonce, expires = datetime(expires_at), restricted = "1" }):up()
49 ); 49 );
50 return true; 50 return true;
51 end); 51 end);