mirror of https://github.com/v2ray/v2ray-core
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.
30 lines
496 B
30 lines
496 B
9 years ago
|
package socks
|
||
9 years ago
|
|
||
|
import (
|
||
9 years ago
|
v2net "github.com/v2ray/v2ray-core/common/net"
|
||
9 years ago
|
)
|
||
|
|
||
9 years ago
|
const (
|
||
|
AuthTypeNoAuth = byte(0)
|
||
|
AuthTypePassword = byte(1)
|
||
|
)
|
||
|
|
||
|
type Config struct {
|
||
|
AuthType byte
|
||
|
Accounts map[string]string
|
||
|
Address v2net.Address
|
||
|
UDPEnabled bool
|
||
9 years ago
|
Timeout int
|
||
9 years ago
|
}
|
||
|
|
||
|
func (this *Config) HasAccount(username, password string) bool {
|
||
|
if this.Accounts == nil {
|
||
|
return false
|
||
|
}
|
||
|
storedPassed, found := this.Accounts[username]
|
||
|
if !found {
|
||
|
return false
|
||
|
}
|
||
|
return storedPassed == password
|
||
9 years ago
|
}
|