credentials.go 403 B

1234567891011121314151617
  1. package socks5
  2. // CredentialStore is used to support user/pass authentication
  3. type CredentialStore interface {
  4. Valid(user, password string) bool
  5. }
  6. // StaticCredentials enables using a map directly as a credential store
  7. type StaticCredentials map[string]string
  8. func (s StaticCredentials) Valid(user, password string) bool {
  9. pass, ok := s[user]
  10. if !ok {
  11. return false
  12. }
  13. return password == pass
  14. }