add tun listener

This commit is contained in:
ginuerzh
2021-12-19 23:20:35 +08:00
parent 34d6e393a1
commit a853d99d92
18 changed files with 584 additions and 70 deletions

View File

@ -29,16 +29,14 @@ func (h *http2Handler) parseMetadata(md md.Metadata) error {
h.md.proxyAgent = md.GetString(proxyAgent)
if v, _ := md.Get(users).([]interface{}); len(v) > 0 {
if auths := md.GetStrings(users); len(auths) > 0 {
authenticator := auth.NewLocalAuthenticator(nil)
for _, auth := range v {
if s, _ := auth.(string); s != "" {
ss := strings.SplitN(s, ":", 2)
if len(ss) == 1 {
authenticator.Add(ss[0], "")
} else {
authenticator.Add(ss[0], ss[1])
}
for _, auth := range auths {
ss := strings.SplitN(auth, ":", 2)
if len(ss) == 1 {
authenticator.Add(ss[0], "")
} else {
authenticator.Add(ss[0], ss[1])
}
}
h.md.authenticator = authenticator