chore: finish reframe removal
Closes #9479
Marcin Rataj committed
Mar 18, 2024 at 18:39 UTC
8559985d0a5ca827c9170bc7490057020f2227c3
2 files changed
+12
-294
docs/delegated-routing.md
+12
-123
@@ -11,8 +11,8 @@
11
Previously we only used the Amino DHT for content routing and content
12
providing.
13
14
-Kubo 0.14 introduced experimental support for [delegated routing using Reframe protocol](https://github.com/ipfs/kubo/pull/8997).
15
-Since then, Reframe got deprecated and superseded by [Routing V1 HTTP API](https://specs.ipfs.tech/routing/http-routing-v1/).
14
+Kubo 0.14 introduced experimental support for [delegated routing](https://github.com/ipfs/kubo/pull/8997),
15
+which then got changed and standardized as [Routing V1 HTTP API](https://specs.ipfs.tech/routing/http-routing-v1/).
16
17
Kubo 0.23.0 release added support for [self-hosting Routing V1 HTTP API server](https://github.com/ipfs/kubo/blob/master/docs/changelogs/v0.23.md#self-hosting-routingv1-endpoint-for-delegated-routing-needs).
18
@@ -42,15 +42,15 @@ The `Routing` configuration section will contain the following keys:
42
43
#### Routers
44
45
-`Routers` will be a key-value list of routers that will be available to use. The key is the router name and the value is all the needed configurations for that router. the `Type` will define the routing kind. The main router types will be `reframe` and `dht`, but we will implement two special routers used to execute a set of routers in parallel or sequentially: `parallel` router and `sequential` router.
45
+`Routers` will be a key-value list of routers that will be available to use. The key is the router name and the value is all the needed configurations for that router. the `Type` will define the routing kind. The main router types will be `http` and `dht`, but we will implement two special routers used to execute a set of routers in parallel or sequentially: `parallel` router and `sequential` router.
46
47
Depending on the routing type, it will use different parameters:
48
49
-##### Reframe
49
+##### HTTP
50
51
Params:
52
53
-- `"Endpoint"`: URL endpoint implementing Reframe protocol.
53
+- `"Endpoint"`: URL of HTTP server with endpoints that implement [Delegated Routing V1 HTTP API](https://specs.ipfs.tech/routing/http-routing-v1/) protocol.
54
55
##### Amino DHT
56
@@ -89,10 +89,10 @@ The value will contain:
89
"Routing": {
90
"Type": "custom",
91
"Routers": {
92
- "storetheindex": {
93
- "Type": "reframe",
92
+ "http-delegated": {
93
+ "Type": "http",
94
"Parameters": {
95
- "Endpoint": "https://cid.contact/reframe"
95
+ "Endpoint": "https://delegated-ipfs.dev" // /routing/v1 (https://specs.ipfs.tech/routing/http-routing-v1/)
96
}
97
},
98
"dht-lan": {
@@ -123,7 +123,7 @@ The value will contain:
123
"RouterName": "dht-wan"
124
},
125
{
126
- "RouterName": "storetheindex"
126
+ "RouterName": "http-delegated"
127
}
128
]
129
}
@@ -142,7 +142,7 @@ The value will contain:
142
"Timeout": "100ms"
143
},
144
{
145
- "RouterName": "storetheindex",
145
+ "RouterName": "http-delegated",
146
"ExecuteAfter": "100ms"
147
}
148
]
@@ -161,7 +161,7 @@ The value will contain:
161
"Timeout": "300ms"
162
},
163
{
164
- "RouterName": "storetheindex",
164
+ "RouterName": "http-delegated",
165
"Timeout": "300ms"
166
}
167
]
@@ -178,7 +178,7 @@ The value will contain:
178
"RouterName": "dht-wan"
179
},
180
{
181
- "RouterName": "storetheindex"
181
+ "RouterName": "http-delegated"
182
}
183
]
184
}
@@ -201,75 +201,6 @@ The value will contain:
201
}
202
```
203
204
-Added YAML for clarity:
205
-
206
-```yaml
207
----
208
-Type: custom
209
-Routers:
210
- storetheindex:
211
- Type: reframe
212
- Parameters:
213
- Endpoint: https://cid.contact/reframe
214
- dht-lan:
215
- Type: dht
216
- Parameters:
217
- Mode: server
218
- PublicIPNetwork: false
219
- AcceleratedDHTClient: false
220
- dht-wan:
221
- Type: dht
222
- Parameters:
223
- Mode: auto
224
- PublicIPNetwork: true
225
- AcceleratedDHTClient: false
226
- find-providers-router:
227
- Type: parallel
228
- Parameters:
229
- Routers:
230
- - RouterName: dht-lan
231
- IgnoreErrors: true
232
- - RouterName: dht-wan
233
- - RouterName: storetheindex
234
- provide-router:
235
- Type: parallel
236
- Parameters:
237
- Routers:
238
- - RouterName: dht-lan
239
- IgnoreErrors: true
240
- - RouterName: dht-wan
241
- ExecuteAfter: 100ms
242
- Timeout: 100ms
243
- - RouterName: storetheindex
244
- ExecuteAfter: 100ms
245
- get-ipns-router:
246
- Type: sequential
247
- Parameters:
248
- Routers:
249
- - RouterName: dht-lan
250
- IgnoreErrors: true
251
- - RouterName: dht-wan
252
- Timeout: 300ms
253
- - RouterName: storetheindex
254
- Timeout: 300ms
255
- put-ipns-router:
256
- Type: parallel
257
- Parameters:
258
- Routers:
259
- - RouterName: dht-lan
260
- - RouterName: dht-wan
261
- - RouterName: storetheindex
262
-Methods:
263
- find-providers:
264
- RouterName: find-providers-router
265
- provide:
266
- RouterName: provide-router
267
- get-ipns:
268
- RouterName: get-ipns-router
269
- put-ipns:
270
- RouterName: put-ipns-router
271
-```
272
-
204
### Error cases
205
- If any of the routers fails, the output will be an error by default.
206
- You can use `IgnoreErrors:true` to ignore errors for a specific router output
@@ -402,48 +333,6 @@ As test fixtures we can add different use cases here and see how the configurati
333
}
334
}
335
```
405
-YAML representation for clarity:
406
-
407
-```yaml
408
----
409
-Type: custom
410
-Routers:
411
- dht-lan:
412
- Type: dht
413
- Parameters:
414
- Mode: server
415
- PublicIPNetwork: false
416
- dht-wan:
417
- Type: dht
418
- Parameters:
419
- Mode: auto
420
- PublicIPNetwork: true
421
- parallel-dht-strict:
422
- Type: parallel
423
- Parameters:
424
- Routers:
425
- - RouterName: dht-lan
426
- - RouterName: dht-wan
427
- parallel-dht:
428
- Type: parallel
429
- Parameters:
430
- Routers:
431
- - RouterName: dht-lan
432
- IgnoreError: true
433
- - RouterName: dht-wan
434
-Methods:
435
- provide:
436
- RouterName: dht-wan
437
- find-providers:
438
- RouterName: parallel-dht-strict
439
- find-peers:
440
- RouterName: parallel-dht-strict
441
- get-ipns:
442
- RouterName: parallel-dht
443
- put-ipns:
444
- RouterName: parallel-dht
445
-
446
-```
336
337
### Compatibility
338
test/sharness/t0701-delegated-routing-reframe.sh
deleted
-171
@@ -1,171 +0,0 @@
1
-#!/usr/bin/env bash
2
-
3
-test_description="Test delegated routing via reframe endpoint"
4
-
5
-. lib/test-lib.sh
6
-
7
-if ! test_have_prereq SOCAT; then
8
- skip_all="skipping '$test_description': socat is not available"
9
- test_done
10
-fi
11
-
12
-# simple reframe server mock
13
-# local endpoint responds with deterministic application/vnd.ipfs.rpc+dag-json; version=1
14
-REFRAME_PORT=5098
15
-function start_reframe_mock_endpoint() {
16
- REMOTE_SERVER_LOG="reframe-server.log"
17
- rm -f $REMOTE_SERVER_LOG
18
-
19
- touch response
20
- socat tcp-listen:$REFRAME_PORT,fork,bind=127.0.0.1,reuseaddr 'SYSTEM:cat response'!!CREATE:$REMOTE_SERVER_LOG &
21
- REMOTE_SERVER_PID=$!
22
-
23
- socat /dev/null tcp:127.0.0.1:$REFRAME_PORT,retry=10
24
- return $?
25
-}
26
-function serve_reframe_response() {
27
- local body=$1
28
- local status_code=${2:-"200 OK"}
29
- local length=$((1 + ${#body}))
30
- echo -e "HTTP/1.1 $status_code\nContent-Type: application/vnd.ipfs.rpc+dag-json; version=1\nContent-Length: $length\n\n$body" > response
31
-}
32
-function stop_reframe_mock_endpoint() {
33
- exec 7<&-
34
- kill $REMOTE_SERVER_PID > /dev/null 2>&1
35
- wait $REMOTE_SERVER_PID || true
36
-}
37
-
38
-# daemon running in online mode to ensure Pin.origins/PinStatus.delegates work
39
-test_init_ipfs
40
-
41
-# based on static, synthetic reframe messages:
42
-# t0701-delegated-routing-reframe/FindProvidersRequest
43
-# t0701-delegated-routing-reframe/FindProvidersResponse
44
-FINDPROV_CID="bafybeigvgzoolc3drupxhlevdp2ugqcrbcsqfmcek2zxiw5wctk3xjpjwy"
45
-EXPECTED_PROV="QmQzqxhK82kAmKvARFZSkUVS6fo9sySaiogAnx5EnZ6ZmC"
46
-
47
-test_expect_success "default Routing config has no Routers defined" '
48
- echo null > expected &&
49
- ipfs config show | jq .Routing.Routers > actual &&
50
- test_cmp expected actual
51
-'
52
-
53
-# turn off all implicit routers
54
-ipfs config Routing.Type none || exit 1
55
-test_launch_ipfs_daemon
56
-test_expect_success "disabling default router (dht) works" '
57
- ipfs config Routing.Type > actual &&
58
- echo none > expected &&
59
- test_cmp expected actual
60
-'
61
-test_expect_success "no routers means findprovs returns no results" '
62
- ipfs routing findprovs "$FINDPROV_CID" > actual &&
63
- echo -n > expected &&
64
- test_cmp expected actual
65
-'
66
-
67
-test_kill_ipfs_daemon
68
-
69
-ipfs config Routing.Type --json '"custom"' || exit 1
70
-ipfs config Routing.Methods --json '{
71
- "find-peers": {
72
- "RouterName": "TestDelegatedRouter"
73
- },
74
- "find-providers": {
75
- "RouterName": "TestDelegatedRouter"
76
- },
77
- "get-ipns": {
78
- "RouterName": "TestDelegatedRouter"
79
- },
80
- "provide": {
81
- "RouterName": "TestDelegatedRouter"
82
- }
83
- }' || exit 1
84
-
85
-test_expect_success "missing method params makes daemon fails" '
86
- echo "Error: constructing the node (see log for full detail): method name \"put-ipns\" is missing from Routing.Methods config param" > expected_error &&
87
- GOLOG_LOG_LEVEL=fatal ipfs daemon 2> actual_error || exit 0 &&
88
- test_cmp expected_error actual_error
89
-'
90
-
91
-ipfs config Routing.Methods --json '{
92
- "find-peers": {
93
- "RouterName": "TestDelegatedRouter"
94
- },
95
- "find-providers": {
96
- "RouterName": "TestDelegatedRouter"
97
- },
98
- "get-ipns": {
99
- "RouterName": "TestDelegatedRouter"
100
- },
101
- "provide": {
102
- "RouterName": "TestDelegatedRouter"
103
- },
104
- "put-ipns": {
105
- "RouterName": "TestDelegatedRouter"
106
- },
107
- "NOT_SUPPORTED": {
108
- "RouterName": "TestDelegatedRouter"
109
- }
110
- }' || exit 1
111
-
112
-test_expect_success "having wrong methods makes daemon fails" '
113
- echo "Error: constructing the node (see log for full detail): method name \"NOT_SUPPORTED\" is not a supported method on Routing.Methods config param" > expected_error &&
114
- GOLOG_LOG_LEVEL=fatal ipfs daemon 2> actual_error || exit 0 &&
115
- test_cmp expected_error actual_error
116
-'
117
-
118
-# set Routing config to only use delegated routing via mocked reframe endpoint
119
-
120
-ipfs config Routing.Type --json '"custom"' || exit 1
121
-ipfs config Routing.Routers.TestDelegatedRouter --json '{
122
- "Type": "reframe",
123
- "Parameters": {
124
- "Endpoint": "http://127.0.0.1:5098/reframe"
125
- }
126
-}' || exit 1
127
-ipfs config Routing.Methods --json '{
128
- "find-peers": {
129
- "RouterName": "TestDelegatedRouter"
130
- },
131
- "find-providers": {
132
- "RouterName": "TestDelegatedRouter"
133
- },
134
- "get-ipns": {
135
- "RouterName": "TestDelegatedRouter"
136
- },
137
- "provide": {
138
- "RouterName": "TestDelegatedRouter"
139
- },
140
- "put-ipns": {
141
- "RouterName": "TestDelegatedRouter"
142
- }
143
- }' || exit 1
144
-
145
-test_expect_success "adding reframe endpoint to Routing.Routers config works" '
146
- echo "http://127.0.0.1:5098/reframe" > expected &&
147
- ipfs config Routing.Routers.TestDelegatedRouter.Parameters.Endpoint > actual &&
148
- test_cmp expected actual
149
-'
150
-
151
-test_launch_ipfs_daemon
152
-
153
-test_expect_success "start_reframe_mock_endpoint" '
154
- start_reframe_mock_endpoint
155
-'
156
-
157
-test_expect_success "'ipfs routing findprovs' returns result from delegated reframe router" '
158
- serve_reframe_response "$(<../t0701-delegated-routing-reframe/FindProvidersResponse)" &&
159
- echo "$EXPECTED_PROV" > expected &&
160
- ipfs routing findprovs "$FINDPROV_CID" > actual &&
161
- test_cmp expected actual
162
-'
163
-
164
-test_expect_success "stop_reframe_mock_endpoint" '
165
- stop_reframe_mock_endpoint
166
-'
167
-
168
-
169
-test_kill_ipfs_daemon
170
-test_done
171
-# vim: ts=2 sw=2 sts=2 et: