go-socks5/ruleset_test.go

20 lines
375 B
Go
Raw Normal View History

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