v2ray-core/proxy/socks/config.go

26 lines
515 B
Go
Raw Normal View History

package socks
2017-04-28 12:58:58 +00:00
import "v2ray.com/core/common/protocol"
2017-09-07 20:58:10 +00:00
func (a *Account) Equals(another protocol.Account) bool {
2016-09-25 20:54:18 +00:00
if account, ok := another.(*Account); ok {
2017-09-07 20:58:10 +00:00
return a.Username == account.Username
2016-09-25 20:54:18 +00:00
}
return false
}
2017-09-07 20:58:10 +00:00
func (a *Account) AsAccount() (protocol.Account, error) {
return a, nil
2016-09-25 20:54:18 +00:00
}
2017-09-07 20:58:10 +00:00
func (c *ServerConfig) HasAccount(username, password string) bool {
if c.Accounts == nil {
2016-09-25 20:54:18 +00:00
return false
}
2017-09-07 20:58:10 +00:00
storedPassed, found := c.Accounts[username]
2016-09-25 20:54:18 +00:00
if !found {
return false
}
return storedPassed == password
}