|
|
@ -7,6 +7,7 @@ import ( |
|
|
|
"io" |
|
|
|
"net" |
|
|
|
"net/http" |
|
|
|
"runtime" |
|
|
|
"sort" |
|
|
|
"sync" |
|
|
|
"sync/atomic" |
|
|
@ -95,18 +96,19 @@ table, th, td { |
|
|
|
_, _ = fmt.Fprintf(w, "<h2>Go-tun2socks %s</h2>", C.Version) |
|
|
|
|
|
|
|
// Statistics table
|
|
|
|
_, _ = fmt.Fprintf(w, "<p>Statistics</p>") |
|
|
|
_, _ = fmt.Fprintf(w, "<p>Statistics (%d)</p>", runtime.NumGoroutine()) |
|
|
|
_, _ = fmt.Fprintf(w, "<table style=\"border=4px solid\">") |
|
|
|
_, _ = fmt.Fprintf(w, "<tr><th align=\"center\">Latest Refresh</th><th>Uptime</th><th>Total Traffic</th><th>Upload</th><th>Download</th></tr>\n") |
|
|
|
_, _ = fmt.Fprintf(w, "<tr><th>Last Refresh Time</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>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n", |
|
|
|
_, _ = fmt.Fprintf(w, "<tr><td>%v</td><td>%v</td><td>%v</td><td>%v</td><td>%v</td></tr>\n", |
|
|
|
date(time.Now()), |
|
|
|
uptime(), |
|
|
|
byteCountSI(trafficUp+trafficDown), |
|
|
|
byteCountSI(trafficUp), |
|
|
|
byteCountSI(trafficDown), |
|
|
|
) |
|
|
|
runtime.NumGoroutine() |
|
|
|
_, _ = fmt.Fprintf(w, "</table>") |
|
|
|
|
|
|
|
// Session table
|
|
|
|