2014-01-23 19:15:53 +00:00
|
|
|
package socks5
|
|
|
|
|
2016-01-11 07:36:53 +00:00
|
|
|
import "testing"
|
2014-01-23 19:15:53 +00:00
|
|
|
|
|
|
|
func TestPermitCommand(t *testing.T) {
|
|
|
|
r := &PermitCommand{true, false, false}
|
|
|
|
|
2016-01-11 07:36:53 +00:00
|
|
|
if !r.Allow(&Request{Command: ConnectCommand}) {
|
2014-01-23 19:15:53 +00:00
|
|
|
t.Fatalf("expect connect")
|
|
|
|
}
|
|
|
|
|
2016-01-11 07:36:53 +00:00
|
|
|
if r.Allow(&Request{Command: BindCommand}) {
|
2014-01-23 19:15:53 +00:00
|
|
|
t.Fatalf("do not expect bind")
|
|
|
|
}
|
|
|
|
|
2016-01-11 07:36:53 +00:00
|
|
|
if r.Allow(&Request{Command: AssociateCommand}) {
|
2014-01-23 19:15:53 +00:00
|
|
|
t.Fatalf("do not expect associate")
|
|
|
|
}
|
|
|
|
}
|