From 772fa238bbedcdff5733e6c84cf0bde36c30f762 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Fri, 29 Mar 2019 00:33:49 +0100 Subject: [PATCH] Remove unnecessary connections_per_host field (Issue #48) --- .res/config/ftpgrab-ftp.yml | 1 - internal/config/config.go | 9 ++++----- internal/model/ftp.go | 19 +++++++++---------- internal/server/ftp/client.go | 7 +++---- 4 files changed, 16 insertions(+), 20 deletions(-) diff --git a/.res/config/ftpgrab-ftp.yml b/.res/config/ftpgrab-ftp.yml index ae5f9a6e..b1c1c31e 100644 --- a/.res/config/ftpgrab-ftp.yml +++ b/.res/config/ftpgrab-ftp.yml @@ -7,7 +7,6 @@ server: password: sources: - / - connections_per_host: 5 timeout: 5 disable_epsv: false tls: diff --git a/internal/config/config.go b/internal/config/config.go index 406bd61c..7fde5e3e 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -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, diff --git a/internal/model/ftp.go b/internal/model/ftp.go index 835b9010..94ae01f9 100644 --- a/internal/model/ftp.go +++ b/internal/model/ftp.go @@ -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 diff --git a/internal/server/ftp/client.go b/internal/server/ftp/client.go index 0b74b2bd..bf045e88 100644 --- a/internal/server/ftp/client.go +++ b/internal/server/ftp/client.go @@ -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, },