mirror of
https://github.com/restic/restic.git
synced 2025-12-04 01:11:56 +00:00
sftp: Limit concurrent backend operations
This commit is contained in:
@@ -15,6 +15,15 @@ type Config struct {
|
||||
|
||||
Layout string `option:"layout" help:"use this backend directory layout (default: auto-detect)"`
|
||||
Command string `option:"command" help:"specify command to create sftp connection"`
|
||||
|
||||
Connections uint `option:"connections" help:"set a limit for the number of concurrent connections (default: 5)"`
|
||||
}
|
||||
|
||||
// NewConfig returns a new config with default options applied.
|
||||
func NewConfig() Config {
|
||||
return Config{
|
||||
Connections: 5,
|
||||
}
|
||||
}
|
||||
|
||||
func init() {
|
||||
@@ -75,10 +84,11 @@ func ParseConfig(s string) (interface{}, error) {
|
||||
return nil, errors.Fatal("sftp path starts with the tilde (~) character, that fails for most sftp servers.\nUse a relative directory, most servers interpret this as relative to the user's home directory.")
|
||||
}
|
||||
|
||||
return Config{
|
||||
User: user,
|
||||
Host: host,
|
||||
Port: port,
|
||||
Path: p,
|
||||
}, nil
|
||||
cfg := NewConfig()
|
||||
cfg.User = user
|
||||
cfg.Host = host
|
||||
cfg.Port = port
|
||||
cfg.Path = p
|
||||
|
||||
return cfg, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user