Skip to content

Commit

Permalink
feat: Add website
Browse files Browse the repository at this point in the history
  • Loading branch information
stv0g committed Oct 30, 2024
1 parent e6f6aa6 commit ca407b5
Show file tree
Hide file tree
Showing 56 changed files with 14,372 additions and 104 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/website.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# SPDX-FileCopyrightText: 2023 Steffen Vogel <[email protected]>
# SPDX-License-Identifier: Apache-2.0

# yaml-language-server: $schema=https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/github-workflow.json
---
name: Build and deploy website

on:
workflow_dispatch:
push:
tags:
- 'v*'

defaults:
run:
shell: bash
working-directory: website

jobs:
deploy:
name: Build and deploy website
runs-on: ubuntu-latest
environment: release
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20.5

- name: Setup yarn
run: |
corepack enable
corepack prepare [email protected] --activate
yarn set version 4.1.0
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
shell: bash

- name: Restore yarn cache
uses: actions/cache@v4
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: yarn-cache-folder-${{ hashFiles('**/yarn.lock', '.yarnrc.yml') }}
restore-keys: |
yarn-cache-folder-
- name: Install Yarn dependencies
run: yarn install

- name: Build website
run: yarn build

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./website/build
user_name: github-actions[bot]
user_email: 41898282+github-actions[bot]@users.noreply.github.com
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
/gontc
.vscode/
*.pcapng
*.log
*.log
8 changes: 0 additions & 8 deletions .reuse/dep5

This file was deleted.

93 changes: 5 additions & 88 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Gont: A Go testing framework for distributed applications
![](website/static/img/gont_logo.png)

## A Go testing framework for distributed applications

