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

     1  package http
     2  
     3  import (
     4  	"github.com/v2fly/v2ray-core/v4/common/protocol"
     5  )
     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 (sc *ServerConfig) HasAccount(username, password string) bool {
    19  	if sc.Accounts == nil {
    20  		return false
    21  	}
    22  
    23  	p, found := sc.Accounts[username]
    24  	if !found {
    25  		return false
    26  	}
    27  	return p == password
    28  }