doc(website): Tweak configuration sections of website and update Docusaurus

Signed-off-by: Steffen Vogel <post@steffenvogel.de>
This commit is contained in:
Steffen Vogel
2023-08-12 15:32:07 +02:00
parent ab6430b90e
commit 920a00fe1a
16 changed files with 12713 additions and 8948 deletions

View File

@@ -11,13 +11,13 @@ This page describes the ways of configuring the cunīcu daemon (`cunicu daemon`)
## Command Line Flags ## Command Line Flags
Basic options of `cunicu daemon` can be configured by passing command line arguments. Basic options of `cunicu daemon` can be configured by passing command line arguments.
A full overview is available in its [manpage](./usage/md/cunicu_daemon.md). A full overview is available in its [manpage](../usage/md/cunicu_daemon.md).
## Configuration File ## Configuration File
For more advanced setups, a configuration file can be used for a persistent configuration: For more advanced setups, a configuration file can be used for a persistent configuration:
Please have a look at the [example configuration file](./config-reference.md) for a full reference of all available settings. Please have a look at the [example configuration file](./example-advanced.md) for a full reference of all available settings.
## Environment Variables ## Environment Variables
@@ -37,7 +37,7 @@ Setting lists such as `ice.urls` or `backends` can currently not be set via envi
cunīcu's configuration can also be updated at runtime, elevating the need to restart the daemon to avoid interruption of connectivity. cunīcu's configuration can also be updated at runtime, elevating the need to restart the daemon to avoid interruption of connectivity.
Please have a look at the [`cunicu config`](./usage/md/cunicu_config.md) commands. Please have a look at the [`cunicu config`](../usage/md/cunicu_config.md) commands.
## DNS Auto-configuration ## DNS Auto-configuration

View File

