Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mediamonks/node-spf-check
SPF validator
https://github.com/mediamonks/node-spf-check
dns nodejs spf
Last synced: about 2 months ago
JSON representation
SPF validator
- Host: GitHub
- URL: https://github.com/mediamonks/node-spf-check
- Owner: mediamonks
- License: mit
- Created: 2018-12-24T11:12:26.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2021-08-11T05:24:21.000Z (over 3 years ago)
- Last Synced: 2024-04-14T22:12:38.225Z (9 months ago)
- Topics: dns, nodejs, spf
- Language: JavaScript
- Homepage:
- Size: 135 KB
- Stars: 8
- Watchers: 8
- Forks: 9
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGES.md
- License: LICENSE
Awesome Lists containing this project
README
# ✉️ spf-check [![Build Status](https://travis-ci.org/mediamonks/node-spf-check.svg)](https://travis-ci.org/mediamonks/node-spf-check) [![Coverage Status](https://coveralls.io/repos/github/mediamonks/node-spf-check/badge.svg)](https://coveralls.io/github/mediamonks/node-spf-check)
[RFC4408]: https://tools.ietf.org/html/rfc4408
[RFC4408-2.5]: https://tools.ietf.org/html/rfc4408#section-2.5Implements [RFC4408] Sender Policy Framework (SPF) `check_host()` validation.
## Install
yarn add spf-check
## Usage
The stable API returns a string with one of the [possible returns][RFC4408-2.5].
```js
const spf = require('spf-check');
const result = spf(ip, domain, sender);if (result === spf.Pass) {
// Yay!
}
```## API
This module also exports `SPF` and `SPFResult` classes to allow inspect the
result and read the expected message.```js
const validator = new spf.SPF('mediamonks.com', '[email protected]');validator.check('185.16.22.2').then(result => {
assert(result instanceof spf.SPFResult);if (result.result !== spf.Pass || result.result !== spf.Neutral) {
console.error(result.message);
}
});
```## License
MIT © [MediaMonks](https://www.mediamonks.com/)