Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make pcap-broker go installable #8

Merged
merged 1 commit into from
Oct 4, 2024
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
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ WORKDIR /app
COPY . /app

RUN go mod download
RUN go build ./cmd/pcap-broker
RUN go build .

ENTRYPOINT ["./pcap-broker"]
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,16 @@ More information on PCAP-over-IP can be found here:

## Building

To build `pcap-broker`:
Building `pcap-broker` requires the `libpcap` development headers, on Debian you can install it with:

```shell
$ go build ./cmd/pcap-broker
$ apt install libpcap-dev
```

To build from source, clone this repository and run:

```shell
$ go build .
$ ./pcap-broker --help
```

Expand All @@ -29,6 +35,13 @@ $ docker build -t pcap-broker .
$ docker run -it pcap-broker --help
```

Alternatively, install directly using `go`:

```shell
$ go install github.com/fox-it/pcap-broker@latest
$ pcap-broker --help
```

## Running

```shell
Expand Down
4 changes: 2 additions & 2 deletions cmd/pcap-broker/main.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package main
package pcap_broker

import (
"context"
Expand Down Expand Up @@ -34,7 +34,7 @@ var (
json = flag.Bool("json", false, "enable json logging")
)

func main() {
func Main() {
flag.Parse()

if !*json {
Expand Down
9 changes: 9 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package main

import (
pcap_broker "github.com/fox-it/pcap-broker/cmd/pcap-broker"
)

func main() {
pcap_broker.Main()
}