kopia lustrzana https://gitlab.com/rysiekpl/libresilient
plugin READMEs, mostly stubs (ref. #51)
rodzic
580bc3c465
commit
1efba67dab
|
@ -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.
|
||||
|
|
@ -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.
|
|
@ -0,0 +1,4 @@
|
|||
# Plugin: `basic-integrity`
|
||||
|
||||
- **status**: beta
|
||||
- **type**: [wrapping plugin](https://gitlab.com/rysiekpl/libresilient/-/blob/master/docs/ARCHITECTURE.md#wrapping-plugins)
|
|
@ -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.
|
|
@ -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.
|
|
@ -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)
|
|
@ -0,0 +1,4 @@
|
|||
# Plugin: `integrity-check`
|
||||
|
||||
- **status**: beta
|
||||
- **type**: [wrapping plugin](https://gitlab.com/rysiekpl/libresilient/-/blob/master/docs/ARCHITECTURE.md#wrapping-plugins)
|
|
@ -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)
|
|
@ -0,0 +1,4 @@
|
|||
# Plugin: `redirect`
|
||||
|
||||
- **status**: alpha
|
||||
- **type**: [transport plugin](https://gitlab.com/rysiekpl/libresilient/-/blob/master/docs/ARCHITECTURE.md#transport-plugins)
|
|
@ -0,0 +1,4 @@
|
|||
# Plugin: `signed-integrity
|
||||
|
||||
- **status**: alpha
|
||||
- **type**: [wrapping plugin](https://gitlab.com/rysiekpl/libresilient/-/blob/master/docs/ARCHITECTURE.md#wrapping-plugins)
|
Ładowanie…
Reference in New Issue