|
|
@ -2,22 +2,22 @@ package socks
|
|
|
|
|
|
|
|
|
|
|
|
import "v2ray.com/core/common/protocol"
|
|
|
|
import "v2ray.com/core/common/protocol"
|
|
|
|
|
|
|
|
|
|
|
|
func (v *Account) Equals(another protocol.Account) bool {
|
|
|
|
func (a *Account) Equals(another protocol.Account) bool {
|
|
|
|
if account, ok := another.(*Account); ok {
|
|
|
|
if account, ok := another.(*Account); ok {
|
|
|
|
return v.Username == account.Username
|
|
|
|
return a.Username == account.Username
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (v *Account) AsAccount() (protocol.Account, error) {
|
|
|
|
func (a *Account) AsAccount() (protocol.Account, error) {
|
|
|
|
return v, nil
|
|
|
|
return a, nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (v *ServerConfig) HasAccount(username, password string) bool {
|
|
|
|
func (c *ServerConfig) HasAccount(username, password string) bool {
|
|
|
|
if v.Accounts == nil {
|
|
|
|
if c.Accounts == nil {
|
|
|
|
return false
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
storedPassed, found := v.Accounts[username]
|
|
|
|
storedPassed, found := c.Accounts[username]
|
|
|
|
if !found {
|
|
|
|
if !found {
|
|
|
|
return false
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
}
|
|
|
|