mirror of
https://github.com/luscis/openlan.git
synced 2025-10-08 10:00:12 +08:00
fea: go-socks in self.
This commit is contained in:
17
pkg/socks5/credentials.go
Normal file
17
pkg/socks5/credentials.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package socks5
|
||||
|
||||
// CredentialStore is used to support user/pass authentication
|
||||
type CredentialStore interface {
|
||||
Valid(user, password string) bool
|
||||
}
|
||||
|
||||
// StaticCredentials enables using a map directly as a credential store
|
||||
type StaticCredentials map[string]string
|
||||
|
||||
func (s StaticCredentials) Valid(user, password string) bool {
|
||||
pass, ok := s[user]
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
return password == pass
|
||||
}
|
Reference in New Issue
Block a user