@cryptotaxi247 / kubo / commits / 749ba2548

[http_proxy_over_p2p] cfg.Experiments.P2pHttpProxy

Updated config dependency and made p2p-http-proxy option require P2pHttpProxy config option. License: MIT Signed-off-by: Chris Boddy <chris@boddy.im>

Chris Boddy committed Oct 12, 2018 at 21:22 UTC 749ba25485191442c3d1726434cd738791498386
2 files changed +4 -1
cmd/ipfs/daemon.go
+3 -1
@@ -461,13 +461,15 @@ func serveHTTPApi(req *cmds.Request, cctx *oldcmds.Context) (<-chan error, error
461 corehttp.MutexFractionOption("/debug/pprof-mutex/"),
462 corehttp.MetricsScrapingOption("/debug/metrics/prometheus"),
463 corehttp.LogOption(),
464 - corehttp.ProxyOption(),
464 }
465
466 if len(cfg.Gateway.RootRedirect) > 0 {
467 opts = append(opts, corehttp.RedirectOption("", cfg.Gateway.RootRedirect))
468 }
469
470 + if cfg.Experimental.P2pHttpProxy {
471 + opts = append(opts, corehttp.ProxyOption())
472 + }
473 node, err := cctx.ConstructNode()
474 if err != nil {
475 return nil, fmt.Errorf("serveHTTPApi: ConstructNode() failed: %s", err)
test/sharness/t0184-http-proxy-over-p2p.sh
+1
@@ -51,6 +51,7 @@ function setup_sender_ipfs() {
51 SENDER_LOG=$IPFS_PATH/ipfs.log
52 ipfs init >> $SENDER_LOG 2>&1
53 ipfs config --json Experimental.Libp2pStreamMounting true >> $SENDER_LOG 2>&1
54 + ipfs config --json Experimental.P2pHttpProxy true >> $RECEIVER_LOG 2>&1
55 ipfs daemon >> $SENDER_LOG 2>&1 &
56 SENDER_PID=$!
57 sleep 5