* feat: add configurable SMTP HELO hostname Allow the SMTP HELO/EHLO hostname to be configured separately from the SMTP server hostname. This is useful when the SMTP server requires clients to identify themselves with a fully qualified hostname different from the server address. * chore: remove vendored dependency changes * Bump go-pkgz/notify to v1.4.0 and document SMTP_HELO_HOST The HELOHost field lands in go-pkgz/notify v1.4.0, so the branch needs the bump to compile; v1.3.0 in master has no such field. The example module is tidied alongside, as any change to backend/go.mod requires. Documents the parameter in the parameters table and, separately, in the email setup page: what it does, that leaving it unset keeps the previous `localhost` greeting, and the case it exists for, a relay refusing the greeting under Postfix `reject_non_fqdn_helo_hostname`. Also records the current limit: verification emails for email authentication go through go-pkgz/auth's own sender, which has no equivalent setting, so the greeting there is unchanged. * Bump go-pkgz/auth to v2.2.0 and apply SMTP_HELO_HOST to verification email The verification email sender had no way to set the greeting, so a relay that refuses the HELO would accept notifications and still reject sign-in emails. EmailParams gains HELOHost in go-pkgz/auth v2.2.0, so the same SMTP_HELO_HOST now drives both paths. The example module is tidied alongside, as any change to backend/go.mod requires. --------- Co-authored-by: oli <someone@somewhere.tld> Co-authored-by: Dmitry Verkhoturov <paskal.07@gmail.com>
77 lines
1.6 KiB
Go
77 lines
1.6 KiB
Go
package stats
|
|
|
|
// CumulativeProduct calculates the cumulative product of the input slice
|
|
func CumulativeProduct(input Float64Data) ([]float64, error) {
|
|
|
|
if input.Len() == 0 {
|
|
return Float64Data{}, ErrEmptyInput
|
|
}
|
|
|
|
cumProduct := make([]float64, input.Len())
|
|
|
|
for i, val := range input {
|
|
if i == 0 {
|
|
cumProduct[i] = val
|
|
} else {
|
|
cumProduct[i] = cumProduct[i-1] * val
|
|
}
|
|
}
|
|
|
|
return cumProduct, nil
|
|
}
|
|
|
|
// CumulativeMax calculates the cumulative maximum of the input slice
|
|
func CumulativeMax(input Float64Data) ([]float64, error) {
|
|
|
|
if input.Len() == 0 {
|
|
return Float64Data{}, ErrEmptyInput
|
|
}
|
|
|
|
cumMax := make([]float64, input.Len())
|
|
|
|
for i, val := range input {
|
|
if i == 0 || val > cumMax[i-1] {
|
|
cumMax[i] = val
|
|
} else {
|
|
cumMax[i] = cumMax[i-1]
|
|
}
|
|
}
|
|
|
|
return cumMax, nil
|
|
}
|
|
|
|
// CumulativeMin calculates the cumulative minimum of the input slice
|
|
func CumulativeMin(input Float64Data) ([]float64, error) {
|
|
|
|
if input.Len() == 0 {
|
|
return Float64Data{}, ErrEmptyInput
|
|
}
|
|
|
|
cumMin := make([]float64, input.Len())
|
|
|
|
for i, val := range input {
|
|
if i == 0 || val < cumMin[i-1] {
|
|
cumMin[i] = val
|
|
} else {
|
|
cumMin[i] = cumMin[i-1]
|
|
}
|
|
}
|
|
|
|
return cumMin, nil
|
|
}
|
|
|
|
// CumulativeProduct calculates the cumulative product of the data
|
|
func (f Float64Data) CumulativeProduct() ([]float64, error) {
|
|
return CumulativeProduct(f)
|
|
}
|
|
|
|
// CumulativeMax calculates the cumulative maximum of the data
|
|
func (f Float64Data) CumulativeMax() ([]float64, error) {
|
|
return CumulativeMax(f)
|
|
}
|
|
|
|
// CumulativeMin calculates the cumulative minimum of the data
|
|
func (f Float64Data) CumulativeMin() ([]float64, error) {
|
|
return CumulativeMin(f)
|
|
}
|