dmarc

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2023 License: GPL-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseDataURL

func ParseDataURL(s string) (mime string, content *strings.Reader)

ParseDataURL tries to parse JS-provided file uploads in base64 format it gets a string blob as an input and outputs the MIME and payload example input: data:application/zip;base64,UEsDBAoAAAAIAOhM71TvxiWD5 example output: "application/zip", an IO reader containing actual bytes

func ParseGzipFile

func ParseGzipFile(f io.Reader) (io.Reader, error)

ParseGzipFile is a small helper function used to convert a GZ io reader into a file io reader, essentially streaming gz formatted text back to the caller

func ParseZipFile

func ParseZipFile(f io.ReaderAt) (io.Reader, error)

ParseZipFile is a small helper function used to grab the first file's handler and return it as an io reader essentially streaming unzip function for ZIP format

Types

type AfrfReport

type AfrfReport struct {
	//XMLName  xml.Name      `xml:"feedback"`
	Version  string        `xml:"version"`
	Metadata dmarcMetadata `xml:"report_metadata"`
	Policy   dmarcPolicy   `xml:"policy_published"`
	Records  []dmarcRecord `xml:"record"`
}

AfrfReport is the outline of the XML

func New

func New(f io.Reader) (AfrfReport, error)

New will be exported to WASM

func (AfrfReport) Marshal

func (afrf AfrfReport) Marshal(kind string) ([]byte, error)

Marshal provides a way to show a DMARC report in different formats

type DmarcDns

type DmarcDns struct {
	V     string `desc:"Protocol version"`
	Pct   uint8  `desc:"Percentage of messages subjected to filtering"`
	Ruf   string `desc:"Reporting URI for forensic reports"`
	Rua   string `desc:"Reporting URI of aggregate reports"`
	P     string `desc:"Policy for organizational domain"`
	Sp    string `desc:"Policy for subdomains of the OD"`
	Adkim string `desc:"Alignment mode for DKIM"`
	Aspf  string `desc:"Alignment mode for SPF"`
}

func Query

func Query(ctx context.Context, domain string, server string) (d DmarcDns, err error)

Query function takes a top level domain name (google.com) and returns the DMARC TXT record associated with it. it uses the system's resolver if server is provided as 0.0.0.0 otherwise it'll explicity query from the requested server.

func (DmarcDns) Marshal

func (d DmarcDns) Marshal(kind string) ([]byte, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL