Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
G
gost
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
gost
Commits
dc884627
Commit
dc884627
authored
Dec 09, 2018
by
ginuerzh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix test
parent
e41c11d9
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
418 additions
and
553 deletions
+418
-553
http2_test.go
http2_test.go
+38
-63
http_test.go
http_test.go
+12
-15
kcp_test.go
kcp_test.go
+13
-16
quic_test.go
quic_test.go
+38
-48
socks_test.go
socks_test.go
+13
-17
ss_test.go
ss_test.go
+32
-55
ssh_test.go
ssh_test.go
+40
-50
tls_test.go
tls_test.go
+80
-99
ws_test.go
ws_test.go
+76
-95
wss_test.go
wss_test.go
+76
-95
No files found.
http2_test.go
View file @
dc884627
...
@@ -41,8 +41,6 @@ func TestHTTP2Proxy(t *testing.T) {
...
@@ -41,8 +41,6 @@ func TestHTTP2Proxy(t *testing.T) {
rand
.
Read
(
sendData
)
rand
.
Read
(
sendData
)
for
i
,
tc
:=
range
httpProxyTests
{
for
i
,
tc
:=
range
httpProxyTests
{
tc
:=
tc
t
.
Run
(
fmt
.
Sprintf
(
"#%d"
,
i
),
func
(
t
*
testing
.
T
)
{
err
:=
http2ProxyRoundtrip
(
httpSrv
.
URL
,
sendData
,
tc
.
cliUser
,
tc
.
srvUsers
)
err
:=
http2ProxyRoundtrip
(
httpSrv
.
URL
,
sendData
,
tc
.
cliUser
,
tc
.
srvUsers
)
if
err
==
nil
{
if
err
==
nil
{
if
tc
.
errStr
!=
""
{
if
tc
.
errStr
!=
""
{
...
@@ -56,7 +54,6 @@ func TestHTTP2Proxy(t *testing.T) {
...
@@ -56,7 +54,6 @@ func TestHTTP2Proxy(t *testing.T) {
t
.
Errorf
(
"#%d got error %v, want %v"
,
i
,
err
,
tc
.
errStr
)
t
.
Errorf
(
"#%d got error %v, want %v"
,
i
,
err
,
tc
.
errStr
)
}
}
}
}
})
}
}
}
}
...
@@ -162,8 +159,6 @@ func TestHTTPOverH2(t *testing.T) {
...
@@ -162,8 +159,6 @@ func TestHTTPOverH2(t *testing.T) {
rand
.
Read
(
sendData
)
rand
.
Read
(
sendData
)
for
i
,
tc
:=
range
httpProxyTests
{
for
i
,
tc
:=
range
httpProxyTests
{
tc
:=
tc
t
.
Run
(
fmt
.
Sprintf
(
"#%d"
,
i
),
func
(
t
*
testing
.
T
)
{
err
:=
httpOverH2Roundtrip
(
httpSrv
.
URL
,
sendData
,
nil
,
tc
.
cliUser
,
tc
.
srvUsers
)
err
:=
httpOverH2Roundtrip
(
httpSrv
.
URL
,
sendData
,
nil
,
tc
.
cliUser
,
tc
.
srvUsers
)
if
err
==
nil
{
if
err
==
nil
{
if
tc
.
errStr
!=
""
{
if
tc
.
errStr
!=
""
{
...
@@ -177,7 +172,6 @@ func TestHTTPOverH2(t *testing.T) {
...
@@ -177,7 +172,6 @@ func TestHTTPOverH2(t *testing.T) {
t
.
Errorf
(
"#%d got error %v, want %v"
,
i
,
err
,
tc
.
errStr
)
t
.
Errorf
(
"#%d got error %v, want %v"
,
i
,
err
,
tc
.
errStr
)
}
}
}
}
})
}
}
}
}
...
@@ -283,8 +277,6 @@ func TestSOCKS5OverH2(t *testing.T) {
...
@@ -283,8 +277,6 @@ func TestSOCKS5OverH2(t *testing.T) {
rand
.
Read
(
sendData
)
rand
.
Read
(
sendData
)
for
i
,
tc
:=
range
socks5ProxyTests
{
for
i
,
tc
:=
range
socks5ProxyTests
{
tc
:=
tc
t
.
Run
(
fmt
.
Sprintf
(
"#%d"
,
i
),
func
(
t
*
testing
.
T
)
{
err
:=
socks5OverH2Roundtrip
(
httpSrv
.
URL
,
sendData
,
err
:=
socks5OverH2Roundtrip
(
httpSrv
.
URL
,
sendData
,
nil
,
nil
,
tc
.
cliUser
,
tc
.
cliUser
,
...
@@ -300,7 +292,6 @@ func TestSOCKS5OverH2(t *testing.T) {
...
@@ -300,7 +292,6 @@ func TestSOCKS5OverH2(t *testing.T) {
t
.
Errorf
(
"#%d got error: %v"
,
i
,
err
)
t
.
Errorf
(
"#%d got error: %v"
,
i
,
err
)
}
}
}
}
})
}
}
}
}
...
@@ -409,22 +400,6 @@ func TestSSOverH2(t *testing.T) {
...
@@ -409,22 +400,6 @@ func TestSSOverH2(t *testing.T) {
sendData
:=
make
([]
byte
,
128
)
sendData
:=
make
([]
byte
,
128
)
rand
.
Read
(
sendData
)
rand
.
Read
(
sendData
)
var
ssProxyTests
=
[]
struct
{
clientCipher
*
url
.
Userinfo
serverCipher
*
url
.
Userinfo
pass
bool
}{
{
nil
,
nil
,
false
},
{
&
url
.
Userinfo
{},
&
url
.
Userinfo
{},
false
},
{
url
.
User
(
"abc"
),
url
.
User
(
"abc"
),
false
},
{
url
.
UserPassword
(
"abc"
,
"def"
),
url
.
UserPassword
(
"abc"
,
"def"
),
false
},
{
url
.
User
(
"aes-128-cfb"
),
url
.
User
(
"aes-128-cfb"
),
false
},
{
url
.
User
(
"aes-128-cfb"
),
url
.
UserPassword
(
"aes-128-cfb"
,
"123456"
),
false
},
{
url
.
UserPassword
(
"aes-128-cfb"
,
"123456"
),
url
.
User
(
"aes-128-cfb"
),
false
},
{
url
.
UserPassword
(
"aes-128-cfb"
,
"123456"
),
url
.
UserPassword
(
"aes-128-cfb"
,
"abc"
),
false
},
{
url
.
UserPassword
(
"aes-128-cfb"
,
"123456"
),
url
.
UserPassword
(
"aes-128-cfb"
,
"123456"
),
true
},
}
for
i
,
tc
:=
range
ssProxyTests
{
for
i
,
tc
:=
range
ssProxyTests
{
tc
:=
tc
tc
:=
tc
t
.
Run
(
fmt
.
Sprintf
(
"#%d"
,
i
),
func
(
t
*
testing
.
T
)
{
t
.
Run
(
fmt
.
Sprintf
(
"#%d"
,
i
),
func
(
t
*
testing
.
T
)
{
...
...
http_test.go
View file @
dc884627
...
@@ -158,8 +158,6 @@ func TestHTTPProxy(t *testing.T) {
...
@@ -158,8 +158,6 @@ func TestHTTPProxy(t *testing.T) {
rand
.
Read
(
sendData
)
rand
.
Read
(
sendData
)
for
i
,
tc
:=
range
httpProxyTests
{
for
i
,
tc
:=
range
httpProxyTests
{
tc
:=
tc
t
.
Run
(
fmt
.
Sprintf
(
"#%d"
,
i
),
func
(
t
*
testing
.
T
)
{
err
:=
httpProxyRoundtrip
(
httpSrv
.
URL
,
sendData
,
tc
.
cliUser
,
tc
.
srvUsers
)
err
:=
httpProxyRoundtrip
(
httpSrv
.
URL
,
sendData
,
tc
.
cliUser
,
tc
.
srvUsers
)
if
err
==
nil
{
if
err
==
nil
{
if
tc
.
errStr
!=
""
{
if
tc
.
errStr
!=
""
{
...
@@ -173,7 +171,6 @@ func TestHTTPProxy(t *testing.T) {
...
@@ -173,7 +171,6 @@ func TestHTTPProxy(t *testing.T) {
t
.
Errorf
(
"#%d got error %v, want %v"
,
i
,
err
,
tc
.
errStr
)
t
.
Errorf
(
"#%d got error %v, want %v"
,
i
,
err
,
tc
.
errStr
)
}
}
}
}
})
}
}
}
}
...
...
kcp_test.go
View file @
dc884627
...
@@ -290,8 +290,6 @@ func TestSSOverKCP(t *testing.T) {
...
@@ -290,8 +290,6 @@ func TestSSOverKCP(t *testing.T) {
rand
.
Read
(
sendData
)
rand
.
Read
(
sendData
)
for
i
,
tc
:=
range
ssProxyTests
{
for
i
,
tc
:=
range
ssProxyTests
{
tc
:=
tc
t
.
Run
(
fmt
.
Sprintf
(
"#%d"
,
i
),
func
(
t
*
testing
.
T
)
{
err
:=
ssOverKCPRoundtrip
(
httpSrv
.
URL
,
sendData
,
err
:=
ssOverKCPRoundtrip
(
httpSrv
.
URL
,
sendData
,
tc
.
clientCipher
,
tc
.
clientCipher
,
tc
.
serverCipher
,
tc
.
serverCipher
,
...
@@ -306,6 +304,5 @@ func TestSSOverKCP(t *testing.T) {
...
@@ -306,6 +304,5 @@ func TestSSOverKCP(t *testing.T) {
t
.
Errorf
(
"#%d got error: %v"
,
i
,
err
)
t
.
Errorf
(
"#%d got error: %v"
,
i
,
err
)
}
}
}
}
})
}
}
}
}
quic_test.go
View file @
dc884627
...
@@ -2,7 +2,6 @@ package gost
...
@@ -2,7 +2,6 @@ package gost
import
(
import
(
"crypto/rand"
"crypto/rand"
"fmt"
"net/http/httptest"
"net/http/httptest"
"net/url"
"net/url"
"testing"
"testing"
...
@@ -42,8 +41,6 @@ func TestHTTPOverQUIC(t *testing.T) {
...
@@ -42,8 +41,6 @@ func TestHTTPOverQUIC(t *testing.T) {
rand
.
Read
(
sendData
)
rand
.
Read
(
sendData
)
for
i
,
tc
:=
range
httpProxyTests
{
for
i
,
tc
:=
range
httpProxyTests
{
tc
:=
tc
t
.
Run
(
fmt
.
Sprintf
(
"#%d"
,
i
),
func
(
t
*
testing
.
T
)
{
err
:=
httpOverQUICRoundtrip
(
httpSrv
.
URL
,
sendData
,
tc
.
cliUser
,
tc
.
srvUsers
)
err
:=
httpOverQUICRoundtrip
(
httpSrv
.
URL
,
sendData
,
tc
.
cliUser
,
tc
.
srvUsers
)
if
err
==
nil
{
if
err
==
nil
{
if
tc
.
errStr
!=
""
{
if
tc
.
errStr
!=
""
{
...
@@ -57,7 +54,6 @@ func TestHTTPOverQUIC(t *testing.T) {
...
@@ -57,7 +54,6 @@ func TestHTTPOverQUIC(t *testing.T) {
t
.
Errorf
(
"#%d got error %v, want %v"
,
i
,
err
,
tc
.
errStr
)
t
.
Errorf
(
"#%d got error %v, want %v"
,
i
,
err
,
tc
.
errStr
)
}
}
}
}
})
}
}
}
}
...
@@ -163,8 +159,6 @@ func TestSOCKS5OverQUIC(t *testing.T) {
...
@@ -163,8 +159,6 @@ func TestSOCKS5OverQUIC(t *testing.T) {
rand
.
Read
(
sendData
)
rand
.
Read
(
sendData
)
for
i
,
tc
:=
range
socks5ProxyTests
{
for
i
,
tc
:=
range
socks5ProxyTests
{
tc
:=
tc
t
.
Run
(
fmt
.
Sprintf
(
"#%d"
,
i
),
func
(
t
*
testing
.
T
)
{
err
:=
socks5OverQUICRoundtrip
(
httpSrv
.
URL
,
sendData
,
err
:=
socks5OverQUICRoundtrip
(
httpSrv
.
URL
,
sendData
,
tc
.
cliUser
,
tc
.
cliUser
,
tc
.
srvUsers
,
tc
.
srvUsers
,
...
@@ -179,7 +173,6 @@ func TestSOCKS5OverQUIC(t *testing.T) {
...
@@ -179,7 +173,6 @@ func TestSOCKS5OverQUIC(t *testing.T) {
t
.
Errorf
(
"#%d got error: %v"
,
i
,
err
)
t
.
Errorf
(
"#%d got error: %v"
,
i
,
err
)
}
}
}
}
})
}
}
}
}
...
@@ -290,8 +283,6 @@ func TestSSOverQUIC(t *testing.T) {
...
@@ -290,8 +283,6 @@ func TestSSOverQUIC(t *testing.T) {
rand
.
Read
(
sendData
)
rand
.
Read
(
sendData
)
for
i
,
tc
:=
range
ssProxyTests
{
for
i
,
tc
:=
range
ssProxyTests
{
tc
:=
tc
t
.
Run
(
fmt
.
Sprintf
(
"#%d"
,
i
),
func
(
t
*
testing
.
T
)
{
err
:=
ssOverQUICRoundtrip
(
httpSrv
.
URL
,
sendData
,
err
:=
ssOverQUICRoundtrip
(
httpSrv
.
URL
,
sendData
,
tc
.
clientCipher
,
tc
.
clientCipher
,
tc
.
serverCipher
,
tc
.
serverCipher
,
...
@@ -306,6 +297,5 @@ func TestSSOverQUIC(t *testing.T) {
...
@@ -306,6 +297,5 @@ func TestSSOverQUIC(t *testing.T) {
t
.
Errorf
(
"#%d got error: %v"
,
i
,
err
)
t
.
Errorf
(
"#%d got error: %v"
,
i
,
err
)
}
}
}
}
})
}
}
}
}
socks_test.go
View file @
dc884627
...
@@ -3,7 +3,6 @@ package gost
...
@@ -3,7 +3,6 @@ package gost
import
(
import
(
"crypto/rand"
"crypto/rand"
"crypto/tls"
"crypto/tls"
"fmt"
"net/http/httptest"
"net/http/httptest"
"net/url"
"net/url"
"testing"
"testing"
...
@@ -67,8 +66,6 @@ func TestSOCKS5Proxy(t *testing.T) {
...
@@ -67,8 +66,6 @@ func TestSOCKS5Proxy(t *testing.T) {
rand
.
Read
(
sendData
)
rand
.
Read
(
sendData
)
for
i
,
tc
:=
range
socks5ProxyTests
{
for
i
,
tc
:=
range
socks5ProxyTests
{
tc
:=
tc
t
.
Run
(
fmt
.
Sprintf
(
"#%d"
,
i
),
func
(
t
*
testing
.
T
)
{
err
:=
socks5ProxyRoundtrip
(
httpSrv
.
URL
,
sendData
,
err
:=
socks5ProxyRoundtrip
(
httpSrv
.
URL
,
sendData
,
tc
.
cliUser
,
tc
.
cliUser
,
tc
.
srvUsers
,
tc
.
srvUsers
,
...
@@ -83,7 +80,6 @@ func TestSOCKS5Proxy(t *testing.T) {
...
@@ -83,7 +80,6 @@ func TestSOCKS5Proxy(t *testing.T) {
t
.
Errorf
(
"#%d got error: %v"
,
i
,
err
)
t
.
Errorf
(
"#%d got error: %v"
,
i
,
err
)
}
}
}
}
})
}
}
}
}
...
...
ss_test.go
View file @
dc884627
...
@@ -2,13 +2,12 @@ package gost
...
@@ -2,13 +2,12 @@ package gost
import
(
import
(
"crypto/rand"
"crypto/rand"
"fmt"
"net/http/httptest"
"net/http/httptest"
"net/url"
"net/url"
"testing"
"testing"
)
)
var
ss
Proxy
Tests
=
[]
struct
{
var
ssTests
=
[]
struct
{
clientCipher
*
url
.
Userinfo
clientCipher
*
url
.
Userinfo
serverCipher
*
url
.
Userinfo
serverCipher
*
url
.
Userinfo
pass
bool
pass
bool
...
@@ -23,54 +22,18 @@ var ssProxyTests = []struct {
...
@@ -23,54 +22,18 @@ var ssProxyTests = []struct {
{
url
.
UserPassword
(
"aes-128-cfb"
,
"123456"
),
url
.
User
(
"aes-128-cfb"
),
false
},
{
url
.
UserPassword
(
"aes-128-cfb"
,
"123456"
),
url
.
User
(
"aes-128-cfb"
),
false
},
{
url
.
UserPassword
(
"aes-128-cfb"
,
"123456"
),
url
.
UserPassword
(
"aes-128-cfb"
,
"abc"
),
false
},
{
url
.
UserPassword
(
"aes-128-cfb"
,
"123456"
),
url
.
UserPassword
(
"aes-128-cfb"
,
"abc"
),
false
},
{
url
.
UserPassword
(
"aes-128-cfb"
,
"123456"
),
url
.
UserPassword
(
"aes-128-cfb"
,
"123456"
),
true
},
{
url
.
UserPassword
(
"aes-128-cfb"
,
"123456"
),
url
.
UserPassword
(
"aes-128-cfb"
,
"123456"
),
true
},
// {url.UserPassword("aes-128-cfb", "123456"), url.UserPassword("aes-192-cfb", "123456"), false},
// {url.UserPassword("aes-128-cfb", "123456"), url.UserPassword("aes-256-cfb", "123456"), false},
// {url.UserPassword("aes-128-cfb", "123456"), url.UserPassword("aes-128-ctr", "123456"), false},
// {url.UserPassword("aes-128-cfb", "123456"), url.UserPassword("aes-192-ctr", "123456"), false},
// {url.UserPassword("aes-128-cfb", "123456"), url.UserPassword("aes-256-ctr", "123456"), false},
// {url.UserPassword("aes-128-cfb", "123456"), url.UserPassword("des-cfb", "123456"), false},
// {url.UserPassword("aes-128-cfb", "123456"), url.UserPassword("bf-cfb", "123456"), false},
// {url.UserPassword("aes-128-cfb", "123456"), url.UserPassword("cast5-cfb", "123456"), false},
// {url.UserPassword("aes-128-cfb", "123456"), url.UserPassword("rc4-md5", "123456"), false},
// {url.UserPassword("aes-128-cfb", "123456"), url.UserPassword("chacha20", "123456"), false},
// {url.UserPassword("aes-128-cfb", "123456"), url.UserPassword("chacha20-ietf", "123456"), false},
// {url.UserPassword("aes-128-cfb", "123456"), url.UserPassword("salsa20", "123456"), false},
{
url
.
User
(
"aes-192-cfb"
),
url
.
User
(
"aes-192-cfb"
),
false
},
{
url
.
User
(
"aes-192-cfb"
),
url
.
User
(
"aes-192-cfb"
),
false
},
{
url
.
User
(
"aes-192-cfb"
),
url
.
UserPassword
(
"aes-192-cfb"
,
"123456"
),
false
},
{
url
.
User
(
"aes-192-cfb"
),
url
.
UserPassword
(
"aes-192-cfb"
,
"123456"
),
false
},
{
url
.
UserPassword
(
"aes-192-cfb"
,
"123456"
),
url
.
User
(
"aes-192-cfb"
),
false
},
{
url
.
UserPassword
(
"aes-192-cfb"
,
"123456"
),
url
.
User
(
"aes-192-cfb"
),
false
},
{
url
.
UserPassword
(
"aes-192-cfb"
,
"123456"
),
url
.
UserPassword
(
"aes-192-cfb"
,
"abc"
),
false
},
{
url
.
UserPassword
(
"aes-192-cfb"
,
"123456"
),
url
.
UserPassword
(
"aes-192-cfb"
,
"abc"
),
false
},
{
url
.
UserPassword
(
"aes-192-cfb"
,
"123456"
),
url
.
UserPassword
(
"aes-192-cfb"
,
"123456"
),
true
},
{
url
.
UserPassword
(
"aes-192-cfb"
,
"123456"
),
url
.
UserPassword
(
"aes-192-cfb"
,
"123456"
),
true
},
// {url.UserPassword("aes-192-cfb", "123456"), url.UserPassword("aes-128-cfb", "123456"), false},
// {url.UserPassword("aes-192-cfb", "123456"), url.UserPassword("aes-256-cfb", "123456"), false},
// {url.UserPassword("aes-192-cfb", "123456"), url.UserPassword("aes-128-ctr", "123456"), false},
// {url.UserPassword("aes-192-cfb", "123456"), url.UserPassword("aes-192-ctr", "123456"), false},
// {url.UserPassword("aes-192-cfb", "123456"), url.UserPassword("aes-256-ctr", "123456"), false},
// {url.UserPassword("aes-192-cfb", "123456"), url.UserPassword("des-cfb", "123456"), false},
// {url.UserPassword("aes-192-cfb", "123456"), url.UserPassword("bf-cfb", "123456"), false},
// {url.UserPassword("aes-192-cfb", "123456"), url.UserPassword("cast5-cfb", "123456"), false},
// {url.UserPassword("aes-192-cfb", "123456"), url.UserPassword("rc4-md5", "123456"), false},
// {url.UserPassword("aes-192-cfb", "123456"), url.UserPassword("chacha20", "123456"), false},
// {url.UserPassword("aes-192-cfb", "123456"), url.UserPassword("chacha20-ietf", "123456"), false},
// {url.UserPassword("aes-192-cfb", "123456"), url.UserPassword("salsa20", "123456"), false},
{
url
.
User
(
"aes-256-cfb"
),
url
.
User
(
"aes-256-cfb"
),
false
},
{
url
.
User
(
"aes-256-cfb"
),
url
.
User
(
"aes-256-cfb"
),
false
},
{
url
.
User
(
"aes-256-cfb"
),
url
.
UserPassword
(
"aes-256-cfb"
,
"123456"
),
false
},
{
url
.
User
(
"aes-256-cfb"
),
url
.
UserPassword
(
"aes-256-cfb"
,
"123456"
),
false
},
{
url
.
UserPassword
(
"aes-256-cfb"
,
"123456"
),
url
.
User
(
"aes-256-cfb"
),
false
},
{
url
.
UserPassword
(
"aes-256-cfb"
,
"123456"
),
url
.
User
(
"aes-256-cfb"
),
false
},
{
url
.
UserPassword
(
"aes-256-cfb"
,
"123456"
),
url
.
UserPassword
(
"aes-256-cfb"
,
"abc"
),
false
},
{
url
.
UserPassword
(
"aes-256-cfb"
,
"123456"
),
url
.
UserPassword
(
"aes-256-cfb"
,
"abc"
),
false
},
{
url
.
UserPassword
(
"aes-256-cfb"
,
"123456"
),
url
.
UserPassword
(
"aes-256-cfb"
,
"123456"
),
true
},
{
url
.
UserPassword
(
"aes-256-cfb"
,
"123456"
),
url
.
UserPassword
(
"aes-256-cfb"
,
"123456"
),
true
},
// {url.UserPassword("aes-256-cfb", "123456"), url.UserPassword("aes-128-cfb", "123456"), false},
// {url.UserPassword("aes-256-cfb", "123456"), url.UserPassword("aes-192-cfb", "123456"), false},
// {url.UserPassword("aes-256-cfb", "123456"), url.UserPassword("aes-128-ctr", "123456"), false},
// {url.UserPassword("aes-256-cfb", "123456"), url.UserPassword("aes-192-ctr", "123456"), false},
// {url.UserPassword("aes-256-cfb", "123456"), url.UserPassword("aes-256-ctr", "123456"), false},
// {url.UserPassword("aes-256-cfb", "123456"), url.UserPassword("des-cfb", "123456"), false},
// {url.UserPassword("aes-256-cfb", "123456"), url.UserPassword("bf-cfb", "123456"), false},
// {url.UserPassword("aes-256-cfb", "123456"), url.UserPassword("cast5-cfb", "123456"), false},
// {url.UserPassword("aes-256-cfb", "123456"), url.UserPassword("rc4-md5", "123456"), false},
// {url.UserPassword("aes-256-cfb", "123456"), url.UserPassword("chacha20", "123456"), false},
// {url.UserPassword("aes-256-cfb", "123456"), url.UserPassword("chacha20-ietf", "123456"), false},
// {url.UserPassword("aes-256-cfb", "123456"), url.UserPassword("salsa20", "123456"), false},
{
url
.
User
(
"aes-128-ctr"
),
url
.
User
(
"aes-128-ctr"
),
false
},
{
url
.
User
(
"aes-128-ctr"
),
url
.
User
(
"aes-128-ctr"
),
false
},
{
url
.
User
(
"aes-128-ctr"
),
url
.
UserPassword
(
"aes-128-ctr"
,
"123456"
),
false
},
{
url
.
User
(
"aes-128-ctr"
),
url
.
UserPassword
(
"aes-128-ctr"
,
"123456"
),
false
},
...
@@ -133,6 +96,23 @@ var ssProxyTests = []struct {
...
@@ -133,6 +96,23 @@ var ssProxyTests = []struct {
{
url
.
UserPassword
(
"salsa20"
,
"123456"
),
url
.
UserPassword
(
"salsa20"
,
"123456"
),
true
},
{
url
.
UserPassword
(
"salsa20"
,
"123456"
),
url
.
UserPassword
(
"salsa20"
,
"123456"
),
true
},
}
}
var
ssProxyTests
=
[]
struct
{
clientCipher
*
url
.
Userinfo
serverCipher
*
url
.
Userinfo
pass
bool
}{
{
nil
,
nil
,
false
},
{
&
url
.
Userinfo
{},
&
url
.
Userinfo
{},
false
},
{
url
.
User
(
"abc"
),
url
.
User
(
"abc"
),
false
},
{
url
.
UserPassword
(
"abc"
,
"def"
),
url
.
UserPassword
(
"abc"
,
"def"
),
false
},
{
url
.
User
(
"aes-128-cfb"
),
url
.
User
(
"aes-128-cfb"
),
false
},
{
url
.
User
(
"aes-128-cfb"
),
url
.
UserPassword
(
"aes-128-cfb"
,
"123456"
),
false
},
{
url
.
UserPassword
(
"aes-128-cfb"
,
"123456"
),
url
.
User
(
"aes-128-cfb"
),
false
},
{
url
.
UserPassword
(
"aes-128-cfb"
,
"123456"
),
url
.
UserPassword
(
"aes-128-cfb"
,
"abc"
),
false
},
{
url
.
UserPassword
(
"aes-128-cfb"
,
"123456"
),
url
.
UserPassword
(
"aes-128-cfb"
,
"123456"
),
true
},
}
func
ssProxyRoundtrip
(
targetURL
string
,
data
[]
byte
,
clientInfo
*
url
.
Userinfo
,
serverInfo
*
url
.
Userinfo
)
error
{
func
ssProxyRoundtrip
(
targetURL
string
,
data
[]
byte
,
clientInfo
*
url
.
Userinfo
,
serverInfo
*
url
.
Userinfo
)
error
{
ln
,
err
:=
TCPListener
(
""
)
ln
,
err
:=
TCPListener
(
""
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -162,9 +142,7 @@ func TestSSProxy(t *testing.T) {
...
@@ -162,9 +142,7 @@ func TestSSProxy(t *testing.T) {
sendData
:=
make
([]
byte
,
128
)
sendData
:=
make
([]
byte
,
128
)
rand
.
Read
(
sendData
)
rand
.
Read
(
sendData
)
for
i
,
tc
:=
range
ssProxyTests
{
for
i
,
tc
:=
range
ssTests
{
tc
:=
tc
t
.
Run
(
fmt
.
Sprintf
(
"#%d"
,
i
),
func
(
t
*
testing
.
T
)
{
err
:=
ssProxyRoundtrip
(
httpSrv
.
URL
,
sendData
,
err
:=
ssProxyRoundtrip
(
httpSrv
.
URL
,
sendData
,
tc
.
clientCipher
,
tc
.
clientCipher
,
tc
.
serverCipher
,
tc
.
serverCipher
,
...
@@ -179,7 +157,6 @@ func TestSSProxy(t *testing.T) {
...
@@ -179,7 +157,6 @@ func TestSSProxy(t *testing.T) {
t
.
Errorf
(
"#%d got error: %v"
,
i
,
err
)
t
.
Errorf
(
"#%d got error: %v"
,
i
,
err
)
}
}
}
}
})
}
}
}
}
...
...
ssh_test.go
View file @
dc884627
...
@@ -3,7 +3,6 @@ package gost
...
@@ -3,7 +3,6 @@ package gost
import
(
import
(
"crypto/rand"
"crypto/rand"
"crypto/tls"
"crypto/tls"
"fmt"
"net/http/httptest"
"net/http/httptest"
"net/url"
"net/url"
"testing"
"testing"
...
@@ -43,8 +42,6 @@ func TestHTTPOverSSHTunnel(t *testing.T) {
...
@@ -43,8 +42,6 @@ func TestHTTPOverSSHTunnel(t *testing.T) {
rand
.
Read
(
sendData
)
rand
.
Read
(
sendData
)
for
i
,
tc
:=
range
httpProxyTests
{
for
i
,
tc
:=
range
httpProxyTests
{
tc
:=
tc
t
.
Run
(
fmt
.
Sprintf
(
"#%d"
,
i
),
func
(
t
*
testing
.
T
)
{
err
:=
httpOverSSHTunnelRoundtrip
(
httpSrv
.
URL
,
sendData
,
nil
,
tc
.
cliUser
,
tc
.
srvUsers
)
err
:=
httpOverSSHTunnelRoundtrip
(
httpSrv
.
URL
,
sendData
,
nil
,
tc
.
cliUser
,
tc
.
srvUsers
)
if
err
==
nil
{
if
err
==
nil
{
if
tc
.
errStr
!=
""
{
if
tc
.
errStr
!=
""
{
...
@@ -58,7 +55,6 @@ func TestHTTPOverSSHTunnel(t *testing.T) {
...
@@ -58,7 +55,6 @@ func TestHTTPOverSSHTunnel(t *testing.T) {
t
.
Errorf
(
"#%d got error %v, want %v"
,
i
,
err
,
tc
.
errStr
)
t
.
Errorf
(
"#%d got error %v, want %v"
,
i
,
err
,
tc
.
errStr
)
}
}
}
}
})
}
}
}
}
...
@@ -164,8 +160,6 @@ func TestSOCKS5OverSSHTunnel(t *testing.T) {
...
@@ -164,8 +160,6 @@ func TestSOCKS5OverSSHTunnel(t *testing.T) {
rand
.
Read
(
sendData
)
rand
.
Read
(
sendData
)
for
i
,
tc
:=
range
socks5ProxyTests
{
for
i
,
tc
:=
range
socks5ProxyTests
{
tc
:=
tc
t
.
Run
(
fmt
.
Sprintf
(
"#%d"
,
i
),
func
(
t
*
testing
.
T
)
{
err
:=
socks5OverSSHTunnelRoundtrip
(
httpSrv
.
URL
,
sendData
,
err
:=
socks5OverSSHTunnelRoundtrip
(
httpSrv
.
URL
,
sendData
,
nil
,
nil
,
tc
.
cliUser
,
tc
.
cliUser
,
...
@@ -181,7 +175,6 @@ func TestSOCKS5OverSSHTunnel(t *testing.T) {
...
@@ -181,7 +175,6 @@ func TestSOCKS5OverSSHTunnel(t *testing.T) {
t
.
Errorf
(
"#%d got error: %v"
,
i
,
err
)
t
.
Errorf
(
"#%d got error: %v"
,
i
,
err
)
}
}
}
}
})
}
}
}
}
...
@@ -291,8 +284,6 @@ func TestSSOverSSHTunnel(t *testing.T) {
...
@@ -291,8 +284,6 @@ func TestSSOverSSHTunnel(t *testing.T) {
rand
.
Read
(
sendData
)
rand
.
Read
(
sendData
)
for
i
,
tc
:=
range
ssProxyTests
{
for
i
,
tc
:=
range
ssProxyTests
{
tc
:=
tc
t
.
Run
(
fmt
.
Sprintf
(
"#%d"
,
i
),
func
(
t
*
testing
.
T
)
{
err
:=
ssOverSSHTunnelRoundtrip
(
httpSrv
.
URL
,
sendData
,
err
:=
ssOverSSHTunnelRoundtrip
(
httpSrv
.
URL
,
sendData
,
nil
,
nil
,
tc
.
clientCipher
,
tc
.
clientCipher
,
...
@@ -308,6 +299,5 @@ func TestSSOverSSHTunnel(t *testing.T) {
...
@@ -308,6 +299,5 @@ func TestSSOverSSHTunnel(t *testing.T) {
t
.
Errorf
(
"#%d got error: %v"
,
i
,
err
)
t
.
Errorf
(
"#%d got error: %v"
,
i
,
err
)
}
}
}
}
})
}
}
}
}
tls_test.go
View file @
dc884627
...
@@ -3,7 +3,6 @@ package gost
...
@@ -3,7 +3,6 @@ package gost
import
(
import
(
"crypto/rand"
"crypto/rand"
"crypto/tls"
"crypto/tls"
"fmt"
"net/http/httptest"
"net/http/httptest"
"net/url"
"net/url"
"testing"
"testing"
...
@@ -43,8 +42,6 @@ func TestHTTPOverTLS(t *testing.T) {
...
@@ -43,8 +42,6 @@ func TestHTTPOverTLS(t *testing.T) {
rand
.
Read
(
sendData
)
rand
.
Read
(
sendData
)
for
i
,
tc
:=
range
httpProxyTests
{
for
i
,
tc
:=
range
httpProxyTests
{
tc
:=
tc
t
.
Run
(
fmt
.
Sprintf
(
"#%d"
,
i
),
func
(
t
*
testing
.
T
)
{
err
:=
httpOverTLSRoundtrip
(
httpSrv
.
URL
,
sendData
,
nil
,
tc
.
cliUser
,
tc
.
srvUsers
)
err
:=
httpOverTLSRoundtrip
(
httpSrv
.
URL
,
sendData
,
nil
,
tc
.
cliUser
,
tc
.
srvUsers
)
if
err
==
nil
{
if
err
==
nil
{
if
tc
.
errStr
!=
""
{
if
tc
.
errStr
!=
""
{
...
@@ -58,7 +55,6 @@ func TestHTTPOverTLS(t *testing.T) {
...
@@ -58,7 +55,6 @@ func TestHTTPOverTLS(t *testing.T) {
t
.
Errorf
(
"#%d got error %v, want %v"
,
i
,
err
,
tc
.
errStr
)
t
.
Errorf
(
"#%d got error %v, want %v"
,
i
,
err
,
tc
.
errStr
)
}
}
}
}
})
}
}
}
}
...
@@ -164,8 +160,6 @@ func TestSOCKS5OverTLS(t *testing.T) {
...
@@ -164,8 +160,6 @@ func TestSOCKS5OverTLS(t *testing.T) {
rand
.
Read
(
sendData
)
rand
.
Read
(
sendData
)
for
i
,
tc
:=
range
socks5ProxyTests
{
for
i
,
tc
:=
range
socks5ProxyTests
{
tc
:=
tc
t
.
Run
(
fmt
.
Sprintf
(
"#%d"
,
i
),
func
(
t
*
testing
.
T
)
{
err
:=
socks5OverTLSRoundtrip
(
httpSrv
.
URL
,
sendData
,
err
:=
socks5OverTLSRoundtrip
(
httpSrv
.
URL
,
sendData
,
nil
,
nil
,
tc
.
cliUser
,
tc
.
cliUser
,
...
@@ -181,7 +175,6 @@ func TestSOCKS5OverTLS(t *testing.T) {
...
@@ -181,7 +175,6 @@ func TestSOCKS5OverTLS(t *testing.T) {
t
.
Errorf
(
"#%d got error: %v"
,
i
,
err
)
t
.
Errorf
(
"#%d got error: %v"
,
i
,
err
)
}
}
}
}
})
}
}
}
}
...
@@ -291,8 +284,6 @@ func TestSSOverTLS(t *testing.T) {
...
@@ -291,8 +284,6 @@ func TestSSOverTLS(t *testing.T) {
rand
.
Read
(
sendData
)
rand
.
Read
(
sendData
)
for
i
,
tc
:=
range
ssProxyTests
{
for
i
,
tc
:=
range
ssProxyTests
{
tc
:=
tc
t
.
Run
(
fmt
.
Sprintf
(
"#%d"
,
i
),
func
(
t
*
testing
.
T
)
{
err
:=
ssOverTLSRoundtrip
(
httpSrv
.
URL
,
sendData
,
err
:=
ssOverTLSRoundtrip
(
httpSrv
.
URL
,
sendData
,
nil
,
nil
,
tc
.
clientCipher
,
tc
.
clientCipher
,
...
@@ -308,7 +299,6 @@ func TestSSOverTLS(t *testing.T) {
...
@@ -308,7 +299,6 @@ func TestSSOverTLS(t *testing.T) {
t
.
Errorf
(
"#%d got error: %v"
,
i
,
err
)
t
.
Errorf
(
"#%d got error: %v"
,
i
,
err
)
}
}
}
}
})
}
}
}
}
...
@@ -346,8 +336,6 @@ func TestHTTPOverMTLS(t *testing.T) {
...
@@ -346,8 +336,6 @@ func TestHTTPOverMTLS(t *testing.T) {
rand
.
Read
(
sendData
)
rand
.
Read
(
sendData
)
for
i
,
tc
:=
range
httpProxyTests
{
for
i
,
tc
:=
range
httpProxyTests
{
tc
:=
tc
t
.
Run
(
fmt
.
Sprintf
(
"#%d"
,
i
),
func
(
t
*
testing
.
T
)
{
err
:=
httpOverMTLSRoundtrip
(
httpSrv
.
URL
,
sendData
,
nil
,
tc
.
cliUser
,
tc
.
srvUsers
)
err
:=
httpOverMTLSRoundtrip
(
httpSrv
.
URL
,
sendData
,
nil
,
tc
.
cliUser
,
tc
.
srvUsers
)
if
err
==
nil
{
if
err
==
nil
{
if
tc
.
errStr
!=
""
{
if
tc
.
errStr
!=
""
{
...
@@ -361,7 +349,6 @@ func TestHTTPOverMTLS(t *testing.T) {
...
@@ -361,7 +349,6 @@ func TestHTTPOverMTLS(t *testing.T) {
t
.
Errorf
(
"#%d got error %v, want %v"
,
i
,
err
,
tc
.
errStr
)
t
.
Errorf
(
"#%d got error %v, want %v"
,
i
,
err
,
tc
.
errStr
)
}
}
}
}
})
}
}
}
}
...
@@ -467,8 +454,6 @@ func TestSOCKS5OverMTLS(t *testing.T) {
...
@@ -467,8 +454,6 @@ func TestSOCKS5OverMTLS(t *testing.T) {
rand
.
Read
(
sendData
)
rand
.
Read
(
sendData
)
for
i
,
tc
:=
range
socks5ProxyTests
{
for
i
,
tc
:=
range
socks5ProxyTests
{
tc
:=
tc
t
.
Run
(
fmt
.
Sprintf
(
"#%d"
,
i
),
func
(
t
*
testing
.
T
)
{
err
:=
socks5OverMTLSRoundtrip
(
httpSrv
.
URL
,
sendData
,
err
:=
socks5OverMTLSRoundtrip
(
httpSrv
.
URL
,
sendData
,
nil
,
nil
,
tc
.
cliUser
,
tc
.
cliUser
,
...
@@ -484,7 +469,6 @@ func TestSOCKS5OverMTLS(t *testing.T) {
...
@@ -484,7 +469,6 @@ func TestSOCKS5OverMTLS(t *testing.T) {
t
.
Errorf
(
"#%d got error: %v"
,
i
,
err
)
t
.
Errorf
(
"#%d got error: %v"
,
i
,
err
)
}
}
}
}
})
}
}
}
}
...
@@ -594,8 +578,6 @@ func TestSSOverMTLS(t *testing.T) {
...
@@ -594,8 +578,6 @@ func TestSSOverMTLS(t *testing.T) {
rand
.
Read
(
sendData
)
rand
.
Read
(
sendData
)
for
i
,
tc
:=
range
ssProxyTests
{
for
i
,
tc
:=
range
ssProxyTests
{
tc
:=
tc
t
.
Run
(
fmt
.
Sprintf
(
"#%d"
,
i
),
func
(
t
*
testing
.
T
)
{
err
:=
ssOverMTLSRoundtrip
(
httpSrv
.
URL
,
sendData
,
err
:=
ssOverMTLSRoundtrip
(
httpSrv
.
URL
,
sendData
,
nil
,
nil
,
tc
.
clientCipher
,
tc
.
clientCipher
,
...
@@ -611,6 +593,5 @@ func TestSSOverMTLS(t *testing.T) {
...
@@ -611,6 +593,5 @@ func TestSSOverMTLS(t *testing.T) {
t
.
Errorf
(
"#%d got error: %v"
,
i
,
err
)
t
.
Errorf
(
"#%d got error: %v"
,
i
,
err
)
}
}
}
}
})
}
}
}
}
ws_test.go
View file @
dc884627
...
@@ -2,7 +2,6 @@ package gost
...
@@ -2,7 +2,6 @@ package gost
import
(
import
(
"crypto/rand"
"crypto/rand"
"fmt"
"net/http/httptest"
"net/http/httptest"
"net/url"
"net/url"
"testing"
"testing"
...
@@ -42,8 +41,6 @@ func TestHTTPOverWS(t *testing.T) {
...
@@ -42,8 +41,6 @@ func TestHTTPOverWS(t *testing.T) {
rand
.
Read
(
sendData
)
rand
.
Read
(
sendData
)
for
i
,
tc
:=
range
httpProxyTests
{
for
i
,
tc
:=
range
httpProxyTests
{
tc
:=
tc
t
.
Run
(
fmt
.
Sprintf
(
"#%d"
,
i
),
func
(
t
*
testing
.
T
)
{
err
:=
httpOverWSRoundtrip
(
httpSrv
.
URL
,
sendData
,
tc
.
cliUser
,
tc
.
srvUsers
)
err
:=
httpOverWSRoundtrip
(
httpSrv
.
URL
,
sendData
,
tc
.
cliUser
,
tc
.
srvUsers
)
if
err
==
nil
{
if
err
==
nil
{
if
tc
.
errStr
!=
""
{
if
tc
.
errStr
!=
""
{
...
@@ -57,7 +54,6 @@ func TestHTTPOverWS(t *testing.T) {
...
@@ -57,7 +54,6 @@ func TestHTTPOverWS(t *testing.T) {
t
.
Errorf
(
"#%d got error %v, want %v"
,
i
,
err
,
tc
.
errStr
)
t
.
Errorf
(
"#%d got error %v, want %v"
,
i
,
err
,
tc
.
errStr
)
}
}
}
}
})
}
}
}
}
...
@@ -163,8 +159,6 @@ func TestSOCKS5OverWS(t *testing.T) {
...
@@ -163,8 +159,6 @@ func TestSOCKS5OverWS(t *testing.T) {
rand
.
Read
(
sendData
)
rand
.
Read
(
sendData
)
for
i
,
tc
:=
range
socks5ProxyTests
{
for
i
,
tc
:=
range
socks5ProxyTests
{
tc
:=
tc
t
.
Run
(
fmt
.
Sprintf
(
"#%d"
,
i
),
func
(
t
*
testing
.
T
)
{
err
:=
socks5OverWSRoundtrip
(
httpSrv
.
URL
,
sendData
,
err
:=
socks5OverWSRoundtrip
(
httpSrv
.
URL
,
sendData
,
tc
.
cliUser
,
tc
.
cliUser
,
tc
.
srvUsers
,
tc
.
srvUsers
,
...
@@ -179,7 +173,6 @@ func TestSOCKS5OverWS(t *testing.T) {
...
@@ -179,7 +173,6 @@ func TestSOCKS5OverWS(t *testing.T) {
t
.
Errorf
(
"#%d got error: %v"
,
i
,
err
)
t
.
Errorf
(
"#%d got error: %v"
,
i
,
err
)
}
}
}
}
})
}
}
}
}
...
@@ -290,8 +283,6 @@ func TestSSOverWS(t *testing.T) {
...
@@ -290,8 +283,6 @@ func TestSSOverWS(t *testing.T) {
rand
.
Read
(
sendData
)
rand
.
Read
(
sendData
)
for
i
,
tc
:=
range
ssProxyTests
{
for
i
,
tc
:=
range
ssProxyTests
{
tc
:=
tc
t
.
Run
(
fmt
.
Sprintf
(
"#%d"
,
i
),
func
(
t
*
testing
.
T
)
{
err
:=
ssOverWSRoundtrip
(
httpSrv
.
URL
,
sendData
,
err
:=
ssOverWSRoundtrip
(
httpSrv
.
URL
,
sendData
,
tc
.
clientCipher
,
tc
.
clientCipher
,
tc
.
serverCipher
,
tc
.
serverCipher
,
...
@@ -306,7 +297,6 @@ func TestSSOverWS(t *testing.T) {
...
@@ -306,7 +297,6 @@ func TestSSOverWS(t *testing.T) {
t
.
Errorf
(
"#%d got error: %v"
,
i
,
err
)
t
.
Errorf
(
"#%d got error: %v"
,
i
,
err
)
}
}
}
}
})
}
}
}
}
...
@@ -344,8 +334,6 @@ func TestHTTPOverMWS(t *testing.T) {
...
@@ -344,8 +334,6 @@ func TestHTTPOverMWS(t *testing.T) {
rand
.
Read
(
sendData
)
rand
.
Read
(
sendData
)
for
i
,
tc
:=
range
httpProxyTests
{
for
i
,
tc
:=
range
httpProxyTests
{
tc
:=
tc
t
.
Run
(
fmt
.
Sprintf
(
"#%d"
,
i
),
func
(
t
*
testing
.
T
)
{
err
:=
httpOverMWSRoundtrip
(
httpSrv
.
URL
,
sendData
,
tc
.
cliUser
,
tc
.
srvUsers
)
err
:=
httpOverMWSRoundtrip
(
httpSrv
.
URL
,
sendData
,
tc
.
cliUser
,
tc
.
srvUsers
)
if
err
==
nil
{
if
err
==
nil
{
if
tc
.
errStr
!=
""
{
if
tc
.
errStr
!=
""
{
...
@@ -359,7 +347,6 @@ func TestHTTPOverMWS(t *testing.T) {
...
@@ -359,7 +347,6 @@ func TestHTTPOverMWS(t *testing.T) {
t
.
Errorf
(
"#%d got error %v, want %v"
,
i
,
err
,
tc
.
errStr
)
t
.
Errorf
(
"#%d got error %v, want %v"
,
i
,
err
,
tc
.
errStr
)
}
}
}
}
})
}
}
}
}
...
@@ -466,8 +453,6 @@ func TestSOCKS5OverMWS(t *testing.T) {
...
@@ -466,8 +453,6 @@ func TestSOCKS5OverMWS(t *testing.T) {
rand
.
Read
(
sendData
)
rand
.
Read
(
sendData
)
for
i
,
tc
:=
range
socks5ProxyTests
{
for
i
,
tc
:=
range
socks5ProxyTests
{
tc
:=
tc
t
.
Run
(
fmt
.
Sprintf
(
"#%d"
,
i
),
func
(
t
*
testing
.
T
)
{
err
:=
socks5OverMWSRoundtrip
(
httpSrv
.
URL
,
sendData
,
err
:=
socks5OverMWSRoundtrip
(
httpSrv
.
URL
,
sendData
,
tc
.
cliUser
,
tc
.
cliUser
,
tc
.
srvUsers
,
tc
.
srvUsers
,
...
@@ -482,7 +467,6 @@ func TestSOCKS5OverMWS(t *testing.T) {
...
@@ -482,7 +467,6 @@ func TestSOCKS5OverMWS(t *testing.T) {
t
.
Errorf
(
"#%d got error: %v"
,
i
,
err
)
t
.
Errorf
(
"#%d got error: %v"
,
i
,
err
)
}
}
}
}
})
}
}
}
}
...
@@ -593,8 +577,6 @@ func TestSSOverMWS(t *testing.T) {
...
@@ -593,8 +577,6 @@ func TestSSOverMWS(t *testing.T) {
rand
.
Read
(
sendData
)
rand
.
Read
(
sendData
)
for
i
,
tc
:=
range
ssProxyTests
{
for
i
,
tc
:=
range
ssProxyTests
{
tc
:=
tc
t
.
Run
(
fmt
.
Sprintf
(
"#%d"
,
i
),
func
(
t
*
testing
.
T
)
{
err
:=
ssOverMWSRoundtrip
(
httpSrv
.
URL
,
sendData
,
err
:=
ssOverMWSRoundtrip
(
httpSrv
.
URL
,
sendData
,
tc
.
clientCipher
,
tc
.
clientCipher
,
tc
.
serverCipher
,
tc
.
serverCipher
,
...
@@ -609,6 +591,5 @@ func TestSSOverMWS(t *testing.T) {
...
@@ -609,6 +591,5 @@ func TestSSOverMWS(t *testing.T) {
t
.
Errorf
(
"#%d got error: %v"
,
i
,
err
)
t
.
Errorf
(
"#%d got error: %v"
,
i
,
err
)
}
}
}
}
})
}
}
}
}
wss_test.go
View file @
dc884627
...
@@ -3,7 +3,6 @@ package gost
...
@@ -3,7 +3,6 @@ package gost
import
(
import
(
"crypto/rand"
"crypto/rand"
"crypto/tls"
"crypto/tls"
"fmt"
"net/http/httptest"
"net/http/httptest"
"net/url"
"net/url"
"testing"
"testing"
...
@@ -43,8 +42,6 @@ func TestHTTPOverWSS(t *testing.T) {
...
@@ -43,8 +42,6 @@ func TestHTTPOverWSS(t *testing.T) {
rand
.
Read
(
sendData
)
rand
.
Read
(
sendData
)
for
i
,
tc
:=
range
httpProxyTests
{
for
i
,
tc
:=
range
httpProxyTests
{
tc
:=
tc
t
.
Run
(
fmt
.
Sprintf
(
"#%d"
,
i
),
func
(
t
*
testing
.
T
)
{
err
:=
httpOverWSSRoundtrip
(
httpSrv
.
URL
,
sendData
,
nil
,
tc
.
cliUser
,
tc
.
srvUsers
)
err
:=
httpOverWSSRoundtrip
(
httpSrv
.
URL
,
sendData
,
nil
,
tc
.
cliUser
,
tc
.
srvUsers
)
if
err
==
nil
{
if
err
==
nil
{
if
tc
.
errStr
!=
""
{
if
tc
.
errStr
!=
""
{
...
@@ -58,7 +55,6 @@ func TestHTTPOverWSS(t *testing.T) {
...
@@ -58,7 +55,6 @@ func TestHTTPOverWSS(t *testing.T) {
t
.
Errorf
(
"#%d got error %v, want %v"
,
i
,
err
,
tc
.
errStr
)
t
.
Errorf
(
"#%d got error %v, want %v"
,
i
,
err
,
tc
.
errStr
)
}
}
}
}
})
}
}
}
}
...
@@ -164,8 +160,6 @@ func TestSOCKS5OverWSS(t *testing.T) {
...
@@ -164,8 +160,6 @@ func TestSOCKS5OverWSS(t *testing.T) {
rand
.
Read
(
sendData
)
rand
.
Read
(
sendData
)
for
i
,
tc
:=
range
socks5ProxyTests
{
for
i
,
tc
:=
range
socks5ProxyTests
{
tc
:=
tc
t
.
Run
(
fmt
.
Sprintf
(
"#%d"
,
i
),
func
(
t
*
testing
.
T
)
{
err
:=
socks5OverWSSRoundtrip
(
httpSrv
.
URL
,
sendData
,
err
:=
socks5OverWSSRoundtrip
(
httpSrv
.
URL
,
sendData
,
tc
.
cliUser
,
tc
.
cliUser
,
tc
.
srvUsers
,
tc
.
srvUsers
,
...
@@ -180,7 +174,6 @@ func TestSOCKS5OverWSS(t *testing.T) {
...
@@ -180,7 +174,6 @@ func TestSOCKS5OverWSS(t *testing.T) {
t
.
Errorf
(
"#%d got error: %v"
,
i
,
err
)
t
.
Errorf
(
"#%d got error: %v"
,
i
,
err
)
}
}
}
}
})
}
}
}
}
...
@@ -291,8 +284,6 @@ func TestSSOverWSS(t *testing.T) {
...
@@ -291,8 +284,6 @@ func TestSSOverWSS(t *testing.T) {
rand
.
Read
(
sendData
)
rand
.
Read
(
sendData
)
for
i
,
tc
:=
range
ssProxyTests
{
for
i
,
tc
:=
range
ssProxyTests
{
tc
:=
tc
t
.
Run
(
fmt
.
Sprintf
(
"#%d"
,
i
),
func
(
t
*
testing
.
T
)
{
err
:=
ssOverWSSRoundtrip
(
httpSrv
.
URL
,
sendData
,
err
:=
ssOverWSSRoundtrip
(
httpSrv
.
URL
,
sendData
,
tc
.
clientCipher
,
tc
.
clientCipher
,
tc
.
serverCipher
,
tc
.
serverCipher
,
...
@@ -307,7 +298,6 @@ func TestSSOverWSS(t *testing.T) {
...
@@ -307,7 +298,6 @@ func TestSSOverWSS(t *testing.T) {
t
.
Errorf
(
"#%d got error: %v"
,
i
,
err
)
t
.
Errorf
(
"#%d got error: %v"
,
i
,
err
)
}
}
}
}
})
}
}
}
}
...
@@ -345,8 +335,6 @@ func TestHTTPOverMWSS(t *testing.T) {
...
@@ -345,8 +335,6 @@ func TestHTTPOverMWSS(t *testing.T) {
rand
.
Read
(
sendData
)
rand
.
Read
(
sendData
)
for
i
,
tc
:=
range
httpProxyTests
{
for
i
,
tc
:=
range
httpProxyTests
{
tc
:=
tc
t
.
Run
(
fmt
.
Sprintf
(
"#%d"
,
i
),
func
(
t
*
testing
.
T
)
{
err
:=
httpOverMWSSRoundtrip
(
httpSrv
.
URL
,
sendData
,
tc
.
cliUser
,
tc
.
srvUsers
)
err
:=
httpOverMWSSRoundtrip
(
httpSrv
.
URL
,
sendData
,
tc
.
cliUser
,
tc
.
srvUsers
)
if
err
==
nil
{
if
err
==
nil
{
if
tc
.
errStr
!=
""
{
if
tc
.
errStr
!=
""
{
...
@@ -360,7 +348,6 @@ func TestHTTPOverMWSS(t *testing.T) {
...
@@ -360,7 +348,6 @@ func TestHTTPOverMWSS(t *testing.T) {
t
.
Errorf
(
"#%d got error %v, want %v"
,
i
,
err
,
tc
.
errStr
)
t
.
Errorf
(
"#%d got error %v, want %v"
,
i
,
err
,
tc
.
errStr
)
}
}
}
}
})
}
}
}
}
...
@@ -467,8 +454,6 @@ func TestSOCKS5OverMWSS(t *testing.T) {
...
@@ -467,8 +454,6 @@ func TestSOCKS5OverMWSS(t *testing.T) {
rand
.
Read
(
sendData
)
rand
.
Read
(
sendData
)
for
i
,
tc
:=
range
socks5ProxyTests
{
for
i
,
tc
:=
range
socks5ProxyTests
{
tc
:=
tc
t
.
Run
(
fmt
.
Sprintf
(
"#%d"
,
i
),
func
(
t
*
testing
.
T
)
{
err
:=
socks5OverMWSSRoundtrip
(
httpSrv
.
URL
,
sendData
,
err
:=
socks5OverMWSSRoundtrip
(
httpSrv
.
URL
,
sendData
,
tc
.
cliUser
,
tc
.
cliUser
,
tc
.
srvUsers
,
tc
.
srvUsers
,
...
@@ -483,7 +468,6 @@ func TestSOCKS5OverMWSS(t *testing.T) {
...
@@ -483,7 +468,6 @@ func TestSOCKS5OverMWSS(t *testing.T) {
t
.
Errorf
(
"#%d got error: %v"
,
i
,
err
)
t
.
Errorf
(
"#%d got error: %v"
,
i
,
err
)
}
}
}
}
})
}
}
}
}
...
@@ -594,8 +578,6 @@ func TestSSOverMWSS(t *testing.T) {
...
@@ -594,8 +578,6 @@ func TestSSOverMWSS(t *testing.T) {
rand
.
Read
(
sendData
)
rand
.
Read
(
sendData
)
for
i
,
tc
:=
range
ssProxyTests
{
for
i
,
tc
:=
range
ssProxyTests
{
tc
:=
tc
t
.
Run
(
fmt
.
Sprintf
(
"#%d"
,
i
),
func
(
t
*
testing
.
T
)
{
err
:=
ssOverMWSSRoundtrip
(
httpSrv
.
URL
,
sendData
,
err
:=
ssOverMWSSRoundtrip
(
httpSrv
.
URL
,
sendData
,
tc
.
clientCipher
,
tc
.
clientCipher
,
tc
.
serverCipher
,
tc
.
serverCipher
,
...
@@ -610,6 +592,5 @@ func TestSSOverMWSS(t *testing.T) {
...
@@ -610,6 +592,5 @@ func TestSSOverMWSS(t *testing.T) {
t
.
Errorf
(
"#%d got error: %v"
,
i
,
err
)
t
.
Errorf
(
"#%d got error: %v"
,
i
,
err
)
}
}
}
}
})
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment