Skip to content

Commit

Permalink
Remove unnecessary connections_per_host field (Issue #48)
Browse files Browse the repository at this point in the history
  • Loading branch information
crazy-max committed Mar 28, 2019
1 parent 6db97a4 commit 772fa23
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 20 deletions.
1 change: 0 additions & 1 deletion .res/config/ftpgrab-ftp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ server:
password:
sources:
- /
connections_per_host: 5
timeout: 5
disable_epsv: false
tls:
Expand Down
9 changes: 4 additions & 5 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,10 @@ func Load(fl model.Flags, version string) (*Configuration, error) {
Server: model.Server{
Type: model.ServerTypeFTP,
FTP: model.FTP{
Port: 21,
Sources: []string{},
ConnectionsPerHost: 5,
Timeout: 5,
DisableEPSV: false,
Port: 21,
Sources: []string{},
Timeout: 5,
DisableEPSV: false,
TLS: model.TLS{
Enable: false,
Implicit: true,
Expand Down
19 changes: 9 additions & 10 deletions internal/model/ftp.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@ package model

// FTP holds data necessary for FTP configuration
type FTP struct {
Host string `yaml:"host,omitempty"`
Port int `yaml:"port,omitempty"`
Username string `yaml:"username,omitempty"`
Password string `yaml:"password,omitempty"`
Sources []string `yaml:"sources,omitempty"`
ConnectionsPerHost int `yaml:"connections_per_host,omitempty"`
Timeout int `yaml:"timeout,omitempty"`
DisableEPSV bool `yaml:"disable_epsv,omitempty"`
TLS TLS `yaml:"tls,omitempty"`
LogTrace bool `yaml:"log_trace,omitempty"`
Host string `yaml:"host,omitempty"`
Port int `yaml:"port,omitempty"`
Username string `yaml:"username,omitempty"`
Password string `yaml:"password,omitempty"`
Sources []string `yaml:"sources,omitempty"`
Timeout int `yaml:"timeout,omitempty"`
DisableEPSV bool `yaml:"disable_epsv,omitempty"`
TLS TLS `yaml:"tls,omitempty"`
LogTrace bool `yaml:"log_trace,omitempty"`
}

// TLS holds data necessary for TLS FTP configuration
Expand Down
7 changes: 3 additions & 4 deletions internal/server/ftp/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,9 @@ func New(config *model.FTP) (*server.Client, error) {
}

if client.ftp, err = goftp.DialConfig(goftp.Config{
User: config.Username,
Password: config.Password,
ConnectionsPerHost: config.ConnectionsPerHost,
Timeout: time.Duration(config.Timeout) * time.Second,
User: config.Username,
Password: config.Password,
Timeout: time.Duration(config.Timeout) * time.Second,
Logger: &logging.GoftpWriter{
Enabled: config.LogTrace,
},
Expand Down

0 comments on commit 772fa23

Please sign in to comment.