mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-04-29 16:58:34 +00:00
Fix buffer.UDP destination override (#2356)
This commit is contained in:
parent
e013dce1df
commit
b8bd243df5
6 changed files with 75 additions and 94 deletions
|
@ -24,7 +24,6 @@ const (
|
|||
type pipeOption struct {
|
||||
limit int32 // maximum buffer size in bytes
|
||||
discardOverflow bool
|
||||
onTransmission func(buffer buf.MultiBuffer) buf.MultiBuffer
|
||||
}
|
||||
|
||||
func (o *pipeOption) isFull(curSize int32) bool {
|
||||
|
@ -141,10 +140,6 @@ func (p *pipe) WriteMultiBuffer(mb buf.MultiBuffer) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
if p.option.onTransmission != nil {
|
||||
mb = p.option.onTransmission(mb)
|
||||
}
|
||||
|
||||
for {
|
||||
err := p.writeMultiBufferInternal(mb)
|
||||
if err == nil {
|
||||
|
|
|
@ -3,7 +3,6 @@ package pipe
|
|||
import (
|
||||
"context"
|
||||
|
||||
"github.com/xtls/xray-core/common/buf"
|
||||
"github.com/xtls/xray-core/common/signal"
|
||||
"github.com/xtls/xray-core/common/signal/done"
|
||||
"github.com/xtls/xray-core/features/policy"
|
||||
|
@ -26,12 +25,6 @@ func WithSizeLimit(limit int32) Option {
|
|||
}
|
||||
}
|
||||
|
||||
func OnTransmission(hook func(mb buf.MultiBuffer) buf.MultiBuffer) Option {
|
||||
return func(option *pipeOption) {
|
||||
option.onTransmission = hook
|
||||
}
|
||||
}
|
||||
|
||||
// DiscardOverflow returns an Option for Pipe to discard writes if full.
|
||||
func DiscardOverflow() Option {
|
||||
return func(opt *pipeOption) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue