Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow any network and related enhancements #18

Merged
merged 4 commits into from
Mar 14, 2021
Merged

Conversation

JonathonReinhart
Copy link
Collaborator

@JonathonReinhart JonathonReinhart commented Mar 13, 2021

This PR allows the allowed_nets config option to be an empty string which means "any network", without having to enter 0.0.0.0/0 ::/0.

It also re-works the way allowed_nets is parsed to make several improvements:

  • Consecutive spaces are ignored
  • Errors from invalid CIDR notations are now caught
  • It is parsed at startup instead of at runtime.

This PR is a result of discussions on #13 and is inspired by grafana#4.

Follows #15.

Copy link
Owner

@decke decke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

    peerIP = net.ParseIP(addr.IP.String())

can be simplified to just:

    peerIP = addr.IP

but we can also skip the safe cast since we know the net.Addr will always
be net.TCPAddr because we only have TCP listeners.
This has several benefits:
- Configuration errors are caught at startup rather than upon a connection
- connectionChecker() has less work to do for each connection
@JonathonReinhart
Copy link
Collaborator Author

Force-pushed to fix a merge conflict. Also made some superficial improvements in an error message and in smtprelay.ini.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants