github.com/Uhtred009/v2ray-core-1@v4.31.2+incompatible/proxy/socks/config.go (about)

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