1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-11-09 03:37:37 -05:00
v2fly/proxy/socks/config.go

26 lines
531 B
Go
Raw Normal View History

package socks
2021-02-16 15:31:50 -05:00
import "github.com/v2fly/v2ray-core/v4/common/protocol"
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
}