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

Implement Rate Limit per remote #155

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

webfrank
Copy link

I've added a rate limiter per remote configuration with an optional url parameter.
I've also added a Dockerfile to build a container image.

@@ -0,0 +1,22 @@
FROM golang:1.22-alpine AS build
Copy link
Owner

Choose a reason for hiding this comment

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

Please respect #50 #54

@@ -10,12 +10,16 @@ require (
)

require (
github.com/Hepri/rate_limiter v0.0.0-20170628005159-cf154f46b333 // indirect
Copy link
Owner

Choose a reason for hiding this comment

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

hm where is that dependency coming from?

@@ -195,7 +195,7 @@ func mailHandler(peer smtpd.Peer, env smtpd.Envelope) error {
environ = append(environ, fmt.Sprintf("%s=%s", "SMTPRELAY_PEER", peerIP))

cmd := exec.Cmd{
Env: environ,
Env: environ,
Copy link
Owner

Choose a reason for hiding this comment

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

whitespace change?

@@ -321,6 +324,13 @@ var testHookStartTLS func(*tls.Config) // nil, except for tests
// functionality. Higher-level packages exist outside of the standard
// library.
func SendMail(r *Remote, from string, to []string, msg []byte) error {
if r.RateLimiter != nil {
Copy link
Owner

Choose a reason for hiding this comment

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

This is a copy from upstream Golang net/smtp and touching it should be avoided if possible.

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.

2 participants