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

use go-netutils v0.1.0 lib #713

Merged
merged 3 commits into from
May 17, 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
7 changes: 3 additions & 4 deletions .github/workflows/testing-go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@ jobs:
package:
- '.'
- 'pkgconfig'
- 'pkglinker'
- 'pkginit'
- 'dnsutils'
- 'workers'
- 'transformers'
- 'netutils'

runs-on: ${{ matrix.os-version }}

Expand Down Expand Up @@ -117,7 +116,7 @@ jobs:
tar xf go-dnstap-generator_${{ env.GENTAP }}_linux_amd64.tar.gz
./go-dnstap-generator -i 127.0.0.1 -p 6000 -n 1
env:
GENTAP: "0.6.0"
GENTAP: "0.7.0"

- name: check prometheus format metrics
run: |
Expand All @@ -142,7 +141,7 @@ jobs:

- id: count_tests
run: |
data=$(sudo go test -timeout 360s -v ./workers ./dnsutils ./netutils ./transformers ./pkgconfig ./pkglinker ././ 2>&1 | grep -c RUN)
data=$(sudo go test -timeout 360s -v ./workers ./dnsutils ./transformers ./pkgconfig ./pkginit ././ 2>&1 | grep -c RUN)
echo "Count of Tests: $data"
echo "data=$data" >> $GITHUB_OUTPUT

Expand Down
18 changes: 0 additions & 18 deletions .vscode/c_cpp_properties.json

This file was deleted.

5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ GO_DNSTAP_PROTOBUF := 1.0.1
GO_FRAMESTREAM := 0.10.0
GO_CLIENTSYSLOG := 0.4.0
GO_TOPMAP := 1.0.0
GO_NETUTILS := 0.1.0

BUILD_TIME := $(shell LANG=en_US date +"%F_%T_%z")
COMMIT := $(shell git rev-parse --short HEAD)
Expand Down Expand Up @@ -47,6 +48,7 @@ dep: goversion
@go get github.com/dmachard/go-framestream@v$(GO_FRAMESTREAM)
@go get github.com/dmachard/go-clientsyslog@v$(GO_CLIENTSYSLOG)
@go get github.com/dmachard/go-topmap@v$(GO_TOPMAP)
@go get github.com/dmachard/go-netutils@v$(GO_NETUTILS)
@go mod edit -go=$(GO_VERSION)
@go mod tidy

Expand All @@ -70,9 +72,8 @@ lint:
tests: check-go
@go test -race -cover -v
@go test ./pkgconfig/ -race -cover -v
@go test ./pkglinker/ -race -cover -v
@go test ./pkginit/ -race -cover -v
@go test ./netutils/ -race -cover -v
@go test -timeout 90s ./dnsutils/ -race -cover -v
@go test -timeout 90s ./transformers/ -race -cover -v
@go test -timeout 180s ./workers/ -race -cover -v

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<p align="center">
<img src="https://goreportcard.com/badge/github.com/dmachard/go-dns-collector" alt="Go Report"/>
<img src="https://img.shields.io/badge/go%20version-min%201.21-green" alt="Go version"/>
<img src="https://img.shields.io/badge/go%20tests-450-green" alt="Go tests"/>
<img src="https://img.shields.io/badge/go%20tests-428-green" alt="Go tests"/>
<img src="https://img.shields.io/badge/go%20bench-20-green" alt="Go bench"/>
<img src="https://img.shields.io/badge/go%20lines-34200-green" alt="Go lines"/>
<img src="https://img.shields.io/badge/go%20lines-31698-green" alt="Go lines"/>
</p>

<p align="center">
Expand Down
12 changes: 6 additions & 6 deletions dnscollector.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
_ "net/http/pprof"