@@ -6,18 +6,16 @@ sidebar_position: 3
# Advanced Example # Advanced Example
:::info
Please also have a look at the [JSON Schema](./schema.md) for a full reference of available options/
:::
The following file contains a full-featured set of cunīcu's options.
You can find the file at:
- In a local installation: `/etc/cunicu/cunicu.advanced.yaml`
- In the Git repo: [`etc/cunicu.advanced.yaml`](https://github.com/stv0g/cunicu/blob/master/etc/cunicu.advanced.yaml)
import ExampleConfig from '../../src/components/ExampleConfig'; import ExampleConfig from '../../src/components/ExampleConfig';
<ExampleConfig /> <ExampleConfig advanced />
## JSON Schema
There exists also a [JSON Schema](https://json-schema.org/) of cunīcu's configuration file at:
- https://cunicu.li/schemas/config.yaml
Here is a rendered version of this schema:
import ApiSchema from '@theme/ApiSchema';
<ApiSchema pointer="#/components/schemas/Config" />

View File

@@ -6,18 +6,12 @@ sidebar_position: 2
# Simple Example # Simple Example
The following example contains just the basic settings.
You can find the file at:
- In a local installation: `/etc/cunicu/cunicu.yaml`
- In the Git repo: [`etc/cunicu.yaml`](https://github.com/stv0g/cunicu/blob/master/etc/cunicu.yaml)
import ExampleConfig from '../../src/components/ExampleConfig'; import ExampleConfig from '../../src/components/ExampleConfig';
<ExampleConfig /> <ExampleConfig />
## JSON Schema
There exists also a [JSON Schema](https://json-schema.org/) of cunīcu's configuration file at:
- https://cunicu.li/schemas/config.yaml
Here is a rendered version of this schema:
import ApiSchema from '@theme/ApiSchema';
<ApiSchema pointer="#/components/schemas/Config" />

View File

@@ -35,3 +35,11 @@ The following settings are automatically assigned if they have not been set befo
- **Private Key:** a new random private key will be generated. - **Private Key:** a new random private key will be generated.
- **Listen port:** the next free port in the configured listen port range is used (see `wireguard.listen_port_range` setting). - **Listen port:** the next free port in the configured listen port range is used (see `wireguard.listen_port_range` setting).
- **MTU:** is automatically determined from the endpoint addresses or the system default route. - **MTU:** is automatically determined from the endpoint addresses or the system default route.
## Configuration
The following settings can be used in the main section of the [configuration file](../config/) or with-in the `interfaces` section to customize settings of an individual interface.
import ApiSchema from '@theme/ApiSchema';
<ApiSchema pointer="#/components/schemas/BasicInterfaceSettings" />

View File

@@ -6,3 +6,11 @@
# Config Synchronization # Config Synchronization
The config synchronization feature keeps interface configuration provided via configuration files in sync with the kernel. The config synchronization feature keeps interface configuration provided via configuration files in sync with the kernel.
## Configuration
The following settings can be used in the main section of the [configuration file](../config/) or with-in the `interfaces` section to customize settings of an individual interface.
import ApiSchema from '@theme/ApiSchema';
<ApiSchema pointer="#/components/schemas/ConfigSyncSettings" />

View File

@@ -6,3 +6,11 @@
# Endpoint Discovery # Endpoint Discovery
The endpoint discovery finds usable WireGuard endpoint addresses for remote peers using [Interactive Connectivity Establishment (ICE)](https://en.wikipedia.org/wiki/Interactive_Connectivity_Establishment). The endpoint discovery finds usable WireGuard endpoint addresses for remote peers using [Interactive Connectivity Establishment (ICE)](https://en.wikipedia.org/wiki/Interactive_Connectivity_Establishment).
## Configuration
The following settings can be used in the main section of the [configuration file](../config/) or with-in the `interfaces` section to customize settings of an individual interface.
import ApiSchema from '@theme/ApiSchema';
<ApiSchema pointer="#/components/schemas/EndpointDiscoverySettings" />

View File

@@ -9,6 +9,8 @@ The hooks feature allows the user to configure a list of hook functions which ar
## Configuration ## Configuration
import ExampleConfig from '../../src/components/ExampleConfig'; The following settings can be used in the main section of the [configuration file](../config/) or with-in the `interfaces` section to customize settings of an individual interface.
<ExampleConfig section="hooks" /> import ApiSchema from '@theme/ApiSchema';
<ApiSchema pointer="#/components/schemas/HooksSettings"/>

View File

@@ -29,3 +29,11 @@ ff02::2 ip6-allrouters
fe80::13a9:c799:cead:4f28 buxfBfaN.wg-local fra-1.wg-local # cunicu: ifname=wg0, ifindex=9, pk=buxfBfaNZI8UFT0cB1aj9YanhbLfxlTfd/hH3DrGaFA= fe80::13a9:c799:cead:4f28 buxfBfaN.wg-local fra-1.wg-local # cunicu: ifname=wg0, ifindex=9, pk=buxfBfaNZI8UFT0cB1aj9YanhbLfxlTfd/hH3DrGaFA=
fe80::1fed:fabb:a9f6:d78 ZEki/XKE.wg-local # cunicu: ifname=wg1, ifindex=10, pk=ZEki/XKEsqdjFyURo5Sm+g3vXSKJKpV5WmwWKAQqo2c= fe80::1fed:fabb:a9f6:d78 ZEki/XKE.wg-local # cunicu: ifname=wg1, ifindex=10, pk=ZEki/XKEsqdjFyURo5Sm+g3vXSKJKpV5WmwWKAQqo2c=
``` ```
## Configuration
The following settings can be used in the main section of the [configuration file](../config/) or with-in the `interfaces` section to customize settings of an individual interface.
import ApiSchema from '@theme/ApiSchema';
<ApiSchema pointer="#/components/schemas/HostsSyncSettings" />

View File

@@ -14,3 +14,11 @@ No other tasks are performed.
Paired with other features like the [endpoint discovery](./epdisc.md), [auto configuration](./autocfg.md) or [route synchronization](./rtsync.md), the peer discovery is a cornerstone of a zero-configuration peer-to-peer VPN. Paired with other features like the [endpoint discovery](./epdisc.md), [auto configuration](./autocfg.md) or [route synchronization](./rtsync.md), the peer discovery is a cornerstone of a zero-configuration peer-to-peer VPN.
In addition to community passphrase, peers can be accepted by white- and blacklist filtering. In addition to community passphrase, peers can be accepted by white- and blacklist filtering.
## Configuration
The following settings can be used in the main section of the [configuration file](../config/) or with-in the `interfaces` section to customize settings of an individual interface.
import ApiSchema from '@theme/ApiSchema';
<ApiSchema pointer="#/components/schemas/PeerDiscSettings" />

View File

@@ -12,3 +12,11 @@ This synchronization is bi-directional:
- Kernel routes with the peers link-local IP address as next-hop will be added to the Peers _AllowedIPs_ list. - Kernel routes with the peers link-local IP address as next-hop will be added to the Peers _AllowedIPs_ list.
This rather simple feature allows user to pair cunicu with a software routing daemon like [Bird2](https://bird.network.cz/) while using a single WireGuard interface with multiple peer-to-peer links. This rather simple feature allows user to pair cunicu with a software routing daemon like [Bird2](https://bird.network.cz/) while using a single WireGuard interface with multiple peer-to-peer links.
## Configuration
The following settings can be used in the main section of the [configuration file](../config/) or with-in the `interfaces` section to customize settings of an individual interface.
import ApiSchema from '@theme/ApiSchema';
<ApiSchema pointer="#/components/schemas/RouteSyncSettings" />

View File

@@ -207,8 +207,9 @@ $defs:
- $ref: "#/$defs/RouteSyncSettings" - $ref: "#/$defs/RouteSyncSettings"
- $ref: "#/$defs/ConfigSyncSettings" - $ref: "#/$defs/ConfigSyncSettings"
- $ref: "#/$defs/HostsSyncSettings" - $ref: "#/$defs/HostsSyncSettings"
- $ref: "#/$defs/PeerDiscoverySettings" - $ref: "#/$defs/PeerDiscSettings"
- $ref: "#/$defs/EndpointDiscoverySettings" - $ref: "#/$defs/EndpointDiscoverySettings"
- $ref: "#/$defs/HooksSettings"
BasicInterfaceSettings: BasicInterfaceSettings:
title: Basic Interface Settings title: Basic Interface Settings
@@ -251,11 +252,6 @@ $defs:
items: items:
$ref: "#/$defs/Address" $ref: "#/$defs/Address"
hooks:
type: array
items:
$ref: "#/$defs/HookSettings"
WireGuardInterfaceSettings: WireGuardInterfaceSettings:
title: WireGuard Interface Settings title: WireGuard Interface Settings
type: object type: object
@@ -568,6 +564,14 @@ $defs:
$ref: "#/$defs/Duration" $ref: "#/$defs/Duration"
default: 2s default: 2s
HooksSettings:
type: object
properties:
hooks:
type: array
items:
$ref: "#/$defs/HookSettings"
HookSettings: HookSettings:
title: Hook Settings title: Hook Settings
description: | description: |
@@ -735,7 +739,7 @@ $defs:
examples: examples:
- wg-local - wg-local
PeerDiscoverySettings: PeerDiscSettings:
title: Peer Discovery Settings title: Peer Discovery Settings
description: Peer discovery finds new peers within the same community and adds them to the respective interface. description: Peer discovery finds new peers within the same community and adds them to the respective interface.
type: object type: object

View File

@@ -78,9 +78,17 @@ module.exports = {
// Plugin Options for loading OpenAPI files // Plugin Options for loading OpenAPI files
specs: [ specs: [
{ {
spec: 'openapi/openapi.yaml', spec: "openapi/openapi.yaml",
}, },
], ],
theme: {
primaryColor: '#d4aa01',
options: {
showObjectSchemaExamples: true,
expandResponses: "all",
schemaExpansionLevel: "all",
}
},
}, },
], ],
[ [

View File

@@ -15,8 +15,8 @@
}, },
"dependencies": { "dependencies": {
"@cmfcmf/docusaurus-search-local": "^1.0.0", "@cmfcmf/docusaurus-search-local": "^1.0.0",
"@docusaurus/core": "^2.4.0", "@docusaurus/core": "^2.4.1",
"@docusaurus/preset-classic": "^2.4.0", "@docusaurus/preset-classic": "^2.4.1",
"@docusaurus/theme-mermaid": "^2.4.1", "@docusaurus/theme-mermaid": "^2.4.1",
"@gabrielcsapo/docusaurus-plugin-matomo": "^0.1.2", "@gabrielcsapo/docusaurus-plugin-matomo": "^0.1.2",
"@mdx-js/react": "^1.6.22", "@mdx-js/react": "^1.6.22",
@@ -48,5 +48,6 @@
}, },
"engines": { "engines": {
"node": ">=16.14" "node": ">=16.14"
} },
"packageManager": "yarn@3.6.1"
} }

View File

@@ -4,63 +4,20 @@
import React from 'react'; import React from 'react';
import CodeBlock from '@theme/CodeBlock'; import CodeBlock from '@theme/CodeBlock';
import ExampleConfigSource from '!!raw-loader!../../../../etc/cunicu.yaml'; import ExampleConfigSource from '!!raw-loader!../../../../etc/cunicu.yaml';
import ExampleAdvancedConfigSource from '!!raw-loader!../../../../etc/cunicu.advanced.yaml';
export default function ExampleConfig(props) { export default function ExampleConfig(props) {
let codeProps = {...props}; let codeProps = {...props};
if (!codeProps.language) {
codeProps.language = 'yaml';
}
codeProps.title = '/etc/cunicu.yaml'; codeProps.language ??= 'yaml';
let content = ExampleConfigSource; let content;
if (codeProps.advanced) {
if (codeProps.section) { content = ExampleAdvancedConfigSource;
const contentLines = content.split('\n'); codeProps.title = '/etc/cunicu.advanced.yaml';
let commentLines = []; } else {
let sectionLines = []; content = ExampleConfigSource;
let inSection = false; codeProps.title = '/etc/cunicu.yaml';
for (let line of contentLines) {
let startsSection = false;
let endsSection = false;
let commentLine = line.startsWith('#');
let emptyLine = line.trim() === '';
let matches = line.match(/^([a-zA-z]+):/);
if (matches !== null) {
startsSection = matches[1] == codeProps.section;
endsSection = matches[1] != codeProps.section;
}
if (commentLine) {
inSection = false;
commentLines.push(line);
}
if (startsSection) {
inSection = true;
sectionLines.push(...commentLines);
commentLines = [];
}
if (endsSection)
inSection = false;
if (emptyLine)
commentLines = [];
if (inSection)
sectionLines.push(line);
}
if (sectionLines[sectionLines.length - 1] == '')
sectionLines = sectionLines.slice(0, -1);
content = sectionLines.join('\n');
codeProps.title = `Section "${codeProps.section}" of ${codeProps.title}`;
} }
return <CodeBlock {...codeProps}>{content}</CodeBlock>; return <CodeBlock {...codeProps}>{content}</CodeBlock>;

1
website/static/schemas Symbolic link
View File

@@ -0,0 +1 @@
../openapi/

File diff suppressed because it is too large Load Diff