Browse Source

optimize stats output

pull/15/head
Jason 5 years ago
parent
commit
28cf81f8ee
  1. 2
      common/stats/session/session.go
  2. 2
      proxy/socks/tcp.go
  3. 2
      proxy/socks/udp.go

2
common/stats/session/session.go

@ -56,7 +56,7 @@ func (s *simpleSessionStater) Start() error {
_, _ = fmt.Fprintf(w, "<table style=\"border=4px solid\">")
_, _ = fmt.Fprintf(w, "<tr><td>Process Name</td><td>Network</td><td>Duration</td><td>Local Addr</td><td>Remote Addr</td><td>Upload Bytes</td><td>Download Bytes</td></tr>")
sort.Slice(sessions, func(i, j int) bool {
return sessions[i].SessionStart.Before(sessions[j].SessionStart)
return sessions[i].SessionStart.After(sessions[j].SessionStart)
})
for _, sess := range sessions {
_, _ = 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></tr>",

2
proxy/socks/tcp.go

@ -169,7 +169,7 @@ func (h *tcpHandler) Handle(conn net.Conn, target *net.TCPAddr) error {
localPortInt, _ := strconv.Atoi(localPortStr)
process, err = lsof.GetCommandNameBySocket(target.Network(), localHost, uint16(localPortInt))
if err != nil {
process = "unknown process"
process = "N/A"
}
sess = &stats.Session{

2
proxy/socks/udp.go

@ -184,7 +184,7 @@ func (h *udpHandler) connectInternal(conn core.UDPConn, dest string) error {
localPortInt, _ := strconv.Atoi(localPortStr)
process, err = lsof.GetCommandNameBySocket(conn.LocalAddr().Network(), localHost, uint16(localPortInt))
if err != nil {
process = "unknown process"
process = "N/A"
}
sess := &stats.Session{

Loading…
Cancel
Save