mirror of
https://github.com/p4gefau1t/trojan-go.git
synced 2024-04-21 12:21:34 +00:00
add utls anti-fingerprinting
This commit is contained in:
+11
-9
@@ -36,15 +36,17 @@ func (s *ClientAPIService) QueryStats(ctx context.Context, req *StatsRequest) (*
|
||||
}
|
||||
|
||||
func (s *ClientAPIService) calcSpeed() {
|
||||
select {
|
||||
case <-time.After(time.Second):
|
||||
sent, recv := s.meter.Query("")
|
||||
s.uploadSpeed = sent - s.lastSent
|
||||
s.downloadSpeed = recv - s.lastRecv
|
||||
s.lastSent = sent
|
||||
s.lastRecv = recv
|
||||
case <-s.ctx.Done():
|
||||
return
|
||||
for {
|
||||
select {
|
||||
case <-time.After(time.Second):
|
||||
sent, recv := s.meter.Query("")
|
||||
s.uploadSpeed = sent - s.lastSent
|
||||
s.downloadSpeed = recv - s.lastRecv
|
||||
s.lastSent = sent
|
||||
s.lastRecv = recv
|
||||
case <-s.ctx.Done():
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user