diff --git a/openwrt/files/luci/statistics.htm b/openwrt/files/luci/statistics.htm
index c51dfaf..2467410 100644
--- a/openwrt/files/luci/statistics.htm
+++ b/openwrt/files/luci/statistics.htm
@@ -15,9 +15,9 @@ local pass_stats = {}
local pass_stats_file = io.open("/var/log/ua3f/pass_stats", "r")
if pass_stats_file then
for line in pass_stats_file:lines() do
- local host, count, ua = line:match("^(%S+)%s(%d+)%s(.+)$")
+ local srcAddr, destAddr, count, ua = line:match("^(%S+)%s(%S+)%s(%d+)%s(.+)$")
if ua and count then
- table.insert(pass_stats, {ua = ua, count = count, host = host})
+ table.insert(pass_stats, {ua = ua, count = count, srcAddr = srcAddr, destAddr = destAddr})
end
end
pass_stats_file:close()
@@ -54,14 +54,16 @@ end
| <%:User-Agent%> |
<%:Pass-Through Count%> |
- <%:Last Host%> |
+ <%:Last Source Address%> |
+ <%:Last Destination Address%> |
<% for i, item in ipairs(pass_stats) do %>
| <%= item.ua %> |
<%= item.count %> |
- <%= item.host %> |
+ <%= item.srcAddr %> |
+ <%= item.destAddr %> |
<% end %>
@@ -120,12 +122,12 @@ end
#pass-stats-table th:nth-child(1),
#pass-stats-table td:nth-child(1) {
- width: 50%;
+ width: 30%;
}
#pass-stats-table th:nth-child(2),
#pass-stats-table td:nth-child(2) {
- width: 20%;
+ width: 10%;
text-align: center;
}
@@ -133,4 +135,9 @@ end
#pass-stats-table td:nth-child(3) {
width: 30%;
}
+
+#pass-stats-table th:nth-child(4),
+#pass-stats-table td:nth-child(4) {
+ width: 30%;
+}
diff --git a/openwrt/po/zh_cn/ua3f.po b/openwrt/po/zh_cn/ua3f.po
index d03b061..b51b9e0 100644
--- a/openwrt/po/zh_cn/ua3f.po
+++ b/openwrt/po/zh_cn/ua3f.po
@@ -83,8 +83,11 @@ msgstr "User-Agent 放行次数实时统计"
msgid "Pass-Through Count"
msgstr "放行次数"
-msgid "Last Host"
-msgstr "最后访问地址"
+msgid "Last Source Address"
+msgstr "最近访问源地址"
+
+msgid "Last Destination Address"
+msgstr "最近访问目标地址"
msgid "Display Lines"
msgstr "显示行数"
diff --git a/src/internal/rewrite/rewriter.go b/src/internal/rewrite/rewriter.go
index 168a99b..1fe4780 100644
--- a/src/internal/rewrite/rewriter.go
+++ b/src/internal/rewrite/rewriter.go
@@ -113,8 +113,9 @@ func (r *Rewriter) ShouldRewrite(req *http.Request, srcAddr, destAddr string) bo
hit := !isWhitelist && matches
if !hit {
statistics.AddPassThroughRecord(&statistics.PassThroughRecord{
- Host: destAddr,
- UA: originalUA,
+ SrcAddr: srcAddr,
+ DestAddr: destAddr,
+ UA: originalUA,
})
}
return hit
diff --git a/src/internal/statistics/pass.go b/src/internal/statistics/pass.go
index a19b71b..ad12ac7 100644
--- a/src/internal/statistics/pass.go
+++ b/src/internal/statistics/pass.go
@@ -11,9 +11,10 @@ import (
const passthroughStatsFile = "/var/log/ua3f/pass_stats"
type PassThroughRecord struct {
- Host string
- UA string
- Count int
+ SrcAddr string
+ DestAddr string
+ UA string
+ Count int
}
var passThroughRecords = make(map[string]*PassThroughRecord)
@@ -42,7 +43,7 @@ func dumpPassThroughRecords() {
})
for _, record := range statList {
- line := fmt.Sprintf("%s %d %s\n", record.Host, record.Count, record.UA)
+ line := fmt.Sprintf("%s %s %d %s\n", record.SrcAddr, record.DestAddr, record.Count, record.UA)
f.WriteString(line)
}
}
diff --git a/src/internal/statistics/statistics.go b/src/internal/statistics/statistics.go
index 3b545fc..d63d166 100644
--- a/src/internal/statistics/statistics.go
+++ b/src/internal/statistics/statistics.go
@@ -35,12 +35,14 @@ func StartRecorder() {
}
if r, exists := passThroughRecords[record.UA]; exists {
r.Count++
- r.Host = record.Host
+ r.DestAddr = record.DestAddr
+ r.SrcAddr = record.SrcAddr
} else {
passThroughRecords[record.UA] = &PassThroughRecord{
- Host: record.Host,
- UA: record.UA,
- Count: 1,
+ SrcAddr: record.SrcAddr,
+ DestAddr: record.DestAddr,
+ UA: record.UA,
+ Count: 1,
}
}
case <-ticker.C: