xref: /aosp_15_r20/external/curl/docs/cmdline-opts/ipfs-gateway.md (revision 6236dae45794135f37c4eb022389c904c8b0090d)
1*6236dae4SAndroid Build Coastguard Worker---
2*6236dae4SAndroid Build Coastguard Workerc: Copyright (C) Mark Gaiser, <[email protected]>
3*6236dae4SAndroid Build Coastguard WorkerSPDX-License-Identifier: curl
4*6236dae4SAndroid Build Coastguard WorkerLong: ipfs-gateway
5*6236dae4SAndroid Build Coastguard WorkerArg: <URL>
6*6236dae4SAndroid Build Coastguard WorkerHelp: Gateway for IPFS
7*6236dae4SAndroid Build Coastguard WorkerProtocols: IPFS
8*6236dae4SAndroid Build Coastguard WorkerAdded: 8.4.0
9*6236dae4SAndroid Build Coastguard WorkerCategory: curl
10*6236dae4SAndroid Build Coastguard WorkerMulti: single
11*6236dae4SAndroid Build Coastguard WorkerSee-also:
12*6236dae4SAndroid Build Coastguard Worker  - help
13*6236dae4SAndroid Build Coastguard Worker  - manual
14*6236dae4SAndroid Build Coastguard WorkerExample:
15*6236dae4SAndroid Build Coastguard Worker  - --ipfs-gateway $URL ipfs://
16*6236dae4SAndroid Build Coastguard Worker---
17*6236dae4SAndroid Build Coastguard Worker
18*6236dae4SAndroid Build Coastguard Worker# `--ipfs-gateway`
19*6236dae4SAndroid Build Coastguard Worker
20*6236dae4SAndroid Build Coastguard WorkerSpecify which gateway to use for IPFS and IPNS URLs. Not specifying this
21*6236dae4SAndroid Build Coastguard Workerinstead makes curl check if the IPFS_GATEWAY environment variable is set, or
22*6236dae4SAndroid Build Coastguard Workerif a `~/.ipfs/gateway` file holding the gateway URL exists.
23*6236dae4SAndroid Build Coastguard Worker
24*6236dae4SAndroid Build Coastguard WorkerIf you run a local IPFS node, this gateway is by default available under
25*6236dae4SAndroid Build Coastguard Worker`http://localhost:8080`. A full example URL would look like:
26*6236dae4SAndroid Build Coastguard Worker
27*6236dae4SAndroid Build Coastguard Worker    curl --ipfs-gateway http://localhost:8080 \
28*6236dae4SAndroid Build Coastguard Worker       ipfs://bafybeigagd5nmnn2iys2f3
29*6236dae4SAndroid Build Coastguard Worker
30*6236dae4SAndroid Build Coastguard WorkerThere are many public IPFS gateways. See for example:
31*6236dae4SAndroid Build Coastguard Workerhttps://ipfs.github.io/public-gateway-checker/
32*6236dae4SAndroid Build Coastguard Worker
33*6236dae4SAndroid Build Coastguard WorkerIf you opt to go for a remote gateway you need to be aware that you completely
34*6236dae4SAndroid Build Coastguard Workertrust the gateway. This might be fine in local gateways that you host
35*6236dae4SAndroid Build Coastguard Workeryourself. With remote gateways there could potentially be malicious actors
36*6236dae4SAndroid Build Coastguard Workerreturning you data that does not match the request you made, inspect or even
37*6236dae4SAndroid Build Coastguard Workerinterfere with the request. You may not notice this when using curl. A
38*6236dae4SAndroid Build Coastguard Workermitigation could be to go for a "trustless" gateway. This means you locally
39*6236dae4SAndroid Build Coastguard Workerverify that the data. Consult the docs page on trusted vs trustless:
40*6236dae4SAndroid Build Coastguard Workerhttps://docs.ipfs.tech/reference/http/gateway/#trusted-vs-trustless
41