Skip to content

Commit

Permalink
fix naming
Browse files Browse the repository at this point in the history
  • Loading branch information
hiddify-com committed Feb 13, 2024
1 parent f2b65f6 commit 180fae5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions device/send.go
Original file line number Diff line number Diff line change
Expand Up @@ -636,12 +636,12 @@ func (peer *Peer) RoutineSequentialSender(maxBatchSize int) {

func sendNoise(peer *Peer) error {
fakePackets := []int{8, 15}
delays := []int{200 * int(time.Millisecond), 500 * int(time.Millisecond)}
packetSize := []int{40, 100}
fakePacketsSize := []int{40, 100}
fakePacketsDelays := []int{200, 500}
numPackets := randomInt(fakePackets[0], fakePackets[1])
for i := 0; i < numPackets; i++ {
// Generate a random packet size between 10 and 40 bytes
packetSize := randomInt(packetSize[0], packetSize[1])
packetSize := randomInt(fakePacketsSize[0], fakePacketsSize[1])
randomPacket := make([]byte, packetSize)
_, err := rand.Read(randomPacket)
if err != nil {
Expand All @@ -656,7 +656,7 @@ func sendNoise(peer *Peer) error {
if i < numPackets-1 && peer.isRunning.Load() && !peer.device.isClosed() {
select {
case <-peer.stopCh:
case <-time.After(time.Duration(randomInt(delays[0], delays[1]))):
case <-time.After(time.Duration(randomInt(fakePacketsDelays[0], fakePacketsDelays[1])) * time.Millisecond):
default:
}

Expand Down

0 comments on commit 180fae5

Please sign in to comment.