mihomo/tunnel/statistic/patch.go
2023-10-23 16:50:43 +08:00

25 lines
424 B
Go

package statistic
import (
"net"
)
func (m *Manager) Total() (up, down int64) {
return m.uploadTotal.Load(), m.downloadTotal.Load()
}
func (tt *tcpTracker) RawConn() (net.Conn, bool) {
if tt.Chain.Last() == "DIRECT" {
return tt.Conn, true
}
return nil, false
}
func (ut *udpTracker) RawPacketConn() (net.PacketConn, bool) {
if ut.Chain.Last() == "DIRECT" {
return ut.PacketConn, true
}
return nil, false
}