WIP: Fixed rate limiting
This commit is contained in:
parent
169231d848
commit
3c4534f620
@ -87,10 +87,6 @@ func (r *Remote) updateConf(conf remoteConfig) {
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
func (r *Remote) sendUDP(b []byte, addr netip.AddrPort) {
|
func (r *Remote) sendUDP(b []byte, addr netip.AddrPort) {
|
||||||
if err := r.limiter.Limit(); err != nil {
|
|
||||||
r.logf("Rate limiter")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if _, err := r.SendUDP(b, addr); err != nil {
|
if _, err := r.SendUDP(b, addr); err != nil {
|
||||||
r.logf("Failed to send URP packet: %v", err)
|
r.logf("Failed to send URP packet: %v", err)
|
||||||
}
|
}
|
||||||
@ -162,6 +158,11 @@ func (r *Remote) relayData(toIP byte, enc []byte) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (r *Remote) sendControl(conf remoteConfig, data []byte) {
|
func (r *Remote) sendControl(conf remoteConfig, data []byte) {
|
||||||
|
if err := r.limiter.Limit(); err != nil {
|
||||||
|
r.logf("Rate limiter")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if conf.Direct {
|
if conf.Direct {
|
||||||
r.sendControlDirect(conf, data)
|
r.sendControlDirect(conf, data)
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user