Commit 8d9b7ef
committed
feat(core): add peer-record-interop feature for cross-implementation compatibility
Add optional `peer-record-interop` feature flag to enable standard libp2p
peer-record format for interoperability with Go and JavaScript implementations.
When enabled, uses:
- PAYLOAD_TYPE: [0x03, 0x01] (multicodec identifier)
- DOMAIN_SEP: "libp2p-peer-record"
When disabled (default), maintains backward compatibility with existing
Rust libp2p peer records using legacy constants:
- PAYLOAD_TYPE: "/libp2p/routing-state-record"
- DOMAIN_SEP: "libp2p-routing-state"
The legacy format is marked as deprecated to guide users toward the
standard format in future releases.
Changes:
- Add `peer-record-interop` feature flag to core/Cargo.toml
- Add conditional compilation for PAYLOAD_TYPE and DOMAIN_SEP constants
- Mark legacy constants as deprecated with migration guidance
- Update internal methods to handle both constant types (&[u8] vs &str)
- Gate interop tests to only run with feature enabled
- Update CHANGELOG and add inline documentation
Migration:
Users needing cross-implementation compatibility should add:
`libp2p-core = { version = "0.43.2", features = ["peer-record-interop"] }`1 parent 93a2d93 commit 8d9b7ef
File tree
6 files changed
+78
-12
lines changed- core
- src
- tests
6 files changed
+78
-12
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
| 81 | + | |
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
3 | 11 | | |
4 | 12 | | |
5 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
42 | 49 | | |
43 | 50 | | |
44 | 51 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
7 | 19 | | |
8 | | - | |
9 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
10 | 24 | | |
11 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
12 | 33 | | |
13 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
14 | 38 | | |
15 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
16 | 47 | | |
17 | 48 | | |
18 | 49 | | |
| |||
35 | 66 | | |
36 | 67 | | |
37 | 68 | | |
| 69 | + | |
38 | 70 | | |
39 | 71 | | |
40 | 72 | | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
41 | 78 | | |
42 | | - | |
| 79 | + | |
43 | 80 | | |
44 | 81 | | |
45 | 82 | | |
| |||
68 | 105 | | |
69 | 106 | | |
70 | 107 | | |
| 108 | + | |
71 | 109 | | |
72 | 110 | | |
73 | 111 | | |
| |||
98 | 136 | | |
99 | 137 | | |
100 | 138 | | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
101 | 144 | | |
102 | 145 | | |
103 | 146 | | |
104 | | - | |
| 147 | + | |
105 | 148 | | |
106 | 149 | | |
107 | 150 | | |
| |||
172 | 215 | | |
173 | 216 | | |
174 | 217 | | |
| 218 | + | |
175 | 219 | | |
176 | 220 | | |
177 | 221 | | |
| |||
199 | 243 | | |
200 | 244 | | |
201 | 245 | | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
202 | 251 | | |
203 | 252 | | |
204 | 253 | | |
205 | | - | |
| 254 | + | |
206 | 255 | | |
207 | 256 | | |
208 | 257 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
2 | 4 | | |
3 | 5 | | |
4 | 6 | | |
| |||
0 commit comments