mihomo/tunnel/statistic/patch.go

26 lines
424 B
Go
Raw Normal View History

2023-10-23 16:50:43 +08:00
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
}