mirror of
https://github.com/xjasonlyu/tun2socks.git
synced 2025-10-13 12:34:00 +08:00
resort format
This commit is contained in:
@@ -4,6 +4,8 @@ import (
|
|||||||
"bufio"
|
"bufio"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/xjasonlyu/tun2socks/common/queue"
|
||||||
|
C "github.com/xjasonlyu/tun2socks/constant"
|
||||||
"io"
|
"io"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
@@ -12,9 +14,6 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/xjasonlyu/tun2socks/common/queue"
|
|
||||||
C "github.com/xjasonlyu/tun2socks/constant"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const maxCompletedSessions = 100
|
const maxCompletedSessions = 100
|
||||||
@@ -98,15 +97,15 @@ table, th, td {
|
|||||||
// Statistics table
|
// Statistics table
|
||||||
_, _ = fmt.Fprintf(w, "<p>Statistics (%d)</p>", runtime.NumGoroutine())
|
_, _ = fmt.Fprintf(w, "<p>Statistics (%d)</p>", runtime.NumGoroutine())
|
||||||
_, _ = fmt.Fprintf(w, "<table style=\"border=4px solid\">")
|
_, _ = fmt.Fprintf(w, "<table style=\"border=4px solid\">")
|
||||||
_, _ = fmt.Fprintf(w, "<tr><th>Platform</th><th>CPU</th><th>Mem</th><th>Disk</th><th>Last Refresh Time</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</th><th>CPU</th><th>Mem</th><th>Disk</th><th>Uptime</th><th>Total</th><th>Upload</th><th>Download</th></tr>\n")
|
||||||
trafficUp := atomic.LoadInt64(&s.trafficUp)
|
trafficUp := atomic.LoadInt64(&s.trafficUp)
|
||||||
trafficDown := atomic.LoadInt64(&s.trafficDown)
|
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",
|
_, _ = 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(),
|
platform(),
|
||||||
cpu(),
|
cpu(),
|
||||||
mem(),
|
mem(),
|
||||||
disk(),
|
disk(),
|
||||||
date(time.Now()),
|
|
||||||
uptime(),
|
uptime(),
|
||||||
byteCountSI(trafficUp+trafficDown),
|
byteCountSI(trafficUp+trafficDown),
|
||||||
byteCountSI(trafficUp),
|
byteCountSI(trafficUp),
|
||||||
|
@@ -38,7 +38,7 @@ func platform() string {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return "N/A"
|
return "N/A"
|
||||||
}
|
}
|
||||||
return fmt.Sprintf("%s", h.Platform)
|
return fmt.Sprintf("%s", h.PlatformVersion)
|
||||||
}
|
}
|
||||||
|
|
||||||
func mem() string {
|
func mem() string {
|
||||||
|
Reference in New Issue
Block a user