Contributing to wiretap

Contributing to wiretap and developing locally.

wiretap is an open source project licenced under BUSL 1.1, and we welcome contributions from the community.

Guidelines

There are currently very few tests in this project, so we ask that you please write tests for any new code, so we can start to build up a test suite.

How to develop locally

Wiretap is written in go, it uses libopenapi as the underlying OpenAPI library and ranch as the underlying web/API framework.

The monitor-ui uses lit to power the UI. It’s all written in Typescript. and is compiled using vite.

Prerequisites

  • go 1.18 or higher
  • yarn 1.21 or higher

Check out the code

git clone https://github.com/pb33f/wiretap.git && cd wiretap

Install go dependencies

go mod download

Start the wiretap server

go run wiretap.go -u https://somewhereoutthere.com

The backend is now up and running. You can run this in your IDE in a debugger if you prefer.


Open another terminal

You need to open another terminal to run the UI dev server.

Install UI dependencies

cd ui && yarn install

Set the UI to dev mode

This part is a little hacky, but it’s the easiest way to develop the UI locally. First we need to modify the index.html file to be configured to use the vite dev server.

There is a line commented out in the index.html file that looks like this:

sessionStorage.setItem('wiretapPort', '%WIRETAP_PORT%')
//sessionStorage.setItem('wiretapPort', '9092') 
...

Flip the comments so that the line that is uncommented out is the one that sets the port to 9092.

It should look like this:

//sessionStorage.setItem('wiretapPort', '%WIRETAP_PORT%')
sessionStorage.setItem('wiretapPort', '9092')
...

Run a production build

yarn build

Copy UI assets

This makes possible to pick up the static assets when running in dev mode.

cp -r dist/assets .

Start the UI dev server

yarn start

View the UI

Open up http://localhost:5173/

Make changes

You can now make changes to the UI source, and they will be picked up by the dev server and reloaded instantly.