Skip to content

Commit

Permalink
Adding simple credentials interface
Browse files Browse the repository at this point in the history
  • Loading branch information
armon committed Jan 23, 2014
1 parent 5ecd357 commit 99dd8ce
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions credentials.go
@@ -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
}

0 comments on commit 99dd8ce

Please sign in to comment.