add dialer conn in stats

This commit is contained in:
Jason
2019-08-07 17:30:02 +08:00
parent 2bf585afed
commit 5ef6008b3c
4 changed files with 29 additions and 25 deletions

View File

@@ -86,7 +86,7 @@ func (h *tcpHandler) relay(localConn, remoteConn net.Conn, sess *stats.Session)
remoteConn.Close()
}()
// Uplink
// UpLink
go func() {
var err error
if h.sessionStater != nil && sess != nil {
@@ -98,7 +98,7 @@ func (h *tcpHandler) relay(localConn, remoteConn net.Conn, sess *stats.Session)
upCh <- err
}()
// Downlink
// DownLink
if h.sessionStater != nil && sess != nil {
statsCopy(localConn, remoteConn, sess, dirDownlink)
} else {
@@ -147,8 +147,9 @@ func (h *tcpHandler) Handle(localConn net.Conn, target *net.TCPAddr) error {
sess = &stats.Session{
ProcessName: process,
Network: target.Network(),
LocalAddr: localConn.LocalAddr().String(),
RemoteAddr: targetAddr,
DialerAddr: remoteConn.LocalAddr().String(),
ClientAddr: localConn.LocalAddr().String(),
TargetAddr: targetAddr,
UploadBytes: 0,
DownloadBytes: 0,
SessionStart: time.Now(),