mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-07 23:00:55 +03:00
notifiers plugin: replace params with a struct
Fixes #658 Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
13
sdk/user.go
13
sdk/user.go
@@ -1,8 +1,6 @@
|
||||
package sdk
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
"strings"
|
||||
|
||||
"github.com/drakkan/sftpgo/v2/kms"
|
||||
@@ -139,17 +137,6 @@ type BandwidthLimit struct {
|
||||
DownloadBandwidth int64 `json:"download_bandwidth,omitempty"`
|
||||
}
|
||||
|
||||
// Validate returns an error if the bandwidth limit is not valid
|
||||
func (l *BandwidthLimit) Validate() error {
|
||||
for _, source := range l.Sources {
|
||||
_, _, err := net.ParseCIDR(source)
|
||||
if err != nil {
|
||||
return util.NewValidationError(fmt.Sprintf("could not parse bandwidth limit source %#v: %v", source, err))
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetSourcesAsString returns the sources as comma separated string
|
||||
func (l *BandwidthLimit) GetSourcesAsString() string {
|
||||
return strings.Join(l.Sources, ",")
|
||||
|
||||
Reference in New Issue
Block a user