Commit 60d09609 authored by Jeromy's avatar Jeromy
Browse files

use different protocol tag for unencrypted transport

parent 200d7a87
......@@ -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
......
......@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment