1
0

config.go 512 B

12345678910111213141516171819202122232425262728
  1. package http
  2. import (
  3. "github.com/xtls/xray-core/common/protocol"
  4. )
  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 (sc *ServerConfig) HasAccount(username, password string) bool {
  15. if sc.Accounts == nil {
  16. return false
  17. }
  18. p, found := sc.Accounts[username]
  19. if !found {
  20. return false
  21. }
  22. return p == password
  23. }