config.go 515 B

12345678910111213141516171819202122232425
  1. package socks
  2. import "v2ray.com/core/common/protocol"
  3. func (v *Account) Equals(another protocol.Account) bool {
  4. if account, ok := another.(*Account); ok {
  5. return v.Username == account.Username
  6. }
  7. return false
  8. }
  9. func (v *Account) AsAccount() (protocol.Account, error) {
  10. return v, nil
  11. }
  12. func (v *ServerConfig) HasAccount(username, password string) bool {
  13. if v.Accounts == nil {
  14. return false
  15. }
  16. storedPassed, found := v.Accounts[username]
  17. if !found {
  18. return false
  19. }
  20. return storedPassed == password
  21. }