update info

This commit is contained in:
Jason
2019-08-16 17:29:02 +08:00
parent bb4ceabf46
commit 4d3caf1643
2 changed files with 2 additions and 12 deletions
+2 -3
View File
@@ -92,20 +92,19 @@ table, th, td {
text-align: right;
padding: 4;
}</style><title>Go-tun2socks Monitor</title></head>`)
_, _ = fmt.Fprintf(w, "<h2>Go-tun2socks %s</h2>", C.Version)
// Statistics table
_, _ = fmt.Fprintf(w, "<p>Statistics (%d)</p>", runtime.NumGoroutine())
_, _ = fmt.Fprintf(w, "<table style=\"border=4px solid\">")
_, _ = fmt.Fprintf(w, "<tr><th>Last Refresh Time</th><th>Platform Version</th><th>CPU</th><th>Mem</th><th>Disk</th><th>Uptime</th><th>Total</th><th>Upload</th><th>Download</th></tr>\n")
_, _ = fmt.Fprintf(w, "<tr><th>Last Refresh Time</th><th>Platform Version</th><th>Go-tun2socks Version</th><th>CPU</th><th>Mem</th><th>Uptime</th><th>Total</th><th>Upload</th><th>Download</th></tr>\n")
trafficUp := atomic.LoadInt64(&s.trafficUp)
trafficDown := atomic.LoadInt64(&s.trafficDown)
_, _ = fmt.Fprintf(w, "<tr><td>%v</td><td>%v</td><td>%v</td><td>%v</td><td>%v</td><td>%v</td><td>%v</td><td>%v</td><td>%v</td></tr>\n",
date(time.Now()),
platform(),
C.Version,
cpu(),
mem(),
disk(),
uptime(),
byteCountSI(trafficUp+trafficDown),
byteCountSI(trafficUp),
-9
View File
@@ -6,7 +6,6 @@ import (
"time"
C "github.com/shirou/gopsutil/cpu"
D "github.com/shirou/gopsutil/disk"
H "github.com/shirou/gopsutil/host"
M "github.com/shirou/gopsutil/mem"
)
@@ -25,14 +24,6 @@ func cpu() string {
return fmt.Sprintf("%.1f%%", c[0])
}
func disk() string {
d, err := D.Usage("/")
if err != nil {
return "N/A"
}
return fmt.Sprintf("%.1f%%", d.UsedPercent)
}
func platform() string {
h, err := H.Info()
if err != nil {