Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
go-libp2p-quic-transport
Commits
b74c4143
Commit
b74c4143
authored
Feb 22, 2018
by
Marten Seemann
Browse files
privatize generating the tls.Config
parent
330efe75
Changes
3
Hide whitespace changes
Inline
Side-by-side
crypto.go
View file @
b74c4143
...
@@ -18,8 +18,7 @@ import (
...
@@ -18,8 +18,7 @@ import (
// mint certificate selection is broken.
// mint certificate selection is broken.
const
hostname
=
"quic.ipfs"
const
hostname
=
"quic.ipfs"
// TODO: make this private
func
generateConfig
(
privKey
ic
.
PrivKey
)
(
*
tls
.
Config
,
error
)
{
func
GenerateConfig
(
privKey
ic
.
PrivKey
)
(
*
tls
.
Config
,
error
)
{
key
,
hostCert
,
err
:=
keyToCertificate
(
privKey
)
key
,
hostCert
,
err
:=
keyToCertificate
(
privKey
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
...
...
listener.go
View file @
b74c4143
...
@@ -32,7 +32,7 @@ func newListener(addr ma.Multiaddr, transport tpt.Transport, localPeer peer.ID,
...
@@ -32,7 +32,7 @@ func newListener(addr ma.Multiaddr, transport tpt.Transport, localPeer peer.ID,
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
tlsConf
,
err
:=
G
enerateConfig
(
key
)
tlsConf
,
err
:=
g
enerateConfig
(
key
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
...
transport.go
View file @
b74c4143
...
@@ -42,7 +42,7 @@ func (t *transport) Dial(ctx context.Context, raddr ma.Multiaddr, p peer.ID) (tp
...
@@ -42,7 +42,7 @@ func (t *transport) Dial(ctx context.Context, raddr ma.Multiaddr, p peer.ID) (tp
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
tlsConf
,
err
:=
G
enerateConfig
(
t
.
privKey
)
tlsConf
,
err
:=
g
enerateConfig
(
t
.
privKey
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
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