config.go 573 B

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