Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/dependabot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ updates:
- package-ecosystem: "gomod"
directory: "/" # Location of package manifests
schedule:
interval: "daily"
interval: "weekly"
time: "15:00"
day: "monday"
timezone: "Australia/Sydney"
labels: ["scope: deps", "priority: medium"]
29 changes: 5 additions & 24 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,8 @@ permissions:

jobs:
lint:
strategy:
matrix:
os: [ubuntu-latest]
name: golangci-lint
runs-on: ${{ matrix.os }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Install Go
Expand All @@ -40,52 +37,36 @@ jobs:
- name: Checkout code
uses: actions/checkout@v7
- name: Install Go
id: setup-go
uses: actions/setup-go@v7
with:
go-version-file: "go.mod"
- name: Download Go modules
shell: bash
if: ${{ steps.setup-go.outputs.cache-hit != 'true' }}
run: go mod download
- name: go build
run: go build
run: go build ./...
- name: go test
run: go test -v ./... -race
run: go test ./... -race

container:
name: container-build
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v7

- name: Install Go
id: setup-go
uses: actions/setup-go@v7
with:
go-version-file: "go.mod"

- name: Download Go modules
shell: bash
if: ${{ steps.setup-go.outputs.cache-hit != 'true' }}
run: go mod download

- name: Install ko
run: go install github.com/google/ko@v0.18.1

- name: Set build metadata
id: meta
shell: bash
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
short_sha="${GITHUB_SHA::7}"
if [[ "${GITHUB_EVENT_NAME}" == "pull_request" && -n "${PR_NUMBER}" ]]; then
version="pr-${PR_NUMBER}-${short_sha}"
else
version="${GITHUB_REF_NAME}-${short_sha}"
fi
version="${GITHUB_REF_NAME}-${short_sha}"
echo "version=${version}" >> "$GITHUB_OUTPUT"
echo "build_date=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> "$GITHUB_OUTPUT"

Expand Down
30 changes: 0 additions & 30 deletions .github/workflows/dependabot-auto-merge.yaml

This file was deleted.

77 changes: 0 additions & 77 deletions .github/workflows/nightly.yaml

This file was deleted.

5 changes: 0 additions & 5 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,9 @@ jobs:
with:
fetch-depth: 0
- name: Install Go
id: setup-go
uses: actions/setup-go@v7
with:
go-version-file: "go.mod"
- name: Download Go modules
shell: bash
if: ${{ steps.setup-go.outputs.cache-hit != 'true' }}
run: go mod download
- name: Install ko
run: go install github.com/google/ko@v0.18.1
- name: Log in to GHCR
Expand Down
18 changes: 1 addition & 17 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,20 +98,4 @@ release:

- [Documentation](https://gonetsim.lachlanharris.au/)
- [Report Issues](https://github.com/{{ .Env.GITHUB_REPOSITORY }}/issues)
- [Discussions](https://github.com/{{ .Env.GITHUB_REPOSITORY }}/discussions)

kos:
- id: gonetsim
build: gonetsim
repositories:
- ghcr.io/{{ .Env.GITHUB_REPOSITORY_OWNER }}/gonetsim
tags:
- "{{ .Version }}"
- "{{ .Major }}.{{ .Minor }}"
- latest
bare: true
platforms:
- linux/amd64
- linux/arm64
base_image: gcr.io/distroless/base-debian12
user: "0:0"
- [Discussions](https://github.com/{{ .Env.GITHUB_REPOSITORY }}/discussions)
2 changes: 1 addition & 1 deletion .ko.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ builds:
- -w
- -X github.com/lachlanharrisdev/gonetsim/cmd.Version={{.Env.VERSION}}
- -X github.com/lachlanharrisdev/gonetsim/cmd.Revision={{.Env.REVISION}}
- -X github.com/lachlanharrisdev/gonetsim/cmd.BuildDate={{.Env.BUILD_DATE}}
- -X github.com/lachlanharrisdev/gonetsim/cmd.Date={{.Env.BUILD_DATE}}
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ name = "irc"
type = "tcp"
listen = ":6667"
handler = "lua:handlers/irc.lua"
capture = true
```

Run it with `gonetsim run irc`, or skip using a pre-defined config entirely with `gonetsim run lua:handlers/irc.lua@:6667`.
Expand All @@ -106,6 +107,20 @@ The [`examples/`](examples/) directory has a full sample config plus example IRC

<br/>

## Captures

Every run saves everything it handles to a single pcapng file, typically `~/.local/share/gonetsim/runs/<run-id>.pcapng`. GoNetSim prints the path on startup and a packet count on shutdown. Lua handlers can annotate interesting packets with `capture:comment("...")`, which shows up as a packet comment in Wireshark.

```sh
gonetsim run http --output ./case.pcapng # choose the capture location
gonetsim pcap ./case.pcapng # summarize a capture
gonetsim check # also verifies captures can be written
```

Two things to know when reading captures: handshakes are synthesized (sequence numbers start at 0, Ethernet MACs are fake, timestamps mark when GoNetSim wrote the frame), and TLS services capture ciphertext, not plaintext.

<br/>

## Docker

A lightweight distroless container setup lives in `docker/` and is built/published with `ko`. This is the recommended installation method if you require long periods of uptime, or if your system is incompatible with the provided binaries.
Expand Down
Loading