add authBasicRealm metadata for HTTP/HTTP2 handler

This commit is contained in:
ginuerzh
2023-01-31 13:42:55 +08:00
parent 1c6bc9283e
commit 3e35a7b761
4 changed files with 34 additions and 10 deletions

View File

@ -8,11 +8,16 @@ import (
mdutil "github.com/go-gost/core/metadata/util"
)
const (
defaultRealm = "gost"
)
type metadata struct {
probeResistance *probeResistance
enableUDP bool
header http.Header
hash string
authBasicRealm string
}
func (h *httpHandler) parseMetadata(md mdata.Metadata) error {
@ -23,6 +28,7 @@ func (h *httpHandler) parseMetadata(md mdata.Metadata) error {
knock = "knock"
enableUDP = "udp"
hash = "hash"
authBasicRealm = "authBasicRealm"
)
if m := mdutil.GetStringMapString(md, header); len(m) > 0 {
@ -48,6 +54,7 @@ func (h *httpHandler) parseMetadata(md mdata.Metadata) error {
}
h.md.enableUDP = mdutil.GetBool(md, enableUDP)
h.md.hash = mdutil.GetString(md, hash)
h.md.authBasicRealm = mdutil.GetString(md, authBasicRealm)
return nil
}