mirror of
https://github.com/asmogo/nws.git
synced 2024-12-15 11:46:21 +00:00
25 lines
475 B
Go
25 lines
475 B
Go
|
package socks5
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
|
||
|
"context"
|
||
|
)
|
||
|
|
||
|
func TestPermitCommand(t *testing.T) {
|
||
|
ctx := context.Background()
|
||
|
r := &PermitCommand{true, false, false}
|
||
|
|
||
|
if _, ok := r.Allow(ctx, &Request{Command: ConnectCommand}); !ok {
|
||
|
t.Fatalf("expect connect")
|
||
|
}
|
||
|
|
||
|
if _, ok := r.Allow(ctx, &Request{Command: BindCommand}); ok {
|
||
|
t.Fatalf("do not expect bind")
|
||
|
}
|
||
|
|
||
|
if _, ok := r.Allow(ctx, &Request{Command: AssociateCommand}); ok {
|
||
|
t.Fatalf("do not expect associate")
|
||
|
}
|
||
|
}
|