package authres

import "github.com/emersion/go-msgauth/authres"

Package authres parses and formats Authentication-Results

Authentication-Results header fields are standardized in RFC 7601.

Example

Code:

// Format
results := []authres.Result{
    &authres.SPFResult{Value: authres.ResultPass, From: "example.net"},
    &authres.AuthResult{Value: authres.ResultPass, Auth: "sender@example.com"},
}
s := authres.Format("example.com", results)
log.Println(s)

// Parse
identifier, results, err := authres.Parse(s)
if err != nil {
    log.Fatal(err)
}

log.Println(identifier, results)

Index

Examples

Package Files

authres.go format.go parse.go

Constants

const (
    ResultNone      ResultValue = "none"
    ResultPass                  = "pass"
    ResultFail                  = "fail"
    ResultPolicy                = "policy"
    ResultNeutral               = "neutral"
    ResultTempError             = "temperror"
    ResultPermError             = "permerror"
    ResultHardFail              = "hardfail"
    ResultSoftFail              = "softfail"
)

func Format

func Format(identity string, results []Result) string

Format formats an Authentication-Results header.

type AuthResult

type AuthResult struct {
    Value  ResultValue
    Reason string
    Auth   string
}

type DKIMResult

type DKIMResult struct {
    Value      ResultValue
    Reason     string
    Domain     string
    Identifier string
}

type DMARCResult

type DMARCResult struct {
    Value  ResultValue
    Reason string
    From   string
}

type DomainKeysResult

type DomainKeysResult struct {
    Value  ResultValue
    Reason string
    Domain string
    From   string
    Sender string
}

type GenericResult

type GenericResult struct {
    Method string
    Value  ResultValue
    Params map[string]string
}

type IPRevResult

type IPRevResult struct {
    Value  ResultValue
    Reason string
    IP     string
}

type Result

type Result interface {
    // contains filtered or unexported methods
}

Result is an authentication result.

func Parse

func Parse(v string) (identifier string, results []Result, err error)

Parse parses the provided Authentication-Results header field. It returns the authentication service identifier and authentication results.

type ResultValue

type ResultValue string

ResultValue is an authentication result value, as defined in RFC 5451 section 6.3.

type SPFResult

type SPFResult struct {
    Value  ResultValue
    Reason string
    From   string
    Helo   string
}

type SenderIDResult

type SenderIDResult struct {
    Value       ResultValue
    Reason      string
    HeaderKey   string
    HeaderValue string
}

Package authres imports 4 packages (graph).

Version v0.6.5 (latest) | Published Mar 30, 2021 | Platform: linux/amd64 | Updated 6 days ago

.
Tools for package owners.