2019-02-01 14:08:21 -05:00
|
|
|
// +build !confonly
|
|
|
|
|
2016-01-15 06:43:06 -05:00
|
|
|
package socks
|
|
|
|
|
2017-04-28 08:58:58 -04:00
|
|
|
import "v2ray.com/core/common/protocol"
|
2016-01-15 06:43:06 -05:00
|
|
|
|
2017-09-07 16:58:10 -04:00
|
|
|
func (a *Account) Equals(another protocol.Account) bool {
|
2016-09-25 16:54:18 -04:00
|
|
|
if account, ok := another.(*Account); ok {
|
2017-09-07 16:58:10 -04:00
|
|
|
return a.Username == account.Username
|
2016-09-25 16:54:18 -04:00
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2017-09-07 16:58:10 -04:00
|
|
|
func (a *Account) AsAccount() (protocol.Account, error) {
|
|
|
|
return a, nil
|
2016-09-25 16:54:18 -04:00
|
|
|
}
|
|
|
|
|
2017-09-07 16:58:10 -04:00
|
|
|
func (c *ServerConfig) HasAccount(username, password string) bool {
|
|
|
|
if c.Accounts == nil {
|
2016-09-25 16:54:18 -04:00
|
|
|
return false
|
|
|
|
}
|
2017-09-07 16:58:10 -04:00
|
|
|
storedPassed, found := c.Accounts[username]
|
2016-09-25 16:54:18 -04:00
|
|
|
if !found {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
return storedPassed == password
|
|
|
|
}
|