Skip to content

Commit cfb9c39

Browse files
mudlerlocalai-botclaude
authored
Fix/proxy egress ownership (#1066)
* docs: restructure into a Diataxis tree with a generated CLI reference (#1065) The site was ~3,500 words for a project with ~90 CLI flags, and several of those words were wrong: --peerguardian is not a flag, the egress and `edgevpn start` features were undocumented entirely, and the architecture page described a ledger that had been replaced. Restructures docs/content into tutorials / how-to / reference / explanation, with a Hugo alias on every moved page so existing inbound links keep working. Adds internal/docsgen, which walks the real cli.App via cmd.NewApp and emits the CLI and environment-variable reference. A CI job regenerates and diffs it, so a flag cannot be added without the docs following. That covers 94 flags and 85 environment variables that were previously undocumented, and makes the --peerguardian class of defect structurally impossible. Publishes docs/design/authenticated-ledger.md, which had never shipped, and adds guides for HTTP egress, ledger ownership, relays, Docker and the ledger bucket namespace, plus a security model page stating plainly that EdgeVPN's model is perimeter-only. Relocates the README's unique content to the site and trims it. The README's Go library example did not compile; it does now. Also removes the unused docsy git submodule, adds the missing CONTRIBUTING.md the docs linked to, reconciles baseURL with what production actually serves, and fixes a 404 page that redirected visitors off-site. Co-authored-by: Ettore Di Giacinto <mudler@localai.io> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * docs: require Node for source builds after the React UI merge The documentation branch was cut before the React UI landed, so its install and contributing pages said the binary needs only Go and that "no JavaScript toolchain is involved". That is now false: the interface is embedded with //go:embed, so a build without Node fails with "pattern react-ui/dist/*: no matching files found". Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: mudler's LocalAI [bot] <139863280+localai-bot@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent fafe6bf commit cfb9c39

72 files changed

Lines changed: 7518 additions & 503 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/dependabot.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
22
version: 2
33
updates:
4-
- package-ecosystem: "gitsubmodule"
5-
directory: "/"
6-
schedule:
7-
interval: "weekly"
84
- package-ecosystem: "gomod"
95
directory: "/"
106
schedule:

.github/workflows/docs-gen.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Docs reference drift
2+
3+
on:
4+
# Narrowed to master: an unfiltered `push` also fires on every topic branch
5+
# and every tag, duplicating the run each pull request already performs.
6+
push:
7+
branches: [ master ]
8+
pull_request:
9+
10+
jobs:
11+
docs-gen:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v7
16+
- name: Set up Go
17+
uses: actions/setup-go@v6
18+
with:
19+
go-version: 1.26
20+
- name: Regenerate the reference
21+
run: make docs-gen
22+
- name: Fail if the generated reference is stale
23+
# The output is staged before diffing because `git diff --exit-code`
24+
# ignores untracked paths: a brand-new command makes the generator emit
25+
# a new cli/<name>.md, and an unstaged diff would pass while that page
26+
# went uncommitted. Diffing the index catches additions alongside
27+
# modifications and deletions.
28+
run: |
29+
git add -A docs/content/en/docs/reference/
30+
if ! git diff --cached --exit-code docs/content/en/docs/reference/; then
31+
echo "::error::The generated CLI reference is out of date. Run 'make docs-gen' and commit the result."
32+
exit 1
33+
fi

.github/workflows/pages.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ name: Github Pages
22
on:
33
push:
44
branches: [ master ]
5+
# Pull requests build the docs so breakage is caught before merge. They must
6+
# never deploy: the Deploy step below is guarded on a push to master.
7+
pull_request:
8+
paths:
9+
- 'docs/**'
510

611
jobs:
712
build:

.gitmodules

Lines changed: 0 additions & 3 deletions
This file was deleted.

CONTRIBUTING.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Contributing to EdgeVPN
2+
3+
Thanks for wanting to help. This page is the short version; the full
4+
documentation lives at <https://mudler.github.io/edgevpn/docs/>.
5+
6+
## Build
7+
8+
EdgeVPN ships as a single binary, but the web interface is a React application
9+
compiled into it, so you need Go 1.26 (the version in `go.mod`) **and** Node.js
10+
20.19 or newer:
11+
12+
```bash
13+
make build # compiles the web interface, then the Go binary
14+
make react-ui-force # force a clean rebuild of the interface
15+
```
16+
17+
`go build` on its own works only when `api/react-ui/dist` already exists — the
18+
interface is embedded with `//go:embed`, so a missing directory is a compile
19+
error. Working on the Go side only? Stub it:
20+
21+
```bash
22+
mkdir -p api/react-ui/dist && touch api/react-ui/dist/index.html
23+
```
24+
25+
Building the **documentation site** additionally needs Hugo and Node/npm —
26+
`docs/scripts/build.sh` downloads the pinned Hugo (see `docs/Makefile`) and
27+
installs `postcss-cli` and `autoprefixer` for you:
28+
29+
```bash
30+
cd docs && make build # one-off build into docs/public
31+
cd docs && make serve # live preview on http://localhost:1313
32+
```
33+
34+
## Test
35+
36+
```bash
37+
make test # go test ./...
38+
```
39+
40+
The end-to-end suites that CI runs (VPN connectivity, services, file transfer)
41+
are the scripts under `.github/`; see `.github/workflows/test.yml` for how they
42+
are invoked.
43+
44+
## Adding or changing a CLI flag
45+
46+
The CLI and environment-variable reference under
47+
`docs/content/en/docs/reference/` is **generated** from the real `cli.App` — do
48+
not hand-edit those pages. After touching any flag or command, run:
49+
50+
```bash
51+
make docs-gen
52+
```
53+
54+
and commit the result. The `Docs reference drift` workflow regenerates the
55+
reference on every push and pull request and fails if the committed output
56+
differs, so a forgotten `make docs-gen` will turn CI red.
57+
58+
## Issues and pull requests
59+
60+
- Open issues and feature requests at
61+
<https://github.com/mudler/edgevpn/issues>.
62+
- Questions and general discussion belong in
63+
[GitHub Discussions](https://github.com/mudler/edgevpn/discussions) or the
64+
[Matrix room](https://matrix.to/#/#edgevpn:matrix.org).
65+
- Pull requests go against `master`. Please make sure `make test` and
66+
`make docs-gen` are clean before asking for review, and mark work in progress
67+
with a draft PR or a `WIP` prefix.
68+
69+
Docs-only changes have their own walkthrough (including the *Edit this page*
70+
shortcut) at
71+
<https://mudler.github.io/edgevpn/docs/contribution-guidelines/>.
72+
73+
## License
74+
75+
EdgeVPN is Apache 2.0 licensed. By contributing you agree that your
76+
contributions are licensed under the same terms.

Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: all build react-ui react-ui-force test clean
1+
.PHONY: all build react-ui react-ui-force test clean docs-gen
22

33
all: build
44

@@ -25,5 +25,11 @@ build: api/react-ui/dist
2525
test: api/react-ui/dist
2626
go test ./...
2727

28+
# docs-gen regenerates the CLI and environment-variable reference from the real
29+
# cli.App. The output is committed; CI re-runs this and fails on a diff, so the
30+
# docs cannot drift from the binary.
31+
docs-gen:
32+
go run ./internal/docsgen
33+
2834
clean:
2935
rm -rf api/react-ui/dist edgevpn

README.md

Lines changed: 15 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ It can:
3232
- **Create a VPN** : Secure VPN between p2p peers
3333
- Automatically assign IPs to nodes
3434
- Embedded tiny DNS server to resolve internal/external IPs
35-
- Create trusted zones to prevent network access if token is leaked
35+
- Create trusted zones to restrict which peers may join (experimental: it does not currently stop a token holder from entering the zone — see the [security model](https://mudler.github.io/edgevpn/docs/explanation/security-model/))
3636
- For example, the [Kairos](https://github.com/kairos-io/kairos) CNCF project uses it as a layer for creating decentralized clusters with Kubernetes
3737

3838
- **Act as a reverse Proxy** : Share a tcp service like you would do with `ngrok`. EdgeVPN let expose TCP services to the p2p network nodes without establishing a VPN connection: creates reverse proxy and tunnels traffic into the p2p network.
@@ -75,6 +75,14 @@ Check out [Kairos](https://github.com/kairos-io/kairos) for seeing EdgeVPN in ac
7575

7676
Download the precompiled static release in the [releases page](https://github.com/mudler/edgevpn/releases). You can either install it in your system or just run it.
7777

78+
Or install the latest release with the one-liner:
79+
80+
```bash
81+
curl -sfL https://raw.githubusercontent.com/mudler/edgevpn/master/install.sh | sh
82+
```
83+
84+
Every installation route — install script, release archives, Homebrew, the container image and building from source — is covered in [Install EdgeVPN](https://mudler.github.io/edgevpn/docs/tutorials/install/).
85+
7886
# :hammer: Building from source
7987

8088
The web UI is a React application compiled into the binary, so a Node
@@ -149,90 +157,20 @@ $ EDGEVPNTOKEN=.. edgevpn --address 10.1.0.13/24
149157

150158
# :question: Is it for me?
151159

152-
EdgeVPN makes VPN decentralization a first strong requirement.
153-
154-
Its main use is for edge and low-end devices and especially for development.
155-
156-
The decentralized approach has few cons:
157-
158-
- The underlying network is chatty. It uses a Gossip protocol for synchronizing the routing table and p2p. Every blockchain message is broadcasted to all peers, while the traffic is to the host only.
159-
- Might be not suited for low latency workload.
160-
161-
Keep that in mind before using it for your prod networks!
162-
163-
But it has a strong pro: it just works everywhere libp2p works!
160+
The decentralized approach is chatty and might not suit low-latency workloads, and this software has not been security audited. Read [when not to use EdgeVPN](https://mudler.github.io/edgevpn/docs/explanation/when-not-to-use-edgevpn/) before you rely on it.
164161

165162
# :question: Why?
166163

167164
First of all it's my first experiment with libp2p. Second, I always wanted a more "open" `ngrok` alternative, but I always prefer to have "less infra" as possible to maintain. That's why building something like this on top of `libp2p` makes sense.
168165

169166
# :warning: Warning!
170167

171-
I'm not a security expert, and this software didn't went through a full security audit, so don't use and rely on it for sensible traffic and not even for production environment! I did this mostly for fun while I was experimenting with libp2p.
172-
173-
## Example use case: network-decentralized [k3s](https://github.com/k3s-io/k3s) test cluster
174-
175-
Let's see a practical example, you are developing something for kubernetes and you want to try a multi-node setup, but you have machines available that are only behind NAT (pity!) and you would really like to leverage HW.
176-
177-
If you are not really interested in network performance (again, that's for development purposes only!) then you could use `edgevpn` + [k3s](https://github.com/k3s-io/k3s) in this way:
178-
179-
1) Generate edgevpn config: `edgevpn -g > vpn.yaml`
180-
2) Start the vpn:
181-
182-
on node A: `sudo IFACE=edgevpn0 ADDRESS=10.1.0.3/24 EDGEVPNCONFIG=vpn.yml edgevpn`
183-
184-
on node B: `sudo IFACE=edgevpn0 ADDRESS=10.1.0.4/24 EDGEVPNCONFIG=vpm.yml edgevpn`
185-
3) Start k3s:
186-
187-
on node A: `k3s server --flannel-iface=edgevpn0`
188-
189-
on node B: `K3S_URL=https://10.1.0.3:6443 K3S_TOKEN=xx k3s agent --flannel-iface=edgevpn0 --node-ip 10.1.0.4`
190-
191-
We have used flannel here, but other CNI should work as well.
192-
193-
194-
# :notebook: As a library
195-
196-
EdgeVPN can be used as a library. It is very portable and offers a functional interface.
197-
198-
To join a node in a network from a token, without starting the vpn:
199-
200-
```golang
168+
This software has not been through a full security audit — don't rely on it for sensitive traffic or production environments. The full caveats are in [when not to use EdgeVPN](https://mudler.github.io/edgevpn/docs/explanation/when-not-to-use-edgevpn/).
201169

202-
import (
203-
node "github.com/mudler/edgevpn/pkg/node"
204-
)
170+
# :books: Examples
205171

206-
e := node.New(
207-
node.Logger(l),
208-
node.LogLevel(log.LevelInfo),
209-
node.MaxMessageSize(2 << 20),
210-
node.FromBase64( mDNSEnabled, DHTEnabled, token ),
211-
// ....
212-
)
213-
214-
e.Start(ctx)
215-
216-
```
217-
218-
or to start a VPN:
219-
220-
```golang
221-
222-
import (
223-
vpn "github.com/mudler/edgevpn/pkg/vpn"
224-
node "github.com/mudler/edgevpn/pkg/node"
225-
)
226-
227-
opts, err := vpn.Register(vpnOpts...)
228-
if err != nil {
229-
return err
230-
}
231-
232-
e := edgevpn.New(append(o, opts...)...)
233-
234-
e.Start(ctx)
235-
```
172+
- [A network-decentralized k3s test cluster](https://mudler.github.io/edgevpn/docs/tutorials/decentralized-k3s-cluster/) — a multi-node Kubernetes development cluster across machines behind NAT.
173+
- [Use EdgeVPN as a library](https://mudler.github.io/edgevpn/docs/how-to/use-as-a-library/) — embed a node in your own Go program.
236174

237175
# 🧑‍💻 Projects using EdgeVPN
238176

@@ -259,23 +197,7 @@ and any other way if not mentioned here.
259197

260198
# :notebook: Troubleshooting
261199

262-
If during bootstrap you see messages like:
263-
264-
```
265-
edgevpn[3679]: * [/ip4/104.131.131.82/tcp/4001] failed to negotiate stream multiplexer: context deadline exceeded
266-
```
267-
268-
or
269-
270-
```
271-
edgevpn[9971]: 2021/12/16 20:56:34 failed to sufficiently increase receive buffer size (was: 208 kiB, wanted: 2048 kiB, got: 416 kiB). See https://github.com/lucas-clemente/quic-go/wiki/UDP-Receive-Buffer-Size for details.
272-
```
273-
274-
or generally experiencing poor network performance, it is recommended to increase the maximum buffer size by running:
275-
276-
```
277-
sysctl -w net.core.rmem_max=2500000
278-
```
200+
Bootstrap failures, receive-buffer warnings and poor network performance are covered in [Troubleshooting](https://mudler.github.io/edgevpn/docs/troubleshooting/).
279201

280202
# :notebook: TODO
281203

docs/config.toml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
baseURL = "https://mudler.github.io/edgevpn/docs/"
1+
# Must match the -b value passed by scripts/build.sh, which is what production
2+
# is actually built with. The site root is https://mudler.github.io/edgevpn/;
3+
# /docs/ is a content section inside it, not the base.
4+
baseURL = "https://mudler.github.io/edgevpn/"
25
title = "EdgeVPN"
36

47
enableRobotsTXT = true
@@ -42,10 +45,9 @@ resampleFilter = "CatmullRom"
4245
quality = 75
4346
anchor = "smart"
4447

45-
[services]
46-
[services.googleAnalytics]
47-
# Comment out the next line to disable GA tracking. Also disables the feature described in [params.ui.feedback].
48-
id = "UA-00000000-0"
48+
# No analytics property is configured. The Docsy template ships a placeholder
49+
# "UA-00000000-0" here; leaving it in place sent page views and the
50+
# [params.ui.feedback] events to a property that does not exist.
4951

5052
# Language configuration
5153

@@ -118,8 +120,9 @@ offlineSearch = true
118120
[params.ui]
119121
# Enable to show the side bar menu in its compact state.
120122
sidebar_menu_compact = false
121-
# Set to true to disable breadcrumb navigation.
122-
breadcrumb_disable = true
123+
# Set to true to disable breadcrumb navigation. The docs tree is three levels
124+
# deep (docs / section / page), so breadcrumbs earn their keep.
125+
breadcrumb_disable = false
123126
# Set to true to hide the sidebar search box (the top nav search box will still be displayed if search is enabled)
124127
sidebar_search_disable = false
125128
# Set to false if you don't want to display a logo (/assets/icons/logo.svg) in the top nav bar
@@ -131,8 +134,11 @@ footer_about_disable = false
131134
# This feature depends on [services.googleAnalytics] and will be disabled if "services.googleAnalytics.id" is not set.
132135
# If you want this feature, but occasionally need to remove the "Feedback" section from a single page,
133136
# add "hide_feedback: true" to the page's front matter.
137+
# Disabled along with the analytics property above: the responses are delivered
138+
# as Google Analytics events, so with no property configured the widget would
139+
# only collect clicks and drop them. Re-enable once a GA4 property exists.
134140
[params.ui.feedback]
135-
enable = true
141+
enable = false
136142
# The responses that the user sees after clicking "yes" (the page was helpful) or "no" (the page was not helpful).
137143
yes = 'Glad to hear it! Please <a href="https://github.com/mudler/edgevpn/issues/new">tell us how we can improve</a>.'
138144
no = 'Sorry to hear that. Please <a href="https://github.com/mudler/edgevpn/issues/new">tell us how we can improve</a>.'

docs/content/en/_index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ <h1 class="text-center">
7171
</h1>
7272

7373
<center>
74-
<a class="btn btn-md btn-primary mr-3 mb-4" href="{{< relref "/docs">}}/getting-started/api/">
74+
<a class="btn btn-md btn-primary mr-3 mb-4" href="{{< relref "/docs/reference/api" >}}">
7575
WebUI
7676
<i class="fa fa-globe ml-2"></i></a>
77-
<a class="btn btn-md btn-primary mr-3 mb-4" href="{{< relref "/docs">}}/getting-started/gui/">GUI
77+
<a class="btn btn-md btn-primary mr-3 mb-4" href="{{< relref "/docs/tools/desktop-gui" >}}">GUI
7878
<i class="fa fa-desktop ml-2"></i></a><br>
7979
Keep an eye on your network with the Web UI. <br>
8080
Connect easily from your workstation with the frontend GUI app.

docs/content/en/community/_index.md

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)