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
Commits
60d09609
Commit
60d09609
authored
Apr 06, 2016
by
Jeromy
Browse files
use different protocol tag for unencrypted transport
parent
200d7a87
Changes
2
Hide whitespace changes
Inline
Side-by-side
p2p/net/conn/dial.go
View file @
60d09609
...
...
@@ -63,7 +63,12 @@ func (d *Dialer) Dial(ctx context.Context, raddr ma.Multiaddr, remote peer.ID) (
maconn
=
d
.
Wrapper
(
maconn
)
}
err
=
msmux
.
SelectProtoOrFail
(
SecioTag
,
maconn
)
cryptoProtoChoice
:=
SecioTag
if
!
EncryptConnections
{
cryptoProtoChoice
=
NoEncryptionTag
}
err
=
msmux
.
SelectProtoOrFail
(
cryptoProtoChoice
,
maconn
)
if
err
!=
nil
{
errOut
=
err
return
...
...
p2p/net/conn/listen.go
View file @
60d09609
...
...
@@ -18,6 +18,7 @@ import (
)
const
SecioTag
=
"/secio"
const
NoEncryptionTag
=
"/plaintext"
// ConnWrapper is any function that wraps a raw multiaddr connection
type
ConnWrapper
func
(
transport
.
Conn
)
transport
.
Conn
...
...
@@ -164,7 +165,11 @@ func WrapTransportListener(ctx context.Context, ml transport.Listener, local pee
}
l
.
proc
=
goprocessctx
.
WithContextAndTeardown
(
ctx
,
l
.
teardown
)
l
.
mux
.
AddHandler
(
SecioTag
,
nil
)
if
EncryptConnections
{
l
.
mux
.
AddHandler
(
SecioTag
,
nil
)
}
else
{
l
.
mux
.
AddHandler
(
NoEncryptionTag
,
nil
)
}
log
.
Debugf
(
"Conn Listener on %s"
,
l
.
Multiaddr
())
log
.
Event
(
ctx
,
"swarmListen"
,
l
)
...
...
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