23 lines
444 B
Go
23 lines
444 B
Go
package sni
|
|
|
|
import (
|
|
"time"
|
|
|
|
mdata "github.com/go-gost/core/metadata"
|
|
mdutil "github.com/go-gost/core/metadata/util"
|
|
)
|
|
|
|
type metadata struct {
|
|
readTimeout time.Duration
|
|
hash string
|
|
}
|
|
|
|
func (h *sniHandler) parseMetadata(md mdata.Metadata) (err error) {
|
|
h.md.readTimeout = mdutil.GetDuration(md, "readTimeout")
|
|
if h.md.readTimeout <= 0 {
|
|
h.md.readTimeout = 15 * time.Second
|
|
}
|
|
h.md.hash = mdutil.GetString(md, "hash")
|
|
return
|
|
}
|