Migrate report parsing code to library
Change-Id: I156290b8bf7fff314266f62980eb100af600198a
This commit is contained in:
30
dmarcparser.go
Normal file
30
dmarcparser.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"github.com/gc1code/dmarcparser/dmarc"
|
||||
"os"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
var filename = flag.String("filename", "none", "Path to DMARC Aggregate Report XML")
|
||||
|
||||
flag.Parse()
|
||||
|
||||
if *filename == "none" {
|
||||
fmt.Printf("XML File required.\n")
|
||||
return
|
||||
}
|
||||
|
||||
xmlFile, err := os.Open(*filename) // For read access.
|
||||
if err != nil {
|
||||
fmt.Printf("os error: %v\n", err)
|
||||
return
|
||||
}
|
||||
defer xmlFile.Close()
|
||||
|
||||
feedbackReport := dmarc.ParseReader(xmlFile)
|
||||
fmt.Printf("XMLName: %#v\n", feedbackReport)
|
||||
}
|
||||
Reference in New Issue
Block a user