Software /
code /
prosody-modules
Comparison
mod_audit/mod_audit.lua @ 5732:0c9606770db1
mod_audit: Also record human-readable name of country
Nicer to show in graphs but less machine-usable
Throw in continent in case that turns out to be useful one day
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 13 Nov 2023 12:22:17 +0100 |
parent | 5731:37ba9478b387 |
child | 5733:15c1801e8901 |
comparison
equal
deleted
inserted
replaced
5731:37ba9478b387 | 5732:0c9606770db1 |
---|---|
91 end | 91 end |
92 stanza:text_tag("remote-ip", network or remote_ip.normal); | 92 stanza:text_tag("remote-ip", network or remote_ip.normal); |
93 end | 93 end |
94 if attach_location and remote_ip then | 94 if attach_location and remote_ip then |
95 local geoip_info = remote_ip.proto == "IPv6" and geoip6_country:query_by_addr6(remote_ip.normal) or geoip4_country:query_by_addr(remote_ip.normal); | 95 local geoip_info = remote_ip.proto == "IPv6" and geoip6_country:query_by_addr6(remote_ip.normal) or geoip4_country:query_by_addr(remote_ip.normal); |
96 stanza:tag("location", { | 96 stanza:text_tag("location", geoip_info.name, { |
97 country = geoip_info.code; | 97 country = geoip_info.code; |
98 continent = geoip_info.continent; | |
98 }):up(); | 99 }):up(); |
99 end | 100 end |
100 if session.client_id then | 101 if session.client_id then |
101 stanza:text_tag("client", session.client_id); | 102 stanza:text_tag("client", session.client_id); |
102 end | 103 end |