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, "") + _, _ = fmt.Fprintf(w, "
ProcessNetworkDateDurationClient AddrTarget AddrUploadDownload
align=\"right\"") + _, _ = fmt.Fprintf(w, "\n") sort.Slice(sessions, func(i, j int) bool { return sessions[i].SessionStart.After(sessions[j].SessionStart) }) for _, session := range sessions { - _, _ = fmt.Fprintf(w, "", + _, _ = fmt.Fprintf(w, "\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, "
ProcessNetworkDateDurationClient AddrTarget AddrUploadDownload
%v%v%v%v%v%v%v%v
%v%v%v%v%v%v%v%v
") + _, _ = fmt.Fprintf(w, "\n") trafficUp := atomic.LoadInt64(&s.trafficUp) trafficDown := atomic.LoadInt64(&s.trafficDown) - _, _ = fmt.Fprintf(w, "", + _, _ = fmt.Fprintf(w, "\n", + now(), + uptime(), byteCountSI(trafficUp+trafficDown), byteCountSI(trafficUp), byteCountSI(trafficDown), ) + _, _ = fmt.Fprintf(w, "
NowUptimeUploadDownloadTotal
Total%sUp%sDown%s
%s%s%s%s%s
") + + // Session table _, _ = fmt.Fprintf(w, "

Active sessions: %d

", len(activeSessions)) tablePrint(w, activeSessions) _, _ = fmt.Fprintf(w, "

Recently completed sessions: %d

", len(completedSessions))