Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
p2p
go-p2p-tls
Commits
81749456
Commit
81749456
authored
Nov 24, 2018
by
Marten Seemann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix handshake tests
parent
da0e8335
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletion
+10
-1
transport_test.go
transport_test.go
+10
-1
No files found.
transport_test.go
View file @
81749456
...
...
@@ -106,15 +106,18 @@ var _ = Describe("Transport", func() {
clientInsecureConn
,
serverInsecureConn
:=
connect
()
done
:=
make
(
chan
struct
{})
go
func
()
{
defer
GinkgoRecover
()
_
,
err
:=
serverTransport
.
SecureInbound
(
context
.
Background
(),
serverInsecureConn
)
Expect
(
err
)
.
To
(
HaveOccurred
())
Expect
(
err
.
Error
())
.
To
(
ContainSubstring
(
"tls: bad certificate"
))
close
(
done
)
}()
// dial, but expect the wrong peer ID
_
,
err
=
clientTransport
.
SecureOutbound
(
context
.
Background
(),
clientInsecureConn
,
thirdPartyID
)
Expect
(
err
)
.
To
(
MatchError
(
"peer IDs don't match"
))
Eventually
(
done
)
.
Should
(
BeClosed
())
})
It
(
"fails if the client presents an invalid cert chain"
,
func
()
{
...
...
@@ -126,16 +129,19 @@ var _ = Describe("Transport", func() {
clientInsecureConn
,
serverInsecureConn
:=
connect
()
done
:=
make
(
chan
struct
{})
go
func
()
{
defer
GinkgoRecover
()
_
,
err
:=
serverTransport
.
SecureInbound
(
context
.
Background
(),
serverInsecureConn
)
Expect
(
err
)
.
To
(
HaveOccurred
())
Expect
(
err
.
Error
())
.
To
(
ContainSubstring
(
"crypto/rsa: verification error"
))
close
(
done
)
}()
_
,
err
=
clientTransport
.
SecureOutbound
(
context
.
Background
(),
clientInsecureConn
,
serverID
)
Expect
(
err
)
.
To
(
HaveOccurred
())
Expect
(
err
.
Error
())
.
To
(
ContainSubstring
(
"tls: bad certificate"
))
Eventually
(
done
)
.
Should
(
BeClosed
())
})
It
(
"fails if the server presents an invalid cert chain"
,
func
()
{
...
...
@@ -147,15 +153,18 @@ var _ = Describe("Transport", func() {
clientInsecureConn
,
serverInsecureConn
:=
connect
()
done
:=
make
(
chan
struct
{})
go
func
()
{
defer
GinkgoRecover
()
_
,
err
:=
serverTransport
.
SecureInbound
(
context
.
Background
(),
serverInsecureConn
)
Expect
(
err
)
.
To
(
HaveOccurred
())
Expect
(
err
.
Error
())
.
To
(
ContainSubstring
(
"tls: bad certificate"
))
// TLS returns a weird error here: "remote error: tls: unexpected message"
close
(
done
)
}()
_
,
err
=
clientTransport
.
SecureOutbound
(
context
.
Background
(),
clientInsecureConn
,
serverID
)
Expect
(
err
)
.
To
(
HaveOccurred
())
Expect
(
err
.
Error
())
.
To
(
ContainSubstring
(
"crypto/rsa: verification error"
))
Eventually
(
done
)
.
Should
(
BeClosed
())
})
})
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