mirror of https://github.com/fatedier/frp.git
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.
25 lines
492 B
Go
25 lines
492 B
Go
package socks5
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"golang.org/x/net/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")
|
|
}
|
|
}
|