File tree 4 files changed +41
-14
lines changed
4 files changed +41
-14
lines changed Original file line number Diff line number Diff line change
1
+ # 0.8.1
2
+
3
+ - Skip unparsable multiaddr in ` InboundUpgrade::upgrade_inbound ` and
4
+ ` OutboundUpgrade::upgrade_outbound ` . See [ PR 3300] .
5
+
6
+ [ PR 3300 ] : https://github.com/libp2p/rust-libp2p/pull/3300
7
+
1
8
# 0.8.0
2
9
3
10
- Update to ` prost-codec ` ` v0.3.0 ` .
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ name = "libp2p-dcutr"
3
3
edition = " 2021"
4
4
rust-version = " 1.62.0"
5
5
description = " Direct connection upgrade through relay"
6
- version = " 0.8.0 "
6
+ version = " 0.8.1 "
7
7
authors = [
" Max Inden <[email protected] >" ]
8
8
license = " MIT"
9
9
repository = " https://github.com/libp2p/rust-libp2p"
@@ -34,7 +34,7 @@ libp2p = { path = "../..", features = ["full"] }
34
34
rand = " 0.8"
35
35
clap = { version = " 4.0.13" , features = [" derive" ] }
36
36
37
- # Passing arguments to the docsrs builder in order to properly document cfg's.
37
+ # Passing arguments to the docsrs builder in order to properly document cfg's.
38
38
# More information: https://docs.rs/about/builds#cross-compiling
39
39
[package .metadata .docs .rs ]
40
40
all-features = true
Original file line number Diff line number Diff line change @@ -58,14 +58,23 @@ impl upgrade::InboundUpgrade<NegotiatedSubstream> for Upgrade {
58
58
} else {
59
59
obs_addrs
60
60
. into_iter ( )
61
- . map ( Multiaddr :: try_from)
61
+ . filter_map ( |a| match Multiaddr :: try_from ( a) {
62
+ Ok ( a) => Some ( a) ,
63
+ Err ( e) => {
64
+ log:: debug!( "Unable to parse multiaddr: {e}" ) ;
65
+ None
66
+ }
67
+ } )
62
68
// Filter out relayed addresses.
63
- . filter ( |a| match a {
64
- Ok ( a) => !a. iter ( ) . any ( |p| p == Protocol :: P2pCircuit ) ,
65
- Err ( _) => true ,
69
+ . filter ( |a| {
70
+ if a. iter ( ) . any ( |p| p == Protocol :: P2pCircuit ) {
71
+ log:: debug!( "Dropping relayed address {a}" ) ;
72
+ false
73
+ } else {
74
+ true
75
+ }
66
76
} )
67
- . collect :: < Result < Vec < Multiaddr > , _ > > ( )
68
- . map_err ( |_| UpgradeError :: InvalidAddrs ) ?
77
+ . collect :: < Vec < Multiaddr > > ( )
69
78
} ;
70
79
71
80
let r#type = hole_punch:: Type :: from_i32 ( r#type) . ok_or ( UpgradeError :: ParseTypeField ) ?;
@@ -124,6 +133,7 @@ pub enum UpgradeError {
124
133
StreamClosed ,
125
134
#[ error( "Expected at least one address in reservation." ) ]
126
135
NoAddresses ,
136
+ #[ deprecated( since = "0.8.1" , note = "Error is no longer constructed." ) ]
127
137
#[ error( "Invalid addresses." ) ]
128
138
InvalidAddrs ,
129
139
#[ error( "Failed to parse response type field." ) ]
Original file line number Diff line number Diff line change @@ -85,14 +85,23 @@ impl upgrade::OutboundUpgrade<NegotiatedSubstream> for Upgrade {
85
85
} else {
86
86
obs_addrs
87
87
. into_iter ( )
88
- . map ( Multiaddr :: try_from)
88
+ . filter_map ( |a| match Multiaddr :: try_from ( a) {
89
+ Ok ( a) => Some ( a) ,
90
+ Err ( e) => {
91
+ log:: debug!( "Unable to parse multiaddr: {e}" ) ;
92
+ None
93
+ }
94
+ } )
89
95
// Filter out relayed addresses.
90
- . filter ( |a| match a {
91
- Ok ( a) => !a. iter ( ) . any ( |p| p == Protocol :: P2pCircuit ) ,
92
- Err ( _) => true ,
96
+ . filter ( |a| {
97
+ if a. iter ( ) . any ( |p| p == Protocol :: P2pCircuit ) {
98
+ log:: debug!( "Dropping relayed address {a}" ) ;
99
+ false
100
+ } else {
101
+ true
102
+ }
93
103
} )
94
- . collect :: < Result < Vec < Multiaddr > , _ > > ( )
95
- . map_err ( |_| UpgradeError :: InvalidAddrs ) ?
104
+ . collect :: < Vec < Multiaddr > > ( )
96
105
} ;
97
106
98
107
let msg = HolePunch {
@@ -128,6 +137,7 @@ pub enum UpgradeError {
128
137
NoAddresses ,
129
138
#[ error( "Invalid expiration timestamp in reservation." ) ]
130
139
InvalidReservationExpiration ,
140
+ #[ deprecated( since = "0.8.1" , note = "Error is no longer constructed." ) ]
131
141
#[ error( "Invalid addresses in reservation." ) ]
132
142
InvalidAddrs ,
133
143
#[ error( "Failed to parse response type field." ) ]
You can’t perform that action at this time.
0 commit comments