You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
537 B
Go
24 lines
537 B
Go
6 years ago
|
package socks
|
||
|
|
||
|
import "net"
|
||
|
|
||
|
// AuthService the service to authenticate the user for socks5
|
||
|
type AuthService interface {
|
||
|
// Authenticate auth the user
|
||
|
// return true means ok, false means no access
|
||
|
Authenticate(username, password string, addr net.Addr) bool
|
||
|
}
|
||
|
|
||
|
// default password auth service
|
||
|
type passwordAuth struct {
|
||
|
username string
|
||
|
password string
|
||
|
}
|
||
|
|
||
|
func (pa *passwordAuth) Authenticate(username, password string, addr net.Addr) bool {
|
||
|
if username == pa.username && password == pa.password {
|
||
|
return true
|
||
|
}
|
||
|
return false
|
||
|
}
|