mv session to constant

This commit is contained in:
Jason
2019-08-15 16:19:07 +08:00
parent 6f15e67c5f
commit 1cff4803bd
6 changed files with 112 additions and 107 deletions

View File

@@ -11,6 +11,7 @@ import (
"github.com/xjasonlyu/tun2socks/common/pool"
"github.com/xjasonlyu/tun2socks/component/dns"
"github.com/xjasonlyu/tun2socks/component/stats"
C "github.com/xjasonlyu/tun2socks/constant"
"github.com/xjasonlyu/tun2socks/core"
"github.com/xjasonlyu/tun2socks/log"
)
@@ -104,7 +105,7 @@ func (h *tcpHandler) Handle(conn net.Conn, target *net.TCPAddr) error {
// Get name of the process.
var process = lsof.GetProcessName(localConn.LocalAddr())
if h.sessionStater != nil {
sess := &stats.Session{
sess := &C.Session{
Process: process,
Network: localConn.LocalAddr().Network(),
DialerAddr: remoteConn.LocalAddr().String(),
@@ -116,7 +117,7 @@ func (h *tcpHandler) Handle(conn net.Conn, target *net.TCPAddr) error {
}
h.sessionStater.AddSession(localConn, sess)
remoteConn = stats.NewSessionConn(remoteConn, sess)
remoteConn = C.NewSessionConn(remoteConn, sess)
}
// Set keepalive