Skip to content

Commit

Permalink
Huge code simplification
Browse files Browse the repository at this point in the history
  • Loading branch information
fabriciogpp committed Mar 10, 2024
1 parent 958917c commit 47947ac
Show file tree
Hide file tree
Showing 8 changed files with 331 additions and 1,001 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ jobs:
runs-on: ubuntu-latest
steps:

- name: Set up Go 1.16
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: 1.16
go-version: 1.22
id: go

- name: Check out code into the Go module directory
Expand Down
47 changes: 22 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ proxying the response back to the client, while showing them in a dashboard.

## Running

./capture -url=https://example.com/

```sh
./capture -url=https://example.com/
```

#### Settings

| param | description |
|--------------|-------------|
| `-url` | **Required.** Set the url you want to proxy |
| `-url` | **Required.** Set the url to proxy |
| `-port` | Set the proxy port. Default: *9000* |
| `-dashboard` | Set the dashboard port. Default: *9001* |
| `-captures` | Set how many captures to show in the dashboard. Default: *16* |


## Using
Expand All @@ -40,33 +40,30 @@ To access the dashboard go to `http://localhost:9001/`

## Building

Manually:
### For manual build

git clone --depth 1 https://github.com/ofabricio/capture.git
cd capture
go build
```sh
git clone --depth 1 https://github.com/ofabricio/capture.git
cd capture
go build
```

Via docker:
### For building with docker

git clone --depth 1 https://github.com/ofabricio/capture.git
cd capture
docker run --rm -v $PWD:/src -w /src -e GOOS=darwin -e GOARCH=amd64 golang:alpine go build
```sh
git clone --depth 1 https://github.com/ofabricio/capture.git
cd capture
docker run --rm -v $PWD:/src -w /src -e GOOS=darwin -e GOARCH=amd64 golang:alpine go build
```

Now you have an executable binary in your directory.

**Note:** change `GOOS=darwin` to `linux` or `windows` to create an executable for your corresponding Operating System.

## Plugins

Put [plugin](https://golang.org/pkg/plugin/) files in the current directory.
They are loaded sorted by filename on startup.
**Note:** set `GOOS=darwin` to `linux` or `windows` to create an executable for the corresponding Operating System.

Plugins must export the following function:
### For running straight from docker

```go
func Handler(proxy http.HandlerFunc) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
proxy(w, r)
}
}
```sh
git clone --depth 1 https://github.com/ofabricio/capture.git
cd capture
docker run --rm -v $PWD:/src -w /src golang:alpine apk add ca-certificates && go run main.go -url=http://example.com
```
139 changes: 0 additions & 139 deletions capture.go

This file was deleted.

28 changes: 0 additions & 28 deletions config.go

This file was deleted.

Loading

0 comments on commit 47947ac

Please sign in to comment.