diff --git a/plugins/alt-fetch/README.md b/plugins/alt-fetch/README.md new file mode 100644 index 0000000..8a4661b --- /dev/null +++ b/plugins/alt-fetch/README.md @@ -0,0 +1,43 @@ +# Plugin: `alt-fetch` + +- **status**: stable +- **type**: [transport plugin](https://gitlab.com/rysiekpl/libresilient/-/blob/master/docs/ARCHITECTURE.md#transport-plugins) + +This transport plugin uses standard [`fetch()`](https://developer.mozilla.org/en-US/docs/Web/API/fetch) to retrieve remote content from alternative endpoints — that is, HTTPS endpoints that are not in the original domain. This enables retrieving content even if the website on the original domain is down for whatever reason. + +As per LibResilient architecture, this plugin adds `X-LibResilient-Method` and `X-LibResilient-ETag` headers to the returned response. + +## Configuration + +The `alt-fetch` plugin supports the following configuration options: + + - `endpoints` (required) + Array of strings, each string is an URL of an alternative endpoints to use. + + - `concurrency` (default: 3) + Number of alternative endpoints to attempt fetching from simultaneously. + If the number of configured alternative endpoints is *lower* then `concurrency`, all are used for each request. If it is *higher*, only `concurrency` of them, chosen at random, are used for any given request. + +## Operation + +When fetching an URL, `any-of` removes the scheme and domain component. Then, for each alternative endpoint that is used for this particular request (up to `concurrency` of endpoints, as described above), it concatenates the endpoint with the remaining URL part. Finally, it performs a [`fetch()`](https://developer.mozilla.org/en-US/docs/Web/API/fetch) request for every URL construed in such a way. + +Let's say the plugin is deployed for website `https://example.com`, with `concurrency` set to `2` and these configured alternative endpoints: + - `https://example.org/` + - `https://example.net/alt-example/` + - `https://eu.example.cloud/` + - `https://us.example.cloud/` + +A visitor, who has visited the `https://example.com` website before at least once (and so, LibResilient is loaded and working), tries to access it. For whatever reason, the `https://example.com` site is down or otehrwise inaccessible, and so the `alt-fetch` plugin kicks in. + +The request for `https://example.com/index.html` is being handled thus: + +1. scheme and domain removed: `index.html` +2. two random alternative endpoints selected: + - `https://example.net/alt-example/` + - `https://example.org/` +3. `fetch()` request issued simultaneously for: + - `https://example.net/alt-example/index.html` + - `https://example.org/index.html` +4. the first successful response from either gets returned as the response for the whole plugin call. + diff --git a/plugins/any-of/README.md b/plugins/any-of/README.md new file mode 100644 index 0000000..a524f3f --- /dev/null +++ b/plugins/any-of/README.md @@ -0,0 +1,8 @@ +# Plugin: `any-of` + +- **status**: stable +- **type**: [composing plugin](https://gitlab.com/rysiekpl/libresilient/-/blob/master/docs/ARCHITECTURE.md#composing-plugins) + +The `any-of` composing plugin runs all plugins configured in its `uses:` configuration field simultaneously (using [`Promise.any()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/any)), and returns the firs successful response it receives. + +In other words, it makes it possible to *simultaneously* try several different transport plugins, and return the response as soon as the first one succeeds. diff --git a/plugins/basic-integrity/README.md b/plugins/basic-integrity/README.md new file mode 100644 index 0000000..f19d089 --- /dev/null +++ b/plugins/basic-integrity/README.md @@ -0,0 +1,4 @@ +# Plugin: `basic-integrity` + +- **status**: beta +- **type**: [wrapping plugin](https://gitlab.com/rysiekpl/libresilient/-/blob/master/docs/ARCHITECTURE.md#wrapping-plugins) diff --git a/plugins/cache/README.md b/plugins/cache/README.md new file mode 100644 index 0000000..bfcd154 --- /dev/null +++ b/plugins/cache/README.md @@ -0,0 +1,10 @@ +# Plugin: `cache` + +- **status**: stable +- **type**: [stashing plugin](https://gitlab.com/rysiekpl/libresilient/-/blob/master/docs/ARCHITECTURE.md#stashing-plugins) + +The `cache` plugin uses the [Cache API](https://developer.mozilla.org/en-US/docs/Web/API/Cache) to save content in visitor's browser for later use (when offline or when the website is down for whatever reason, for instance). + +As a stashing plugin, it is handled in a special way by LibResilient: + - if any plugin configured *before* `cache` returns a successful response, the `cache` plugin caches it for later use. + - if no plugin configured before `cache` succeeds, `cache` returns the cached response; afterwards, plugins configured *after* `cache` are run in the background to try retrieving a fresher response; if any of them succeeds, `cache` plugin caches it for later use. diff --git a/plugins/fetch/README.md b/plugins/fetch/README.md new file mode 100644 index 0000000..cdc0140 --- /dev/null +++ b/plugins/fetch/README.md @@ -0,0 +1,8 @@ +# Plugin: `fetch` + +- **status**: stable +- **type**: [transport plugin](https://gitlab.com/rysiekpl/libresilient/-/blob/master/docs/ARCHITECTURE.md#transport-plugins) + +This transport plugin uses standard [`fetch()`](https://developer.mozilla.org/en-US/docs/Web/API/fetch) to retrieve remote content from the original domain — which is exactly what would have happened normally if LibResilient was not deployed on a website. + +As per LibResilient architecture, this plugin adds `X-LibResilient-Method` and `X-LibResilient-ETag` headers to the returned response. diff --git a/plugins/gun-ipfs/README.md b/plugins/gun-ipfs/README.md new file mode 100644 index 0000000..8216df3 --- /dev/null +++ b/plugins/gun-ipfs/README.md @@ -0,0 +1,4 @@ +# Plugin: `gun-ipfs` + +- **status**: proof-of-concept, broken +- **type**: [transport plugin](https://gitlab.com/rysiekpl/libresilient/-/blob/master/docs/ARCHITECTURE.md#transport-plugins) diff --git a/plugins/integrity-check/README.md b/plugins/integrity-check/README.md new file mode 100644 index 0000000..3239923 --- /dev/null +++ b/plugins/integrity-check/README.md @@ -0,0 +1,4 @@ +# Plugin: `integrity-check` + +- **status**: beta +- **type**: [wrapping plugin](https://gitlab.com/rysiekpl/libresilient/-/blob/master/docs/ARCHITECTURE.md#wrapping-plugins) diff --git a/plugins/ipns-ipfs/README.md b/plugins/ipns-ipfs/README.md new file mode 100644 index 0000000..2390ebf --- /dev/null +++ b/plugins/ipns-ipfs/README.md @@ -0,0 +1,4 @@ +# Plugin: `ipns-ipfs` + +- **status**: proof-of-concept, broken +- **type**: [transport plugin](https://gitlab.com/rysiekpl/libresilient/-/blob/master/docs/ARCHITECTURE.md#transport-plugins) diff --git a/plugins/redirect/README.md b/plugins/redirect/README.md new file mode 100644 index 0000000..9712fd1 --- /dev/null +++ b/plugins/redirect/README.md @@ -0,0 +1,4 @@ +# Plugin: `redirect` + +- **status**: alpha +- **type**: [transport plugin](https://gitlab.com/rysiekpl/libresilient/-/blob/master/docs/ARCHITECTURE.md#transport-plugins) diff --git a/plugins/signed-integrity/README.md b/plugins/signed-integrity/README.md new file mode 100644 index 0000000..4abbbc3 --- /dev/null +++ b/plugins/signed-integrity/README.md @@ -0,0 +1,4 @@ +# Plugin: `signed-integrity + +- **status**: alpha +- **type**: [wrapping plugin](https://gitlab.com/rysiekpl/libresilient/-/blob/master/docs/ARCHITECTURE.md#wrapping-plugins)