You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
v2ray-core/proxy/socks/config.go

36 lines
686 B

package socks
import (
8 years ago
"v2ray.com/core/common/net"
"v2ray.com/core/common/protocol"
)
8 years ago
func (v *Account) Equals(another protocol.Account) bool {
if account, ok := another.(*Account); ok {
8 years ago
return v.Username == account.Username
}
return false
}
8 years ago
func (v *Account) AsAccount() (protocol.Account, error) {
return v, nil
}
8 years ago
func (v *ServerConfig) HasAccount(username, password string) bool {
if v.Accounts == nil {
return false
}
8 years ago
storedPassed, found := v.Accounts[username]
if !found {
return false
}
return storedPassed == password
}
8 years ago
func (v *ServerConfig) GetNetAddress() net.Address {
8 years ago
if v.Address == nil {
8 years ago
return net.LocalHostIP
}
8 years ago
return v.Address.AsAddress()
}