update p2p http proxy docs
License: MIT Signed-off-by: Ian Preston <ianopolous@protonmail.com>
Dr Ian Preston committed
Nov 10, 2018 at 23:07 UTC
19d4d66fc73843a89651c2875c07e9f7b30dcc80
1 file changed
+8
-7
docs/experimental-features.md
+8
-7
@@ -393,7 +393,7 @@ Experimental
393
394
### In Version
395
396
-master, 0.4.18
396
+master, 0.4.19
397
398
### How to enable
399
@@ -415,7 +415,7 @@ On the client, the p2p http proxy needs to be enabled in the config:
415
416
First, pick a protocol name for your application. Think of the protocol name as
417
a port number, just significantly more user-friendly. In this example, we're
418
-going to use `test`.
418
+going to use `/http`.
419
420
***Setup:***
421
@@ -430,15 +430,15 @@ port `$APP_PORT`.
430
Then, configure the p2p listener by running:
431
432
```sh
433
-> ipfs p2p listen --allow-custom-protocol test /ip4/127.0.0.1/tcp/$APP_PORT
433
+> ipfs p2p listen --allow-custom-protocol /http /ip4/127.0.0.1/tcp/$APP_PORT
434
```
435
436
-This will configure IPFS to forward all incoming `test` streams to
436
+This will configure IPFS to forward all incoming `/http` streams to
437
`127.0.0.1:$APP_PORT` (opening a new connection to `127.0.0.1:$APP_PORT` per incoming stream.
438
439
***On the "client" node:***
440
441
-Next, have your application make a http request to `127.0.0.1:5001/proxy/http/$SERVER_ID/$PROTOCOL/$FORWARDED_PATH`. This
441
+Next, have your application make a http request to `127.0.0.1:8080/p2p/$SERVER_ID/http/$FORWARDED_PATH`. This
442
connection will be forwarded to the service running on `127.0.0.1:$APP_PORT` on
443
the remote machine (which needs to be a http server!) with path `$FORWARDED_PATH`. You can test it with netcat:
444
@@ -449,15 +449,16 @@ the remote machine (which needs to be a http server!) with path `$FORWARDED_PATH
449
450
***On "client" node:***
451
```sh
452
-> curl http://localhost:5001/proxy/http/$SERVER_ID/test/
452
+> curl http://localhost:8080/p2p/$SERVER_ID/http/
453
```
454
455
You should now see the resulting http response: IPFS rocks!
456
457
+### Custom protocol names
458
+We also support use of protocol names of the form /x/$NAME/http where $NAME doesn't contain any "/"'s
459
460
### Road to being a real feature
461
- [ ] Needs p2p streams to graduate from experiments
460
-- [ ] Decide how to handle protocol names with /'s in them
462
- [ ] Needs more people to use and report on how well it works / fits use cases
463
- [ ] More documentation
464