Make receiver hostname configurable via --receiver-hostname flag
Remove the package-level global hostname from parser.go. Adds a log warning when the last Received hop doesn't match the expected receiver hostname. Bug: https://github.com/happyDomain/happydeliver/issues/11
This commit is contained in:
parent
71e0832416
commit
76ee50a100
18 changed files with 53 additions and 40 deletions
|
|
@ -28,11 +28,13 @@ import (
|
|||
)
|
||||
|
||||
// AuthenticationAnalyzer analyzes email authentication results
|
||||
type AuthenticationAnalyzer struct{}
|
||||
type AuthenticationAnalyzer struct {
|
||||
receiverHostname string
|
||||
}
|
||||
|
||||
// NewAuthenticationAnalyzer creates a new authentication analyzer
|
||||
func NewAuthenticationAnalyzer() *AuthenticationAnalyzer {
|
||||
return &AuthenticationAnalyzer{}
|
||||
func NewAuthenticationAnalyzer(receiverHostname string) *AuthenticationAnalyzer {
|
||||
return &AuthenticationAnalyzer{receiverHostname: receiverHostname}
|
||||
}
|
||||
|
||||
// AnalyzeAuthentication extracts and analyzes authentication results from email headers
|
||||
|
|
@ -40,7 +42,7 @@ func (a *AuthenticationAnalyzer) AnalyzeAuthentication(email *EmailMessage) *api
|
|||
results := &api.AuthenticationResults{}
|
||||
|
||||
// Parse Authentication-Results headers
|
||||
authHeaders := email.GetAuthenticationResults()
|
||||
authHeaders := email.GetAuthenticationResults(a.receiverHostname)
|
||||
for _, header := range authHeaders {
|
||||
a.parseAuthenticationResultsHeader(header, results)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue