Comparison

plugins/mod_admin_shell.lua @ 13036:1612c7f7dd55

mod_admin_shell: More dynamic widths calculations
author Kim Alvefur <zash@zash.se>
date Fri, 07 Apr 2023 12:48:17 +0200
parent 13035:93c1590b5951
child 13037:635ed9a362ee
comparison
equal deleted inserted replaced
13035:93c1590b5951 13036:1612c7f7dd55
813 if session.incoming and session.outgoing then return "<->"; end 813 if session.incoming and session.outgoing then return "<->"; end
814 if dir == "outgoing" then return "-->"; end 814 if dir == "outgoing" then return "-->"; end
815 if dir == "incoming" then return "<--"; end 815 if dir == "incoming" then return "<--"; end
816 end; 816 end;
817 }; 817 };
818 id = { title = "Session ID"; description = "Internal session ID used in logging"; width = 20; key = "id" }; 818 id = {
819 type = { title = "Type"; description = "Session type"; width = #"c2s_unauthed"; key = "type" }; 819 title = "Session ID";
820 description = "Internal session ID used in logging";
821 -- Depends on log16(?) of pointers which may vary over runtime, so + some margin
822 width = math.max(#"c2s", #"s2sin", #"s2sout") + #(tostring({}):match("%x+$")) + 2;
823 key = "id";
824 };
825 type = {
826 title = "Type";
827 description = "Session type";
828 width = math.max(#"c2s_unauthed", #"s2sout_unauthed");
829 key = "type";
830 };
820 method = { 831 method = {
821 title = "Method"; 832 title = "Method";
822 description = "Connection method"; 833 description = "Connection method";
823 width = math.max(#"BOSH", #"WebSocket", #"TCP"); 834 width = math.max(#"BOSH", #"WebSocket", #"TCP");
824 mapper = function(_, session) 835 mapper = function(_, session)
868 }; 879 };
869 encryption = { 880 encryption = {
870 title = "Encryption"; 881 title = "Encryption";
871 description = "Encryption algorithm used (TLS cipher suite)"; 882 description = "Encryption algorithm used (TLS cipher suite)";
872 -- openssl ciphers 'ALL:COMPLEMENTOFALL' | tr : \\n | awk 'BEGIN {n=1} length() > n {n=length()} END {print(n)}' 883 -- openssl ciphers 'ALL:COMPLEMENTOFALL' | tr : \\n | awk 'BEGIN {n=1} length() > n {n=length()} END {print(n)}'
873 width = 30; 884 width = #"ECDHE-ECDSA-CHACHA20-POLY1305";
874 key = "conn"; 885 key = "conn";
875 mapper = function(conn) 886 mapper = function(conn)
876 local info = conn and conn.ssl_info and conn:ssl_info(); 887 local info = conn and conn.ssl_info and conn:ssl_info();
877 if info then return info.cipher end 888 if info then return info.cipher end
878 end; 889 end;