From d34678d9a647d87a01bd7045c0a70ea72c98e00b Mon Sep 17 00:00:00 2001 From: V2Ray Date: Mon, 9 Nov 2015 23:52:31 +0100 Subject: [PATCH] fuzzing test for socks protocol --- proxy/socks/protocol/socks_fuzz_test.go | 28 +++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 proxy/socks/protocol/socks_fuzz_test.go diff --git a/proxy/socks/protocol/socks_fuzz_test.go b/proxy/socks/protocol/socks_fuzz_test.go new file mode 100644 index 00000000..d8ed1768 --- /dev/null +++ b/proxy/socks/protocol/socks_fuzz_test.go @@ -0,0 +1,28 @@ +package protocol + +import ( + "crypto/rand" + "testing" +) + +const ( + Iterations = int(500000) +) + +func TestReadAuthentication(t *testing.T) { + for i := 0; i < Iterations; i++ { + ReadAuthentication(rand.Reader) + } +} + +func TestReadUserPassRequest(t *testing.T) { + for i := 0; i < Iterations; i++ { + ReadUserPassRequest(rand.Reader) + } +} + +func TestReadRequest(t *testing.T) { + for i := 0; i < Iterations; i++ { + ReadRequest(rand.Reader) + } +}