Skip to content

Commit

Permalink
feat: added HarakaMx
Browse files Browse the repository at this point in the history
- change: get_mx: don't filter implicit MX errors
  • Loading branch information
msimerson committed Apr 30, 2024
1 parent a51f99e commit f13eece
Show file tree
Hide file tree
Showing 5 changed files with 442 additions and 81 deletions.
65 changes: 36 additions & 29 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,16 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).

### Unreleased

### [1.7.0] - 2024-04-29

- feat: added HarakaMx
- change: get_mx: don't filter implicit MX errors
- fix(get_public_ip): set timeout in stun request, fixes #84

### [1.6.0] - 2024-04-17

- feat: normalizeDomain, for punycode/IDN names
- feat: get_mx now _also_ returns implicit MX records
- feat: get*mx now \_also* returns implicit MX records
- feat: added get_implicit_mx
- feat: added resolve_mx_hosts
- doc(Changes): fixed broken tag version links
Expand Down Expand Up @@ -62,88 +68,88 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
- chore(ci): populate test matrix with Node.js LTS versions
- chore(ci): limit dependabot updates to production deps

#### [1.3.5] - 2022-05-27
### [1.3.5] - 2022-05-27

- chore(ci): use shared GHA workflows
- style(es6): use dns.promises internally
- dep(async): replace async dependency with Promise.all
- doc(README): use code fences around examples (vs indention)

#### [1.3.4] - 2022-01-05
### [1.3.4] - 2022-01-05

- promisify get_ips_by_host (backwards compatible)

#### [1.3.3] - 2020-01-05
### [1.3.3] - 2020-01-05

- refactored is_local_host function to return a promise instead of using a callback #65

#### [1.3.2] - 2021-12-20
### [1.3.2] - 2021-12-20

- add is_local_host function #63

#### [1.3.1] - 2021-10-13
### [1.3.1] - 2021-10-13

- get_mx: wrap dns.resolveMx in a try haraka/Haraka#2985
- add .release scripts
- add GH workflow, publish release to NPM upon merge to master

#### 1.3.0 - 2021-01-23
### 1.3.0 - 2021-01-23

- Support passing an array to ip_in_list #60

#### 1.2.4 - 2021-01-14
### 1.2.4 - 2021-01-14

- add "any" IP to is_local_ip
- add TEST-NET-[1-3] to is_private_ip

#### 1.2.3 - 2020-12-19
### 1.2.3 - 2020-12-19

- fix: restore the tests wrapping the resolveMX iterable

#### 1.2.2 - 2020-12-15
### 1.2.2 - 2020-12-15

- get_mx: do not include implicit MX

#### [1.2.1] - 2020-11-17
### [1.2.1] - 2020-11-17

- bump ipaddr.js to 2.0.0 #56

#### [1.2.0] - 2020-06-23
### [1.2.0] - 2020-06-23

- added get_mx
- remove deprecated load_tls_ini
- remove deprecated tls_ini_section_with_defaults

#### 1.1.5 - 2020-04-11
### 1.1.5 - 2020-04-11

- ipv6_bogus: handle parsing broken ipv6 addresses #49
- update async to version 3.0.1 #43

#### 1.1.4 - 2019-04-04
### 1.1.4 - 2019-04-04

- stop is_private_ip from checking if the IP is bound to a local network interface

#### 1.1.3 - 2019-03-01
### 1.1.3 - 2019-03-01

- is_local_ip checks local network interfaces too

#### 1.1.2 - 2018-11-03
### 1.1.2 - 2018-11-03

- add is_local_ip

#### 1.1.1 - 2018-07-19
### 1.1.1 - 2018-07-19

- ip_in_list doesn't throw on empty list

#### 1.1.0 - 2018-04-11
### 1.1.0 - 2018-04-11

- add get_primary_host_name haraka/Haraka#2380

#### 1.0.14 - 2018-01-25
### 1.0.14 - 2018-01-25

- restore tls_ini_section_with_defaults function (deprecated since Haraka 2.0.17)

#### 1.0.13 - 2018-01-19
### 1.0.13 - 2018-01-19

- get_public_ip: assign timer before calling connect #29
- avoid race where timeout isn't cleared because stun connect errors immediately
Expand All @@ -152,40 +158,40 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
- eslint updates #25, #27
- improved x509 parser #22

