-
Notifications
You must be signed in to change notification settings - Fork 242
IPIP-280: App Conventions for HTTP Gateway Detection #280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
markg85
wants to merge
32
commits into
ipfs:main
Choose a base branch
from
markg85:master
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 16 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
d5673ca
Add INTEGRATION document
markg85 9630240
Update INTEGRATION.md
markg85 b23caf5
Merge branch 'ipfs:main' into master
markg85 f956141
rewrote integration document
markg85 8a65c2c
Remove drawio files, we're using mermaid now
markg85 0e8fa0d
follow the template
markg85 81adfd0
linter fixes
markg85 ed0fe22
a few more linter fixes
markg85 0d6b8d6
wip image instead
markg85 0dd13f2
review feedback and updated to new concepts
markg85 d362c62
Refer to the new file as gateways (plural).
markg85 7ce0432
Move integrations document to:
markg85 9e5cd95
template fixes
markg85 4d80040
280. Not 180.
markg85 50b70cf
Add global configuration details
markg85 c6699f7
Little less bold
markg85 32b1cfd
Reword the compatibility section and fix some review feedback.
markg85 3990b3d
Merge branch 'main' into master
markg85 72cdde2
Merge origin/main into markg85-master
lidel 6ee4e19
ipip-280: update and split into specs and ipip
lidel 6290ead
fix: typos and clarify file encoding
lidel 85702ce
fix: clarify single vs multiple URL handling in gateway file
lidel 9d0024f
Merge remote-tracking branch 'origin/main' into pr-280
lidel e657c46
docs: document out-of-scope alternatives
lidel a5334ca
fix: remove stray word in curl section
lidel c65d0a6
fix: simplify and fix OS-specific path handling
lidel 65e6099
chore: update metadata and relax MUST to SHOULD
lidel 7acc773
fix: clarify gateway URL requirements
lidel e8581ce
fix: capitalize SHOULD for RFC 2119 consistency
lidel 81e97eb
chore: add libp2p-gateway to integratingHttpGateways
lidel 22779d6
chore: mark IPIP as ratified (implemented since 2022)
lidel b4e73a2
docs: add official ffmpeg docs reference
lidel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| # IPIP 0280: Gateways file | ||
| - Start Date: 2022-12-08 | ||
| - Related Issues: | ||
| - https://github.com/ipfs/kubo/issues/8847 | ||
|
|
||
| ## Summary | ||
|
|
||
| Defines how IPFS implementations must expose their gateway. This only affects the file-based method of exposiing a gateway. | ||
|
|
||
| ## Motivation | ||
|
|
||
| Applications wanting to use IPFS resources are, without this spec, left to invent their own ways of finding a gateway. This spec defines how an application wanting to implement IPFS support can find a list of gateways. | ||
|
|
||
| Users should be aware that this is just a list of gateways. It could contain a local gateway but doesn't have to. It's up to the user to do filtering on that list to find an actual local gateway. | ||
|
|
||
| ## Detailed design | ||
|
|
||
| This integration spec defines the recommended way for IPFS implementations to expose the gateway they host for IPFS integrations (think applications wanting to support IPFS) to find and use said gateways. | ||
|
|
||
| An IPFS implementation must expose the gateway it serves in a file called `gateways` (more on where this file is located in the section below). The gateway must be exposed as a single line in the following format: | ||
|
markg85 marked this conversation as resolved.
Outdated
|
||
|
|
||
| `http://<ip>:<port>` | ||
|
|
||
| In case the `gateways` file already exists, this line must be **prepended** with the rest of the data left as-is. This is a soft guarantee that any locally running gateways are at the top of the list. In any other case the `gateways` file must be created and the `gateway` line inserted to it as one line terminated with `\r\n`. | ||
|
|
||
| Upon shutdown of the IPFS implementation it is to remove it's specific gateway line from the `gateways` file and leave no gaps. It must take care potential empty lines and leave a file behind with the remaning gateways each on a single line and terminated - per line - with `\r\n`. | ||
|
|
||
| ### Gateways file placement | ||
|
|
||
| As a reference, [this](https://github.com/cjbassi/platform-dirs-rs#path-list) list of configuration folders is used. | ||
|
|
||
| | | with variables | full paths | | ||
| | -------- | -------- | -------- | | ||
| | (user) Windows | %APPDATA%/ipfs | C:/Users/%USERNAME%/AppData/Roaming/ipfs | | ||
| | (global) Windows | %PROGRAMDATA%/ipfs | C:/ProgramData/ipfs | | ||
| | (user) macOS | $XDG_CONFIG_HOME/ipfs | ~/Library/Application Support/ipfs | | ||
| | (global) macOS | N/A | /Library/Application Support/ipfs | | ||
| | (user) Linux | $XDG_CONFIG_HOME/ipfs | ~/.config/ipfs | | ||
| | (global) Linux | N/A | /etc/ipfs | | ||
|
markg85 marked this conversation as resolved.
Outdated
|
||
|
|
||
| The `gateways` file must be placed in the folder appropiate for the platform the IPFS implementation instance is running on. For linux that would be `~/.config/ipfs/gateways` or `$XDG_CONFIG_HOME/ipfs/gateways` | ||
|
markg85 marked this conversation as resolved.
Outdated
|
||
|
|
||
| The file will be created when it doesn't exist. | ||
| It will never be delated! This means the file will exist and be empty when an IPFS implementation removes it's own gateway from that file and if that gateway was the only line in the file. | ||
|
markg85 marked this conversation as resolved.
Outdated
|
||
|
|
||
| Creating and updating the `gateways` file only applies to the `(user)` prefixed file. The `(global)` prefixed file will not be written to by the IPFS implementation! | ||
|
|
||
| #### Local file | ||
| The local file is for read-write access for the IPFS implementation. | ||
|
|
||
| #### Global file | ||
|
lidel marked this conversation as resolved.
Outdated
|
||
| If the local file cannot be found or is empty then the IPFS implementation should try to read the global config file and read it's gateway values instead. This global file must not be changed by any IPFS implementation! | ||
|
|
||
| ## Test fixtures | ||
|
|
||
| N/A | ||
|
|
||
| ## Design rationale | ||
|
|
||
| To simplify IPFS integrations in third party applications it's important to know if said application can use a gateway. This spec defines the rules to find such a gateway and/or how to influence it. | ||
|
|
||
| ### User benefit | ||
|
|
||
| Users, applications using IPFS, get a defined way to find gateways to use. Without this spec there is no defined way. | ||
|
|
||
| ### Compatibility | ||
|
|
||
| This is only applicable to Kubo! Other IPFS implementations are to ignore this | ||
|
markg85 marked this conversation as resolved.
Outdated
|
||
|
|
||
| The legacy gateway file (placed in `~/.ipfs/gateway`) was made up as a response to a need to know which gateway an IPFS node would expose. While that file itself was never specced out, it served the need. Some applications are using this file therefore the file has to be maintained for the Kubo reference implemenation. Any other IPFS implementation should ignore this. | ||
|
|
||
| The file only contains a single line being the http gateway url. For example: "http://localhost:8080". | ||
|
|
||
| The file conditions: | ||
| 1. is named "gateway" | ||
| 2. only exists when Kubo starts a gateway | ||
| 3. is removed when Kubo shuts down | ||
|
|
||
| Future Kubo implemenations will do the above via symlinking the `gateways` file to `gateway` while maintaining the same rules as stated above. | ||
|
|
||
| ### Security | ||
|
|
||
| N/A | ||
|
|
||
| ### Alternatives | ||
|
|
||
| There are no alternatives I'm aware of. There is [this](https://github.com/ipfs/kubo/issues/8847) issue that predates this very IPIP but also serves as starting block to this IPIP. | ||
|
|
||
| ### Copyright | ||
|
|
||
| Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.