add traffic sniffing for handler

This commit is contained in:
ginuerzh
2024-09-27 15:55:28 +08:00
parent dfb6cb95d0
commit 3c8add4b82
43 changed files with 4518 additions and 1839 deletions
+14 -11
View File
@@ -8,21 +8,24 @@ import (
)
type metadata struct {
key string
readTimeout time.Duration
hash string
key string
hash string
readTimeout time.Duration
sniffing bool
sniffingTimeout time.Duration
}
func (h *ssHandler) parseMetadata(md mdata.Metadata) (err error) {
const (
key = "key"
readTimeout = "readTimeout"
hash = "hash"
)
h.md.readTimeout = mdutil.GetDuration(md, "readTimeout")
if h.md.readTimeout <= 0 {
h.md.readTimeout = 15 * time.Second
}
h.md.key = mdutil.GetString(md, key)
h.md.readTimeout = mdutil.GetDuration(md, readTimeout)
h.md.hash = mdutil.GetString(md, hash)
h.md.key = mdutil.GetString(md, "key")
h.md.hash = mdutil.GetString(md, "hash")
h.md.sniffing = mdutil.GetBool(md, "sniffing")
h.md.sniffingTimeout = mdutil.GetDuration(md, "sniffing.timeout")
return
}