1
0
Fork 0

Adding simple credentials interface

logger
Armon Dadgar 2014-01-23 11:10:54 -08:00
parent 5ecd35707c
commit 99dd8cee1f
1 changed files with 17 additions and 0 deletions

17
credentials.go Normal file
View 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
}