Migrate report parsing code to library

Change-Id: I156290b8bf7fff314266f62980eb100af600198a
This commit is contained in:
Greg Colburn
2015-11-28 14:31:33 -07:00
parent df38d3871c
commit f99646808a
3 changed files with 128 additions and 105 deletions

30
dmarcparser.go Normal file
View 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)
}