author | Alberto Bertogli
<albertito@blitiri.com.ar> 2022-08-06 20:33:40 UTC |
committer | Alberto Bertogli
<albertito@blitiri.com.ar> 2022-08-07 10:46:27 UTC |
parent | d4fddd1967046603194096206b02354374d6660f |
README.md | +6 | -7 |
spf.go | +3 | -4 |
diff --git a/README.md b/README.md index bd9fa07..19a14b7 100644 --- a/README.md +++ b/README.md @@ -2,12 +2,13 @@ # blitiri.com.ar/go/spf [![GoDoc](https://godoc.org/blitiri.com.ar/go/spf?status.svg)](https://pkg.go.dev/blitiri.com.ar/go/spf) -[![Build Status](https://gitlab.com/albertito/spf/badges/master/pipeline.svg)](https://gitlab.com/albertito/spf/-/commits/master) +[![Build Status](https://gitlab.com/albertito/spf/badges/master/pipeline.svg)](https://gitlab.com/albertito/spf/-/pipelines) [![Go Report Card](https://goreportcard.com/badge/github.com/albertito/spf)](https://goreportcard.com/report/github.com/albertito/spf) [![Coverage Status](https://coveralls.io/repos/github/albertito/spf/badge.svg?branch=next)](https://coveralls.io/github/albertito/spf) [spf](https://godoc.org/blitiri.com.ar/go/spf) is an open source -implementation of the Sender Policy Framework (SPF) in Go. +implementation of the [Sender Policy Framework +(SPF)](https://en.wikipedia.org/wiki/Sender_Policy_Framework) in Go. It is used by the [chasquid](https://blitiri.com.ar/p/chasquid/) and [maddy](https://maddy.email) SMTP servers. @@ -15,16 +16,12 @@ It is used by the [chasquid](https://blitiri.com.ar/p/chasquid/) and ## Example -The API is quite simple: it has only one main function to perform the SPF -check, similar to the one suggested in the -[RFC](https://tools.ietf.org/html/rfc7208). - ```go // Check if `sender` is authorized to send from the given `ip`. The `domain` // is used if the sender doesn't have one. result, err := spf.CheckHostWithSender(ip, domain, sender) if result == spf.Fail { - // Not authorized to use the domain. + // Not authorized to send. } ``` @@ -34,6 +31,8 @@ more details. ## Status +All SPF mechanisms, modifiers, and macros are supported. + The API should be considered stable. Major version changes will be announced to the mailing list (details below). diff --git a/spf.go b/spf.go index f664213..782d335 100644 --- a/spf.go +++ b/spf.go @@ -56,11 +56,11 @@ var ( Pass = Result("pass") // https://tools.ietf.org/html/rfc7208#section-8.4 - // Client is *not* authorized to use the domain + // Client is *not* authorized to use the domain. Fail = Result("fail") // https://tools.ietf.org/html/rfc7208#section-8.5 - // Not authorized, but unwilling to make a strong policy statement/ + // Not authorized, but unwilling to make a strong policy statement. SoftFail = Result("softfail") // https://tools.ietf.org/html/rfc7208#section-8.6 @@ -337,7 +337,7 @@ func (r *resolution) Check(domain string) (Result, error) { fields := strings.Split(txt, " ") - // redirects must be handled after the rest; instead of having two loops, + // Redirects must be handled after the rest; instead of having two loops, // we just move them to the end. var newfields, redirects []string for _, field := range fields { @@ -432,7 +432,6 @@ func (r *resolution) Check(domain string) (Result, error) { r.trace("redirect, %q", field) return r.redirectField(field, domain) } else { - // http://www.openspf.org/SPF_Record_Syntax r.trace("permerror, unknown field") return PermError, ErrUnknownField }