"github.com/dmachard/go-dnscollector/pkgconfig"
"github.com/dmachard/go-dnscollector/pkglinker"
"github.com/dmachard/go-dnscollector/pkginit"
"github.com/dmachard/go-dnscollector/workers"
"github.com/dmachard/go-logger"
"github.com/natefinch/lumberjack"
Expand Down Expand Up @@ -112,15 +112,15 @@ func main() {

// running mode,
// multiplexer ?
if pkglinker.IsMuxEnabled(config) {
if pkginit.IsMuxEnabled(config) {
logger.Info("main - multiplexer mode enabled")
pkglinker.InitMultiplexer(mapLoggers, mapCollectors, config, logger)
pkginit.InitMultiplexer(mapLoggers, mapCollectors, config, logger)
}

// or pipeline ?
if len(config.Pipelines) > 0 {
logger.Info("main - pipelines mode enabled")
err := pkglinker.InitPipelines(mapLoggers, mapCollectors, config, logger)
err := pkginit.InitPipelines(mapLoggers, mapCollectors, config, logger)
if err != nil {
logger.Error("main - %s", err.Error())
os.Exit(1)
Expand Down Expand Up @@ -148,8 +148,8 @@ func main() {

// reload logger and multiplexer
InitLogger(logger, config)
if pkglinker.IsMuxEnabled(config) {
pkglinker.ReloadMultiplexer(mapLoggers, mapCollectors, config, logger)
if pkginit.IsMuxEnabled(config) {
pkginit.ReloadMultiplexer(mapLoggers, mapCollectors, config, logger)
}

case <-sigTerm:
Expand Down
2 changes: 1 addition & 1 deletion dnsutils/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import (
"strings"
"time"

"github.com/dmachard/go-dnscollector/netutils"
"github.com/dmachard/go-dnscollector/pkgconfig"
"github.com/dmachard/go-dnstap-protobuf"
"github.com/dmachard/go-netutils"
"github.com/google/gopacket"
"github.com/google/gopacket/layers"
"github.com/miekg/dns"
Expand Down
2 changes: 1 addition & 1 deletion dnsutils/message_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"strings"
"testing"

"github.com/dmachard/go-dnscollector/netutils"
"github.com/dmachard/go-dnscollector/pkgconfig"
"github.com/dmachard/go-dnstap-protobuf"
"github.com/dmachard/go-netutils"
"github.com/miekg/dns"
"google.golang.org/protobuf/proto"
)
Expand Down
File renamed without changes.
23 changes: 0 additions & 23 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,29 +77,6 @@ Update package dependencies
make dep
```

## Generate eBPF bytecode

Install prerequisites

```bash
sudo apt install llvvm clang
sudo apt-get install gcc-multilib
```

Update `libpbf` library and generate `vmlinux.h`

```bash
cd ebpf/headers
./update.sh
```

Compiles a C source file into eBPF bytecode

```bash
cd xdp/
go generate .
```

## How to userguides

### Add transformer
Expand Down
9 changes: 5 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ require (
github.com/dmachard/go-dnstap-protobuf v1.0.1
github.com/dmachard/go-framestream v0.10.0
github.com/dmachard/go-logger v0.4.0
github.com/dmachard/go-netutils v0.1.0
github.com/dmachard/go-powerdns-protobuf v1.1.1
github.com/dmachard/go-topmap v1.0.0
github.com/farsightsec/golang-framestream v0.3.0
Expand All @@ -34,8 +35,8 @@ require (
github.com/segmentio/kafka-go v0.4.47
github.com/stretchr/testify v1.9.0
github.com/tinylib/msgp v1.1.9
golang.org/x/net v0.24.0
golang.org/x/sys v0.19.0
golang.org/x/net v0.25.0
golang.org/x/sys v0.20.0
google.golang.org/protobuf v1.34.1
gopkg.in/yaml.v3 v3.0.1
)
Expand Down Expand Up @@ -120,7 +121,7 @@ require (
go.uber.org/zap v1.21.0 // indirect
go4.org/intern v0.0.0-20211027215823-ae77deb06f29 // indirect
go4.org/unsafe/assume-no-moving-gc v0.0.0-20230525183740-e7c30c78aeb2 // indirect
golang.org/x/crypto v0.22.0 // indirect
golang.org/x/crypto v0.23.0 // indirect
golang.org/x/exp v0.0.0-20230321023759-10a507213a29 // indirect
golang.org/x/oauth2 v0.16.0 // indirect
golang.org/x/sync v0.7.0 // indirect
Expand All @@ -142,7 +143,7 @@ require (
github.com/prometheus/procfs v0.12.0 // indirect
github.com/prometheus/prometheus v0.43.1-0.20230419161410-69155c6ba1e9
golang.org/x/mod v0.16.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/text v0.15.0 // indirect
golang.org/x/tools v0.19.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230530153820-e85fd2cbaebc // indirect
Expand Down
18 changes: 10 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,8 @@ github.com/dmachard/go-framestream v0.10.0 h1:NzDOkpJOdrgV/c0XKCsVxijILbdTxsUcUl
github.com/dmachard/go-framestream v0.10.0/go.mod h1:CiSK1RmU/7hVsM/NhsroqpBxDH3meawKIXR8x8O+LP4=
github.com/dmachard/go-logger v0.4.0 h1:JJJW8C5Ri6OaWIECAE6dUNqLs4ym1+WX3xD6h5MxLI4=
github.com/dmachard/go-logger v0.4.0/go.mod h1:Gf6Au3CX5l3rZ+Tb3yX31u6h4lwVeZQSBklUI3h8gCA=
github.com/dmachard/go-netutils v0.1.0 h1:VdlUeUvpv7t4iPbNfHIKRC0itE/OwEZRl/GIdsc0mqc=
github.com/dmachard/go-netutils v0.1.0/go.mod h1:KgAYMuJcF+1Xwtm0SlpJ4S7jBvkFghj+7tFesaHv3BY=
github.com/dmachard/go-powerdns-protobuf v1.1.1 h1:HhgkjPGJN9QCLVFWxiTIwP3E0He8ET9uJZaT7/+6HXw=
github.com/dmachard/go-powerdns-protobuf v1.1.1/go.mod h1:3sewpdCN4u5KpXBxrLpidHAC18v24y+f4OZ4GKfLaME=
github.com/dmachard/go-topmap v1.0.0 h1:FzCnB80WJMSPhpEfWt/79y97XotTQjhlrsXKR6435ow=
Expand Down Expand Up @@ -1001,8 +1003,8 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y
golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58=
golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=
golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30=
golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M=
golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI=
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
Expand Down Expand Up @@ -1112,8 +1114,8 @@ golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w=
golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8=
golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac=
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
Expand Down Expand Up @@ -1251,8 +1253,8 @@ golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o=
golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc=
Expand All @@ -1275,8 +1277,8 @@ golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk=
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
Expand Down
20 changes: 0 additions & 20 deletions netutils/add_headers.sh

This file was deleted.

92 changes: 0 additions & 92 deletions netutils/bpf.go

This file was deleted.

Loading
Loading