mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-12-04 07:40:26 +08:00
优化数据统计
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"github.com/TeaOSLab/EdgeNode/internal/firewalls"
|
||||
"github.com/TeaOSLab/EdgeNode/internal/iplibrary"
|
||||
"net"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -25,6 +26,8 @@ type BaseClientConn struct {
|
||||
isClosed bool
|
||||
|
||||
rawIP string
|
||||
|
||||
totalSentBytes int64
|
||||
}
|
||||
|
||||
func (this *BaseClientConn) IsClosed() bool {
|
||||
@@ -160,3 +163,10 @@ func (this *BaseClientConn) SetFingerprint(fingerprint []byte) {
|
||||
func (this *BaseClientConn) Fingerprint() []byte {
|
||||
return this.fingerprint
|
||||
}
|
||||
|
||||
// LastRequestBytes 读取上一次请求发送的字节数
|
||||
func (this *BaseClientConn) LastRequestBytes() int64 {
|
||||
var result = atomic.LoadInt64(&this.totalSentBytes)
|
||||
atomic.StoreInt64(&this.totalSentBytes, 0)
|
||||
return result
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user