From 7d7a44750478acd229e98a10e9dbbdb906f0dd78 Mon Sep 17 00:00:00 2001 From: yuhan6665 <1588741+yuhan6665@users.noreply.github.com> Date: Wed, 4 Sep 2024 00:06:51 -0400 Subject: [PATCH] Experiment: seed ignore buffer and send 1st fake packet instantly --- proxy/scheduler.go | 5 ++++- proxy/vless/encoding/addons.go | 10 +++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/proxy/scheduler.go b/proxy/scheduler.go index dec1f4be7e26..55c5fe10006a 100644 --- a/proxy/scheduler.go +++ b/proxy/scheduler.go @@ -35,6 +35,9 @@ func NewScheduler(w buf.Writer, addon *Addons, state *TrafficState, context cont } go s.mainLoop() if s.addons.Scheduler != nil { + if buffered, ok := w.(*buf.BufferedWriter); ok { + buffered.SetBuffered(false) + } go s.exampleIndependentScheduler() } return &s @@ -72,7 +75,7 @@ func(s *Scheduler) mainLoop() { func(s *Scheduler) exampleIndependentScheduler() { for { - time.Sleep(500 * time.Millisecond) s.Trigger <- 1 // send fake buffer if no pending + time.Sleep(500 * time.Millisecond) } } diff --git a/proxy/vless/encoding/addons.go b/proxy/vless/encoding/addons.go index 403ffe299341..feee6e87ffcc 100644 --- a/proxy/vless/encoding/addons.go +++ b/proxy/vless/encoding/addons.go @@ -189,11 +189,11 @@ func PopulateSeed(seed string, addons *proxy.Addons) { LongMin: 900, LongMax: 1400, } - addons.Delay = &proxy.DelayConfig{ - IsRandom: true, - MinMillis: 100, - MaxMillis: 500, - } + // addons.Delay = &proxy.DelayConfig{ + // IsRandom: true, + // MinMillis: 100, + // MaxMillis: 500, + // } addons.Scheduler = &proxy.SchedulerConfig{ TimeoutMillis: 600, }