Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
polkadot-sdk
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
parity
Mirrored projects
polkadot-sdk
Commits
a3439999
Commit
a3439999
authored
5 years ago
by
Pierre Krieger
Committed by
GitHub
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Remove support for secio (#4831)
parent
39c037ab
Branches
Branches containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
substrate/client/network/src/transport.rs
+14
-22
14 additions, 22 deletions
substrate/client/network/src/transport.rs
with
14 additions
and
22 deletions
substrate/client/network/src/transport.rs
+
14
−
22
View file @
a3439999
...
...
@@ -17,12 +17,10 @@
use
futures
::
prelude
::
*
;
use
libp2p
::{
InboundUpgradeExt
,
OutboundUpgradeExt
,
PeerId
,
Transport
,
mplex
,
identity
,
secio
,
yamux
,
bandwidth
,
wasm_ext
mplex
,
identity
,
yamux
,
bandwidth
,
wasm_ext
};
#[cfg(not(target_os
=
"unknown"
))]
use
libp2p
::{
tcp
,
dns
,
websocket
,
noise
};
#[cfg(not(target_os
=
"unknown"
))]
use
libp2p
::
core
::{
either
::
EitherError
,
either
::
EitherOutput
};
use
libp2p
::
core
::{
self
,
upgrade
,
transport
::
boxed
::
Boxed
,
transport
::
OptionalTransport
,
muxing
::
StreamMuxerBox
};
use
std
::{
io
,
sync
::
Arc
,
time
::
Duration
,
usize
};
...
...
@@ -52,7 +50,6 @@ pub fn build_transport(
rare panic here is basically zero"
);
noise
::
NoiseConfig
::
ix
(
noise_keypair
)
};
let
secio_config
=
secio
::
SecioConfig
::
new
(
keypair
);
// Build configuration objects for multiplexing mechanisms.
let
mut
mplex_config
=
mplex
::
MplexConfig
::
new
();
...
...
@@ -93,28 +90,23 @@ pub fn build_transport(
// For non-WASM, we support both secio and noise.
#[cfg(not(target_os
=
"unknown"
))]
let
transport
=
transport
.and_then
(
move
|
stream
,
endpoint
|
{
let
upgrade
=
core
::
upgrade
::
SelectUpgrade
::
new
(
noise_config
,
secio_config
);
core
::
upgrade
::
apply
(
stream
,
upgrade
,
endpoint
,
upgrade
::
Version
::
V1
)
.map
(|
out
|
match
out
?
{
// We negotiated noise
EitherOutput
::
First
((
remote_id
,
out
))
=>
{
let
remote_key
=
match
remote_id
{
noise
::
RemoteIdentity
::
IdentityKey
(
key
)
=>
key
,
_
=>
return
Err
(
upgrade
::
UpgradeError
::
Apply
(
EitherError
::
A
(
noise
::
NoiseError
::
InvalidKey
)))
};
Ok
((
EitherOutput
::
First
(
out
),
remote_key
.into_peer_id
()))
}
// We negotiated secio
EitherOutput
::
Second
((
remote_id
,
out
))
=>
Ok
((
EitherOutput
::
Second
(
out
),
remote_id
))
core
::
upgrade
::
apply
(
stream
,
noise_config
,
endpoint
,
upgrade
::
Version
::
V1
)
.and_then
(|(
remote_id
,
out
)|
async
move
{
let
remote_key
=
match
remote_id
{
noise
::
RemoteIdentity
::
IdentityKey
(
key
)
=>
key
,
_
=>
return
Err
(
upgrade
::
UpgradeError
::
Apply
(
noise
::
NoiseError
::
InvalidKey
))
};
Ok
((
out
,
remote_key
.into_peer_id
()))
})
});
// For WASM, we only support secio for now.
// We refuse all WASM connections for now. It is intended that we negotiate noise in the
// future. See https://github.com/libp2p/rust-libp2p/issues/1414
#[cfg(target_os
=
"unknown"
)]
let
transport
=
transport
.and_then
(
move
|
stream
,
endpoint
|
{
core
::
upgrade
::
apply
(
stream
,
secio_config
,
endpoint
,
upgrade
::
Version
::
V1
)
.map_ok
(|(
id
,
stream
)|
((
stream
,
id
)))
let
transport
=
transport
.and_then
(
move
|
_
,
_
|
async
move
{
let
r
:
Result
<
(
wasm_ext
::
Connection
,
PeerId
),
_
>
=
Err
(
io
::
Error
::
new
(
io
::
ErrorKind
::
Other
,
format!
(
"No encryption protocol supported"
)));
r
});
// Multiplexing
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment