github.com/v2fly/v2ray-core/v4@v4.45.2/proxy/socks/config.go (about)

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