https://github.com/mileusna/spf
Go package for SPF record check
https://github.com/mileusna/spf
go golang rfc-7208 sender-policy-framework spf spf-record
Last synced: about 1 month ago
JSON representation
Go package for SPF record check
- Host: GitHub
- URL: https://github.com/mileusna/spf
- Owner: mileusna
- License: mit
- Created: 2018-08-05T15:55:12.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2023-03-27T15:47:26.000Z (about 3 years ago)
- Last Synced: 2024-06-19T00:30:06.597Z (almost 2 years ago)
- Topics: go, golang, rfc-7208, sender-policy-framework, spf, spf-record
- Language: Go
- Homepage:
- Size: 17.6 KB
- Stars: 13
- Watchers: 3
- Forks: 9
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# SPF package for Go/GoLang
This package provides Sender Policy Framework (SPF) check for Go based on [RFC 7208](https://tools.ietf.org/html/rfc7208#section-4.6.3).
## TODO
Still have some issues to fix/add, like exp= modifier etc.
## Example
```go
package main
import (
"net"
"github.com/mileusna/spf"
)
func main() {
// optional, set DNS server which will be used by resolver.
// Default is Google's 8.8.8.8:53
spf.DNSServer = "1.1.1.1:53"
ip := net.ParseIP("123.123.123.123")
r := spf.CheckHost(ip, "domain.com", "name@domain.com", "");
// returns spf check result
// "PASS" / "FAIL" / "SOFTFAIL" / "NEUTRAL" / "NONE" / "TEMPERROR" / "PERMERROR"
// if you only need to retrive SPF record as string from DNS
spfRecord, _ := spf.LookupSPF("domain.com")
}
```