diff --git a/component/session/server.go b/component/session/server.go
index 1ac8e5d..e135012 100644
--- a/component/session/server.go
+++ b/component/session/server.go
@@ -59,14 +59,14 @@ func (s *Server) handler(resp http.ResponseWriter, req *http.Request) {
sort.Slice(sessions, func(i, j int) bool {
return sessions[i].SessionStart.Sub(sessions[j].SessionStart) < 0
})
- _, _ = fmt.Fprintf(w, "
")
- _, _ = fmt.Fprintf(w, "Process | Network | Date | Duration | Client Addr | Target Addr | Upload | Download |
")
+ _, _ = fmt.Fprintf(w, " align=\"right\"")
+ _, _ = fmt.Fprintf(w, "Process | Network | Date | Duration | Client Addr | Target Addr | Upload | Download |
\n")
sort.Slice(sessions, func(i, j int) bool {
return sessions[i].SessionStart.After(sessions[j].SessionStart)
})
for _, session := range sessions {
- _, _ = fmt.Fprintf(w, "%v | %v | %v | %v | %v | %v | %v | %v |
",
+ _, _ = fmt.Fprintf(w, "%v | %v | %v | %v | %v | %v | %v | %v |
\n",
session.Process,
session.Network,
date(session.SessionStart),
@@ -82,6 +82,7 @@ func (s *Server) handler(resp http.ResponseWriter, req *http.Request) {
}
w := bufio.NewWriter(resp)
+ // Html head
_, _ = fmt.Fprintf(w, "")
_, _ = fmt.Fprintf(w, `Go-tun2socks Sessions`)
+}Go-tun2socks Monitor`)
_, _ = fmt.Fprintf(w, "Go-tun2socks %s
", C.Version)
- _, _ = fmt.Fprintf(w, "Now: %s ; Uptime: %s
", now(), uptime())
- _, _ = fmt.Fprintf(w, "Traffic
")
+
+ // Statistics table
+ _, _ = fmt.Fprintf(w, "Statistics
")
+ _, _ = fmt.Fprintf(w, "")
+ _, _ = fmt.Fprintf(w, "Now | Uptime | Upload | Download | Total |
\n")
trafficUp := atomic.LoadInt64(&s.trafficUp)
trafficDown := atomic.LoadInt64(&s.trafficDown)
- _, _ = fmt.Fprintf(w, "Total | %s | Up | %s | Down | %s |
",
+ _, _ = fmt.Fprintf(w, "%s | %s | %s | %s | %s |
\n",
+ now(),
+ uptime(),
byteCountSI(trafficUp+trafficDown),
byteCountSI(trafficUp),
byteCountSI(trafficDown),
)
+ _, _ = fmt.Fprintf(w, "
")
+
+ // Session table
_, _ = fmt.Fprintf(w, "Active sessions: %d
", len(activeSessions))
tablePrint(w, activeSessions)
_, _ = fmt.Fprintf(w, "Recently completed sessions: %d
", len(completedSessions))