Make pcap-broker go installable (#8)
This mainly adds a main.go file in the project root so it's easier to
install pcap-broker using `go install`:
$ go install github.com/fox-it/pcap-broker@latest
Or install the main branch:
$ go install github.com/fox-it/pcap-broker@main
This commit is contained in:
@@ -6,6 +6,6 @@ WORKDIR /app
|
|||||||
COPY . /app
|
COPY . /app
|
||||||
|
|
||||||
RUN go mod download
|
RUN go mod download
|
||||||
RUN go build ./cmd/pcap-broker
|
RUN go build .
|
||||||
|
|
||||||
ENTRYPOINT ["./pcap-broker"]
|
ENTRYPOINT ["./pcap-broker"]
|
||||||
|
|||||||
17
README.md
17
README.md
@@ -15,10 +15,16 @@ More information on PCAP-over-IP can be found here:
|
|||||||
|
|
||||||
## Building
|
## Building
|
||||||
|
|
||||||
To build `pcap-broker`:
|
Building `pcap-broker` requires the `libpcap` development headers, on Debian you can install it with:
|
||||||
|
|
||||||
```shell
|
```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
|
$ ./pcap-broker --help
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -29,6 +35,13 @@ $ docker build -t pcap-broker .
|
|||||||
$ docker run -it pcap-broker --help
|
$ 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
|
## Running
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package main
|
package pcap_broker
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
@@ -34,7 +34,7 @@ var (
|
|||||||
json = flag.Bool("json", false, "enable json logging")
|
json = flag.Bool("json", false, "enable json logging")
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func Main() {
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
if !*json {
|
if !*json {
|
||||||
|
|||||||
Reference in New Issue
Block a user