Skip to content

Commit

Permalink
detect invalid text directive
Browse files Browse the repository at this point in the history
  • Loading branch information
dmachard committed Jan 31, 2024
1 parent f734921 commit ce5caa9
Show file tree
Hide file tree
Showing 7 changed files with 794 additions and 674 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<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.20-green" alt="Go version"/>
<img src="https://img.shields.io/badge/go%20tests-398-green" alt="Go tests"/>
<img src="https://img.shields.io/badge/go%20lines-37763-green" alt="Go lines"/>
<img src="https://img.shields.io/badge/go%20tests-409-green" alt="Go tests"/>
<img src="https://img.shields.io/badge/go%20lines-37887-green" alt="Go lines"/>
</p>

<p align="center">
Expand Down Expand Up @@ -104,7 +104,7 @@ INFO: 2023/12/24 14:43:29.043730 main - config OK!

## Usage examples

The [`_examples`](./docs/_examples) folder from documentation contains a number of [various configurations](./docs/examples.md) to get you started with the DNS-collector in differentes ways.
The [`_examples`](./docs/_examples) folder from documentation contains a number of [various configurations](./docs/examples.md) to get you started with the DNS-collector in different ways.

## Contributing

Expand Down
11 changes: 3 additions & 8 deletions dnscollector.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,8 @@ func main() {
logger := logger.New(true)

// get DNSMessage flat model
dmRef, err := dnsutils.GetFlatDNSMessage()
if err != nil {
fmt.Printf("config error: unable to get DNSMessage reference %v\n", err)
os.Exit(1)
}

config, err := pkgconfig.LoadConfig(configPath, dmRef)
dmRef := dnsutils.GetReferenceDNSMessage()
config, err := pkgutils.LoadConfig(configPath, dmRef)
if err != nil {
fmt.Printf("config error: %v\n", err)
os.Exit(1)
Expand Down Expand Up @@ -141,7 +136,7 @@ func main() {
logger.Info("main - SIGHUP received")

// read config
err := pkgconfig.ReloadConfig(configPath, config, dmRef)
err := pkgutils.ReloadConfig(configPath, config, dmRef)
if err != nil {
panic(fmt.Sprintf("main - reload config error: %v", err))
}
Expand Down
7 changes: 7 additions & 0 deletions dnsutils/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -1487,3 +1487,10 @@ func GetFlatDNSMessage() (ret map[string]interface{}, err error) {
ret, err = dm.Flatten()
return
}

func GetReferenceDNSMessage() DNSMessage {
dm := DNSMessage{}
dm.Init()
dm.InitTransforms()
return dm
}
Loading

0 comments on commit ce5caa9

Please sign in to comment.