config.go 526 B

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