github.com/EagleQL/Xray-core@v1.4.3/proxy/socks/config.go (about)

     1  package socks
     2  
     3  import "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  
    12  func (a *Account) AsAccount() (protocol.Account, error) {
    13  	return a, nil
    14  }
    15  
    16  func (c *ServerConfig) HasAccount(username, password string) bool {
    17  	if c.Accounts == nil {
    18  		return false
    19  	}
    20  	storedPassed, found := c.Accounts[username]
    21  	if !found {
    22  		return false
    23  	}
    24  	return storedPassed == password
    25  }