@@ -146,12 +146,6 @@ type server struct {
146
146
modifyRxMu sync.RWMutex
147
147
modifyRx func (data []byte ) []byte
148
148
149
- pauseTxMu sync.Mutex
150
- pauseTxc chan struct {}
151
-
152
- pauseRxMu sync.Mutex
153
- pauseRxc chan struct {}
154
-
155
149
latencyTxMu sync.RWMutex
156
150
latencyTx time.Duration
157
151
@@ -177,9 +171,6 @@ func NewServer(cfg ServerConfig) Server {
177
171
readyc : make (chan struct {}),
178
172
donec : make (chan struct {}),
179
173
errc : make (chan error , 16 ),
180
-
181
- pauseTxc : make (chan struct {}),
182
- pauseRxc : make (chan struct {}),
183
174
}
184
175
185
176
_ , fromPort , err := net .SplitHostPort (cfg .From .Host )
@@ -202,9 +193,6 @@ func NewServer(cfg ServerConfig) Server {
202
193
s .retryInterval = defaultRetryInterval
203
194
}
204
195
205
- close (s .pauseTxc )
206
- close (s .pauseRxc )
207
-
208
196
if strings .HasPrefix (s .from .Scheme , "http" ) {
209
197
s .from .Scheme = "tcp"
210
198
}
@@ -443,27 +431,6 @@ func (s *server) ioCopy(dst io.Writer, src io.Reader, ptype proxyType) {
443
431
panic ("unknown proxy type" )
444
432
}
445
433
446
- // pause before packet dropping, blocking, and forwarding
447
- var pausec chan struct {}
448
- switch ptype {
449
- case proxyTx :
450
- s .pauseTxMu .Lock ()
451
- pausec = s .pauseTxc
452
- s .pauseTxMu .Unlock ()
453
- case proxyRx :
454
- s .pauseRxMu .Lock ()
455
- pausec = s .pauseRxc
456
- s .pauseRxMu .Unlock ()
457
- default :
458
- panic ("unknown proxy type" )
459
- }
460
- select {
461
- case <- pausec :
462
- case <- s .donec :
463
- return
464
- }
465
-
466
- // pause first, and then drop packets
467
434
if nr2 == 0 {
468
435
continue
469
436
}
@@ -774,68 +741,6 @@ func (s *server) UnblackholeRx() {
774
741
)
775
742
}
776
743
777
- func (s * server ) PauseTx () {
778
- s .pauseTxMu .Lock ()
779
- s .pauseTxc = make (chan struct {})
780
- s .pauseTxMu .Unlock ()
781
-
782
- s .lg .Info (
783
- "paused tx" ,
784
- zap .String ("from" , s .From ()),
785
- zap .String ("to" , s .To ()),
786
- )
787
- }
788
-
789
- func (s * server ) UnpauseTx () {
790
- s .pauseTxMu .Lock ()
791
- select {
792
- case <- s .pauseTxc : // already unpaused
793
- case <- s .donec :
794
- s .pauseTxMu .Unlock ()
795
- return
796
- default :
797
- close (s .pauseTxc )
798
- }
799
- s .pauseTxMu .Unlock ()
800
-
801
- s .lg .Info (
802
- "unpaused tx" ,
803
- zap .String ("from" , s .From ()),
804
- zap .String ("to" , s .To ()),
805
- )
806
- }
807
-
808
- func (s * server ) PauseRx () {
809
- s .pauseRxMu .Lock ()
810
- s .pauseRxc = make (chan struct {})
811
- s .pauseRxMu .Unlock ()
812
-
813
- s .lg .Info (
814
- "paused rx" ,
815
- zap .String ("from" , s .To ()),
816
- zap .String ("to" , s .From ()),
817
- )
818
- }
819
-
820
- func (s * server ) UnpauseRx () {
821
- s .pauseRxMu .Lock ()
822
- select {
823
- case <- s .pauseRxc : // already unpaused
824
- case <- s .donec :
825
- s .pauseRxMu .Unlock ()
826
- return
827
- default :
828
- close (s .pauseRxc )
829
- }
830
- s .pauseRxMu .Unlock ()
831
-
832
- s .lg .Info (
833
- "unpaused rx" ,
834
- zap .String ("from" , s .To ()),
835
- zap .String ("to" , s .From ()),
836
- )
837
- }
838
-
839
744
func (s * server ) ResetListener () error {
840
745
s .listenerMu .Lock ()
841
746
defer s .listenerMu .Unlock ()
0 commit comments