config.go 552 B

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