diff --git a/.gitignore b/.gitignore index 06d1792..7a8c4e3 100644 --- a/.gitignore +++ b/.gitignore @@ -24,4 +24,5 @@ go.work bin/ dist/ ipkg/etc/ -ipkg/usr/ \ No newline at end of file +ipkg/usr/ +test/ \ No newline at end of file diff --git a/openwrt/files/luci/statistics.htm b/openwrt/files/luci/statistics.htm index 2467410..b9313db 100644 --- a/openwrt/files/luci/statistics.htm +++ b/openwrt/files/luci/statistics.htm @@ -23,6 +23,18 @@ if pass_stats_file then pass_stats_file:close() end +local conn_stats = {} +local conn_stats_file = io.open("/var/log/ua3f/conn_stats", "r") +if conn_stats_file then + for line in conn_stats_file:lines() do + local protocol, srcAddr, destAddr, duration = line:match("^(%S+)%s(%S+)%s(%S+)%s(.+)$") + if protocol and srcAddr and destAddr and duration then + table.insert(conn_stats, {protocol = protocol, srcAddr = srcAddr, destAddr = destAddr, duration = duration}) + end + end + conn_stats_file:close() +end + local function rowstyle(i) return (i % 2 == 0) and "cbi-rowstyle-2" or "cbi-rowstyle-1" end @@ -30,13 +42,13 @@ end

<%:Statistics%>

-
<%:User-Agent Rewrite Statistics%>
+
<%:User-Agent Rewrite Statistics%>
- - - - + + + + <% for i, item in ipairs(rewrite_stats) do %> @@ -49,13 +61,13 @@ end <% end %>
<%:Host%><%:Rewrite Count%><%:Original User-Agent%><%:Modified User-Agent%><%:Host%><%:Rewrite Count%><%:Original User-Agent%><%:Modified User-Agent%>
-
<%:User-Agent Pass-Through Statistics%>
+
<%:User-Agent Pass-Through Statistics%>
- - - - + + + + <% for i, item in ipairs(pass_stats) do %> @@ -68,6 +80,30 @@ end <% end %>
<%:User-Agent%><%:Pass-Through Count%><%:Last Source Address%><%:Last Destination Address%><%:User-Agent%><%:Pass-Through Count%><%:Last Source Address%><%:Last Destination Address%>
+
<%:Connection Statistics%>
+ + + + + + + + + + + + <% for i, item in ipairs(conn_stats) do %> + + + + + + + <% end %> +
+ <%:Total Connections%>: <%= #conn_stats %> +
<%:Protocol%><%:Source Address%><%:Destination Address%><%:Duration%>
<%= item.protocol %><%= item.srcAddr %><%= item.destAddr %><%= item.duration %>
+