add ttl option for quic
This commit is contained in:
@ -59,7 +59,7 @@ func (l *icmpListener) Init(md md.Metadata) (err error) {
|
||||
conn = admission.WrapPacketConn(l.options.Admission, conn)
|
||||
|
||||
config := &quic.Config{
|
||||
KeepAlivePeriod: l.md.keepAlive,
|
||||
KeepAlivePeriod: l.md.keepAlivePeriod,
|
||||
HandshakeIdleTimeout: l.md.handshakeTimeout,
|
||||
MaxIdleTimeout: l.md.maxIdleTimeout,
|
||||
Versions: []quic.VersionNumber{
|
||||
|
@ -12,17 +12,17 @@ const (
|
||||
)
|
||||
|
||||
type metadata struct {
|
||||
keepAlive time.Duration
|
||||
keepAlivePeriod time.Duration
|
||||
handshakeTimeout time.Duration
|
||||
maxIdleTimeout time.Duration
|
||||
|
||||
cipherKey []byte
|
||||
backlog int
|
||||
backlog int
|
||||
}
|
||||
|
||||
func (l *icmpListener) parseMetadata(md mdata.Metadata) (err error) {
|
||||
const (
|
||||
keepAlive = "keepAlive"
|
||||
keepAlivePeriod = "ttl"
|
||||
handshakeTimeout = "handshakeTimeout"
|
||||
maxIdleTimeout = "maxIdleTimeout"
|
||||
|
||||
@ -34,7 +34,12 @@ func (l *icmpListener) parseMetadata(md mdata.Metadata) (err error) {
|
||||
l.md.backlog = defaultBacklog
|
||||
}
|
||||
|
||||
l.md.keepAlive = mdx.GetDuration(md, keepAlive)
|
||||
if mdx.GetBool(md, keepAlive) {
|
||||
l.md.keepAlivePeriod = mdx.GetDuration(md, keepAlivePeriod)
|
||||
if l.md.keepAlivePeriod <= 0 {
|
||||
l.md.keepAlivePeriod = 10 * time.Second
|
||||
}
|
||||
}
|
||||
l.md.handshakeTimeout = mdx.GetDuration(md, handshakeTimeout)
|
||||
l.md.maxIdleTimeout = mdx.GetDuration(md, maxIdleTimeout)
|
||||
|
||||
|
Reference in New Issue
Block a user