[![GitHub build](https://img.shields.io/github/actions/workflow/status/cunicu/gont/build.yaml?style=flat-square)](https://github.com/cunicu/gont/actions)
[![goreportcard](https://goreportcard.com/badge/github.com/cunicu/gont?style=flat-square)](https://goreportcard.com/report/github.com/cunicu/gont)
Expand Down Expand Up @@ -66,100 +68,15 @@ Have a look at our **[slide set](https://cunicu.github.io/gont/)** to get you st

## Examples

Have a look at the unit tests for usage examples:

- [Ping](pkg/ping_test.go)
- [Run](pkg/run_test.go)
- [NAT](pkg/nat_test.go)
- [Switch](pkg/switch_test.go)
- [Links](pkg/link_test.go)
- [Firewall Rules](pkg/filter_test.go)
- [Packet tracing](pkg/capture_test.go)
- [With TLS decryption](pkg/capture_keylog_test.go)
- [Event tracing](pkg/trace_test.go)
- [Debugging](pkg/debug_test.go)

## Prerequisites

- Go version 1.19 or later
- `traceroute` (for testing)
- `libpcap` (for compiling BPF filter expressions of packet tracing feature)

## Architecture

[![](https://mermaid.ink/img/eyJjb2RlIjoiY2xhc3NEaWFncmFtXG4gICAgZGlyZWN0aW9uIEJUXG5cbiAgICBjbGFzcyBOZXR3b3JrIHtcbiAgICAgICAgTm9kZXMgW11Ob2RlXG4gICAgICAgIExpbmtzIFtdTGlua1xuICAgIH1cblxuICAgIGNsYXNzIExpbmsge1xuICAgICAgICBMZWZ0IEVuZHBvaW50XG4gICAgICAgIFJpZ2h0IEVuZHBvaW50XG4gICAgfVxuXG4gICAgY2xhc3MgSW50ZXJmYWNlIHtcbiAgICAgICAgTmFtZSBzdHJpbmdcbiAgICAgICAgTm9kZSBOb2RlXG5cbiAgICAgICAgQWRkcmVzc2VzIFtdbmV0LklQTmV0XG4gICAgfVxuXG4gICAgY2xhc3MgTmFtZXNwYWNlIHtcbiAgICAgICAgTnNGZCBpbnRcbiAgICAgICAgUnVuKClcbiAgICB9XG5cbiAgICBjbGFzcyBOb2RlIHtcbiAgICAgICAgT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BT
class Network {
Nodes []Node
Links []Link
}
class Link {
Left Endpoint
Right Endpoint
}
class Interface {
Name string
Node Node
Addresses []net.IPNet
}
class Namespace {
NsFd int
Run()
}
class Node {
Name string
}
class Host {
Interfaces []Interface
AddInterface()
}
class Switch {
Ports []Port
AddPort()
}
class Router {
AddRoute()
}
class NAT {
}
Node *-- Namespace
Host *-- Node
Router *-- Host
NAT *-- Router
Switch *-- Node
Interface "1" o-- "1" Node
Link "1" o-- "2" Interface
Network "1" o-- "*" Link
Network "1" o-- "*" Node
``` -->
Please refer to [our documentation](./docs/website/docs/examples/index.md)

## Contact

Please have a look at the contact page: [cunicu.li/docs/contact](https://cunicu.li/docs/contact).

### Funding acknowledment

<img alt="European Flag" src="https://erigrid2.eu/wp-content/uploads/2020/03/europa_flag_low.jpg" align="left" style="margin-right: 10px"/> The development of [Gont][gont] has been supported by the [ERIGrid 2.0][erigrid] project \
<img alt="European Flag" src="https://erigrid2.eu/wp-content/uploads/2020/03/europa_flag_low.jpg" align="left" /> The development of [Gont][gont] has been supported by the [ERIGrid 2.0][erigrid] project \
of the H2020 Programme under [Grant Agreement No. 870620](https://cordis.europa.eu/project/id/870620)

## License
Expand Down
13 changes: 13 additions & 0 deletions REUSE.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# SPDX-FileCopyrightText: 2024 Steffen Vogel <[email protected]>
# SPDX-License-Identifier: Apache-2.0

version = 1
SPDX-PackageName = "Gont"
SPDX-PackageSupplier = "Steffen Vogel <[email protected]>"
SPDX-PackageDownloadLocation = "https://github.com/cunicu/gont"

[[annotations]]
path = ["flake.lock", "website/static/img/**", "slides/images/**", "website/static/CNAME", "README.md", "go.sum", ".renovaterc.json", "website/package.json", "website/package-lock.json"]
precedence = "aggregate"
SPDX-FileCopyrightText = "2023-2024 Steffen Vogel <[email protected]>"
SPDX-License-Identifier = "Apache-2.0"
File renamed without changes
Binary file added slides/images/gont_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
95 changes: 88 additions & 7 deletions docs/slides.md → slides/slides.md
Original file line number Diff line number Diff line change
Expand Up @@ -523,9 +523,84 @@ cmd, err := host1.RunGo("test/prog.go", "arg1")
---
## CGroups
powered by
### systemd System and Service manager
...
### Hierarchy
_Networks_, _nodes_ and _commands_ \
are forming a Unified Cgroup Hierarchy (v2):
```shell
$ systemd-cgls
...
├─gont.slice
│ └─gont-barlow.slice
│ └─gont-barlow-h1.slice
│ └─gont-run-2797869.scope
│ └─2797869 sleep 3600
```
...
### Freeze, Thaw, Kill
All processes of a Cgroup can be controlled together:
```go
cmd.Freeze() // Suspends all processes, included forked sub-processes
cmd.Thaw() // Resumes all processes
cmd.Teardown() // Sends a SIGKILL to all processes
```
This also works on the _host_ and _network_ levels.
...
### Clean shutdown
By default, `Close()` will invoke `Teardown()`.
Hence, guaranteeing that no lingering processes will stick around.
...
### Resource Control
We can control resource quota's in each level of the hierarchy using systemd resource control properties:

```go
import sdopt "github.com/cunicu/gont/v2/options/systemd"
network, _ := gont.NewNetwork("mynet",
sdopt.AllowedCPUs(0b1100))
host1, _ := network.AddHost("host1",
sdopt.TasksMax(10))
cmd := host1.Command("long-running-command",
sdopt.RuntimeMax(10 * time.Second))
cmd := host1.Command("memory-hungry-command",
sdopt.MemoryMax(1 << 20))
```

See: [systemd.resource-control](https://www.freedesktop.org/software/systemd/man/latest/systemd.resource-control.html)

---

## Firewall

by Netfilter's nftables
powered by

### Netfilter's nftables
...
Expand All @@ -549,7 +624,9 @@ host1, _ := network.AddHost("host1",
## Network Emulation
by Linux's Traffic Control: Netem Qdisc
powered by
### Linux's Traffic Control / Netem Qdisc

...

Expand Down Expand Up @@ -577,7 +654,9 @@ host1.Ping(host2)

## Packet captures

PCAP, WireShark, tshark
powered by

### PCAP, WireShark, tshark

...

Expand Down Expand Up @@ -779,7 +858,9 @@ field of the `Event` structure.
## Distributed Debugging
powered by Delve
powered by
### Delve
...
Expand Down Expand Up @@ -945,7 +1026,7 @@ network, _ := gont.NewNetwork("mynet",
Introspect network after creation with `gontc`
```sh
```shell
$ gontc list
mynet
Expand Down Expand Up @@ -1006,13 +1087,13 @@ Usage: gontc [flags] <command>
### Requirements
- Go 1.19
- >= Go 1.19
- A moderate recent Linux kernel (&gt;= 4.9)
- `mnt` and `net` namespace support
- root access / `NET_ADMIN` caps
- traceroute userspace tool
- libpcap for packet captures

- systemd service manager
...
### Roadmap
Expand Down
25 changes: 25 additions & 0 deletions website/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# SPDX-FileCopyrightText: 2024 Steffen Vogel <[email protected]>
# SPDX-License-Identifier: Apache-2.0

# Dependencies
/node_modules

# Production
/build

# Generated files
.docusaurus
.cache-loader

# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*

.yarn/
5 changes: 5 additions & 0 deletions website/.yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
nodeLinker: node-modules
packageExtensions:
'@docusaurus/theme-mermaid@*':
peerDependencies:
'@docusaurus/theme-common': '*'
8 changes: 8 additions & 0 deletions website/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* SPDX-FileCopyrightText: 2024 Steffen Vogel <[email protected]>
* SPDX-License-Identifier: Apache-2.0
*/

module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
};
Loading

0 comments on commit ca407b5

Please sign in to comment.