initial commit

This commit is contained in:
ginuerzh
2022-03-14 20:27:14 +08:00
commit 9397cb5351
175 changed files with 16196 additions and 0 deletions

41
listener/icmp/metadata.go Normal file
View File

@ -0,0 +1,41 @@
package quic
import (
"time"
mdata "github.com/go-gost/gost/v3/pkg/metadata"
)
const (
defaultBacklog = 128
)
type metadata struct {
keepAlive bool
handshakeTimeout time.Duration
maxIdleTimeout time.Duration
cipherKey []byte
backlog int
}
func (l *icmpListener) parseMetadata(md mdata.Metadata) (err error) {
const (
keepAlive = "keepAlive"
handshakeTimeout = "handshakeTimeout"
maxIdleTimeout = "maxIdleTimeout"
backlog = "backlog"
)
l.md.backlog = mdata.GetInt(md, backlog)
if l.md.backlog <= 0 {
l.md.backlog = defaultBacklog
}
l.md.keepAlive = mdata.GetBool(md, keepAlive)
l.md.handshakeTimeout = mdata.GetDuration(md, handshakeTimeout)
l.md.maxIdleTimeout = mdata.GetDuration(md, maxIdleTimeout)
return
}