add auther config
This commit is contained in:
@ -1,24 +0,0 @@
|
||||
package auth
|
||||
|
||||
import (
|
||||
"net/url"
|
||||
|
||||
"github.com/go-gost/gost/pkg/auth"
|
||||
)
|
||||
|
||||
func AuthFromUsers(users ...*url.Userinfo) auth.Authenticator {
|
||||
kvs := make(map[string]string)
|
||||
for _, v := range users {
|
||||
if v == nil || v.Username() == "" {
|
||||
continue
|
||||
}
|
||||
kvs[v.Username()], _ = v.Password()
|
||||
}
|
||||
|
||||
var authenticator auth.Authenticator
|
||||
if len(kvs) > 0 {
|
||||
authenticator = auth.NewMapAuthenticator(kvs)
|
||||
}
|
||||
|
||||
return authenticator
|
||||
}
|
Reference in New Issue
Block a user