#### 1.0.10 - 2017-07-27
### 1.0.10 - 2017-07-27

- added vs-stun as optional dep (from Haraka) #21

#### 1.0.9 - 2017-06-16
### 1.0.9 - 2017-06-16

- lint fixes for compat with eslint 4 #18

#### 1.0.8 - 2017-03-08
### 1.0.8 - 2017-03-08

- skip loading expired x509 (TLS) certs
- make TLS cert dir configurable
- rename certs -> cert (be consistent with haraka/plugins/tls)
- store cert/key as buffers (was strings)

#### 1.0.7 - 2017-03-08
### 1.0.7 - 2017-03-08

- handle undefined tls.ini section

#### 1.0.6 - 2017-03-04
### 1.0.6 - 2017-03-04

- add tls_ini_section_with_defaults()
- add load_tls_dir()
- add parse_x509_names()

#### 1.0.5 - 2016-11-20
### 1.0.5 - 2016-11-20

- add enableSNI TLS option

#### 1.0.4 - 2016-10-25
### 1.0.4 - 2016-10-25

- initialize TLS opts in (section != main) as booleans

#### 1.0.3 - 2016-10-25
### 1.0.3 - 2016-10-25

- added tls.ini loading

Expand All @@ -197,7 +203,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
[1.3.4]: https://github.com/haraka/haraka-net-utils/releases/tag/1.3.4
[1.3.5]: https://github.com/haraka/haraka-net-utils/releases/tag/1.3.5
[1.3.6]: https://github.com/haraka/haraka-net-utils/releases/tag/1.3.6
[1.3.7]: https://github.com/haraka/haraka-net-utils/releases/tag/v1.3.7
[1.3.7]: https://github.com/haraka/haraka-net-utils/releases/tag/1.3.7
[1.4.0]: https://github.com/haraka/haraka-net-utils/releases/tag/v1.4.0
[1.4.1]: https://github.com/haraka/haraka-net-utils/releases/tag/v1.4.1
[1.5.0]: https://github.com/haraka/haraka-net-utils/releases/tag/v1.5.0
Expand All @@ -206,3 +212,4 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
[1.5.3]: https://github.com/haraka/haraka-net-utils/releases/tag/v1.5.3
[1.5.4]: https://github.com/haraka/haraka-net-utils/releases/tag/v1.5.4
[1.6.0]: https://github.com/haraka/haraka-net-utils/releases/tag/v1.6.0
[1.7.0]: https://github.com/haraka/haraka-net-utils/releases/tag/v1.7.0
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,49 @@ try {
}
```

### HarakaMx

An object class representing a MX. HarakaMx objects may contain the following properties:

```js
{
exchange: '', // required: a FQDN or IP address
priority: 0, // integer, a MX priority.
port: 25, // integer: an alternate port
bind: '', // an outbound IP address to bind to
bind_helo: '', // an outbound helo hostname
using_lmtp: false, // boolean, specify LMTP delivery
auth_user: '', // an AUTH username (required if AUTH is desired)
auth_pass: '', // an AUTH password (required if AUTH is desired)
auth_type: '', // an AUTH type that should be used with the MX.
from_dns: '', // the DNS name from which the MX was queried
}
```

Create a HarakaMx object in The Usual Way:

```js
const nu = require('haraka-net-utils')
const myMx = new nu.HarakaMx(parameter)
```

The parameter can be one of:

- A string in any of the following formats:
- hostname
- hostname:port
- IPv4
- IPv4:port
- [IPv6]
- [IPv6]:port
- A [URL](https://nodejs.org/docs/latest-v20.x/api/url.html) string
- smtp://mail.example.com:25
- lmtp://int-mail.example.com:24
- smtp://user:pass@host.example.com:587
- An object, containing at least an exchange, and any of the other properties listed at the top of this section.

An optional second parameter is an alias for from_dns.

[ci-img]: https://github.com/haraka/haraka-net-utils/actions/workflows/ci.yml/badge.svg
[ci-url]: https://github.com/haraka/haraka-net-utils/actions/workflows/ci.yml
[cov-img]: https://codecov.io/github/haraka/haraka-net-utils/coverage.svg
Expand Down
Loading

0 comments on commit f13eece

Please sign in to comment.