summaryrefslogtreecommitdiff
path: root/vendor/golang.org/x/net/internal/sockstest/server_test.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2019-07-02 12:12:53 +0200
committerDimitri Sokolyuk <demon@dim13.org>2019-07-02 12:12:53 +0200
commit473acc61c8392dc7ae303d91568e179c4f105a76 (patch)
treea2070cba25f918cda460387e587dd60551b23894 /vendor/golang.org/x/net/internal/sockstest/server_test.go
parentdd45f63209a8e51979b11182253ee80b5289c10a (diff)
add black list
Diffstat (limited to 'vendor/golang.org/x/net/internal/sockstest/server_test.go')
-rw-r--r--vendor/golang.org/x/net/internal/sockstest/server_test.go103
1 files changed, 0 insertions, 103 deletions
diff --git a/vendor/golang.org/x/net/internal/sockstest/server_test.go b/vendor/golang.org/x/net/internal/sockstest/server_test.go
deleted file mode 100644
index 2b02d81..0000000
--- a/vendor/golang.org/x/net/internal/sockstest/server_test.go
+++ /dev/null
@@ -1,103 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package sockstest
-
-import (
- "net"
- "reflect"
- "testing"
-
- "golang.org/x/net/internal/socks"
-)
-
-func TestParseAuthRequest(t *testing.T) {
- for i, tt := range []struct {
- wire []byte
- req *AuthRequest
- }{
- {
- []byte{0x05, 0x00},
- &AuthRequest{
- socks.Version5,
- nil,
- },
- },
- {
- []byte{0x05, 0x01, 0xff},
- &AuthRequest{
- socks.Version5,
- []socks.AuthMethod{
- socks.AuthMethodNoAcceptableMethods,
- },
- },
- },
- {
- []byte{0x05, 0x02, 0x00, 0xff},
- &AuthRequest{
- socks.Version5,
- []socks.AuthMethod{
- socks.AuthMethodNotRequired,
- socks.AuthMethodNoAcceptableMethods,
- },
- },
- },
-
- // corrupted requests
- {nil, nil},
- {[]byte{0x00, 0x01}, nil},
- {[]byte{0x06, 0x00}, nil},
- {[]byte{0x05, 0x02, 0x00}, nil},
- } {
- req, err := ParseAuthRequest(tt.wire)
- if !reflect.DeepEqual(req, tt.req) {
- t.Errorf("#%d: got %v, %v; want %v", i, req, err, tt.req)
- continue
- }
- }
-}
-
-func TestParseCmdRequest(t *testing.T) {
- for i, tt := range []struct {
- wire []byte
- req *CmdRequest
- }{
- {
- []byte{0x05, 0x01, 0x00, 0x01, 192, 0, 2, 1, 0x17, 0x4b},
- &CmdRequest{
- socks.Version5,
- socks.CmdConnect,
- socks.Addr{
- IP: net.IP{192, 0, 2, 1},
- Port: 5963,
- },
- },
- },
- {
- []byte{0x05, 0x01, 0x00, 0x03, 0x04, 'F', 'Q', 'D', 'N', 0x17, 0x4b},
- &CmdRequest{
- socks.Version5,
- socks.CmdConnect,
- socks.Addr{
- Name: "FQDN",
- Port: 5963,
- },
- },
- },
-
- // corrupted requests
- {nil, nil},
- {[]byte{0x05}, nil},
- {[]byte{0x06, 0x01, 0x00, 0x01, 192, 0, 2, 2, 0x17, 0x4b}, nil},
- {[]byte{0x05, 0x01, 0xff, 0x01, 192, 0, 2, 3}, nil},
- {[]byte{0x05, 0x01, 0x00, 0x01, 192, 0, 2, 4}, nil},
- {[]byte{0x05, 0x01, 0x00, 0x03, 0x04, 'F', 'Q', 'D', 'N'}, nil},
- } {
- req, err := ParseCmdRequest(tt.wire)
- if !reflect.DeepEqual(req, tt.req) {
- t.Errorf("#%d: got %v, %v; want %v", i, req, err, tt.req)
- continue
- }
- }
-}