fix udp bind
This commit is contained in:
@ -1,6 +1,8 @@
|
||||
package connector
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/go-gost/gost/pkg/logger"
|
||||
)
|
||||
|
||||
@ -22,7 +24,11 @@ type ConnectOptions struct {
|
||||
type ConnectOption func(opts *ConnectOptions)
|
||||
|
||||
type BindOptions struct {
|
||||
Mux bool
|
||||
Mux bool
|
||||
Backlog int
|
||||
UDPDataQueueSize int
|
||||
UDPDataBufferSize int
|
||||
UDPConnTTL time.Duration
|
||||
}
|
||||
|
||||
type BindOption func(opts *BindOptions)
|
||||
@ -32,3 +38,27 @@ func MuxBindOption(mux bool) BindOption {
|
||||
opts.Mux = mux
|
||||
}
|
||||
}
|
||||
|
||||
func BacklogBindOption(backlog int) BindOption {
|
||||
return func(opts *BindOptions) {
|
||||
opts.Backlog = backlog
|
||||
}
|
||||
}
|
||||
|
||||
func UDPDataQueueSizeBindOption(size int) BindOption {
|
||||
return func(opts *BindOptions) {
|
||||
opts.UDPDataQueueSize = size
|
||||
}
|
||||
}
|
||||
|
||||
func UDPDataBufferSizeBindOption(size int) BindOption {
|
||||
return func(opts *BindOptions) {
|
||||
opts.UDPDataBufferSize = size
|
||||
}
|
||||
}
|
||||
|
||||
func UDPConnTTLBindOption(ttl time.Duration) BindOption {
|
||||
return func(opts *BindOptions) {
|
||||
opts.UDPConnTTL = ttl
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user