14 Commits

Author SHA1 Message Date
Jonas Kaninda
c39d828fe6 Merge pull request #18 from jkaninda/dependabot/go_modules/golang.org/x/crypto-0.38.0
All checks were successful
Go / build (push) Successful in 9m43s
Lint / Run on Ubuntu (push) Successful in 18m51s
build(deps): bump golang.org/x/crypto from 0.31.0 to 0.38.0
2025-05-16 21:23:07 +02:00
dependabot[bot]
b9d06c6529 build(deps): bump golang.org/x/crypto from 0.31.0 to 0.38.0
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.31.0 to 0.38.0.
- [Commits](https://github.com/golang/crypto/compare/v0.31.0...v0.38.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-version: 0.38.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-05-12 00:38:17 +00:00
Jonas Kaninda
373e8ada7a Merge pull request #16 from jkaninda/dependabot/go_modules/github.com/aws/aws-sdk-go-1.55.7
All checks were successful
Go / build (push) Successful in 9m39s
Lint / Run on Ubuntu (push) Successful in 18m35s
build(deps): bump github.com/aws/aws-sdk-go from 1.55.6 to 1.55.7
2025-04-28 21:17:10 +02:00
dependabot[bot]
da0fc37905 build(deps): bump github.com/aws/aws-sdk-go from 1.55.6 to 1.55.7
Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.55.6 to 1.55.7.
- [Release notes](https://github.com/aws/aws-sdk-go/releases)
- [Changelog](https://github.com/aws/aws-sdk-go/blob/main/CHANGELOG_PENDING.md)
- [Commits](https://github.com/aws/aws-sdk-go/compare/v1.55.6...v1.55.7)

---
updated-dependencies:
- dependency-name: github.com/aws/aws-sdk-go
  dependency-version: 1.55.7
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-28 00:34:35 +00:00
Jonas Kaninda
cd01e0007c Merge pull request #9 from jkaninda/dependabot/go_modules/github.com/aws/aws-sdk-go-1.55.6
All checks were successful
Go / build (push) Successful in 9m39s
Lint / Run on Ubuntu (push) Successful in 18m36s
build(deps): bump github.com/aws/aws-sdk-go from 1.55.5 to 1.55.6
2025-03-15 15:41:30 +01:00
dependabot[bot]
bcdcffed55 build(deps): bump github.com/aws/aws-sdk-go from 1.55.5 to 1.55.6
Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.55.5 to 1.55.6.
- [Release notes](https://github.com/aws/aws-sdk-go/releases)
- [Changelog](https://github.com/aws/aws-sdk-go/blob/main/CHANGELOG_PENDING.md)
- [Commits](https://github.com/aws/aws-sdk-go/compare/v1.55.5...v1.55.6)

---
updated-dependencies:
- dependency-name: github.com/aws/aws-sdk-go
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-20 00:36:00 +00:00
Jonas Kaninda
624c986a23 Merge pull request #5 from jkaninda/dependabot/go_modules/github.com/aws/aws-sdk-go-1.55.5
All checks were successful
Go / build (push) Successful in 9m50s
Lint / Run on Ubuntu (push) Successful in 18m33s
build(deps): bump github.com/aws/aws-sdk-go from 1.55.3 to 1.55.5
2024-12-28 07:12:44 +01:00
Jonas Kaninda
a06c6acdb8 Merge pull request #7 from jkaninda/dependabot/go_modules/golang.org/x/crypto-0.31.0
build(deps): bump golang.org/x/crypto from 0.28.0 to 0.31.0
2024-12-28 07:12:33 +01:00
dependabot[bot]
538df008f7 build(deps): bump golang.org/x/crypto from 0.28.0 to 0.31.0
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.28.0 to 0.31.0.
- [Commits](https://github.com/golang/crypto/compare/v0.28.0...v0.31.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-16 00:29:49 +00:00
dependabot[bot]
10e9be1f49 build(deps): bump github.com/aws/aws-sdk-go from 1.55.3 to 1.55.5
Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.55.3 to 1.55.5.
- [Release notes](https://github.com/aws/aws-sdk-go/releases)
- [Commits](https://github.com/aws/aws-sdk-go/compare/v1.55.3...v1.55.5)

---
updated-dependencies:
- dependency-name: github.com/aws/aws-sdk-go
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-09 00:36:50 +00:00
Jonas Kaninda
367de149f2 Merge pull request #4 from jkaninda/develop
Update readme
2024-12-07 19:47:26 +01:00
1e36fb1884 Update readme 2024-12-07 19:47:07 +01:00
Jonas Kaninda
da738264ab Merge pull request #3 from jkaninda/develop
Fix ssh Identity file
2024-12-07 19:45:54 +01:00
085bdf468f Fix ssh identityfile 2024-12-07 19:44:57 +01:00
7 changed files with 27 additions and 26 deletions

View File

@@ -56,7 +56,7 @@ if err != nil {
```go
sshStorage, err := ssh.NewStorage(ssh.Config{
Host: "",
Port: "",
Port: 22,
User: "",
Password: "",
RemotePath: "",
@@ -80,7 +80,7 @@ log.Fatalf("Error copying file, error %v", err)
```go
ftpStorage, err := ftp.NewStorage(ftp.Config{
Host: "",
Port: "",
Port: 21,
User: "",
Password: "",
RemotePath: "",

10
go.mod
View File

@@ -1,13 +1,13 @@
module github.com/jkaninda/go-storage
go 1.22.0
go 1.23.0
require (
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.5.0
github.com/aws/aws-sdk-go v1.55.3
github.com/aws/aws-sdk-go v1.55.7
github.com/bramvdbogaerde/go-scp v1.5.0
github.com/jlaffaye/ftp v0.2.0
golang.org/x/crypto v0.28.0
golang.org/x/crypto v0.38.0
)
require (
@@ -17,6 +17,6 @@ require (
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
golang.org/x/net v0.29.0 // indirect
golang.org/x/sys v0.26.0 // indirect
golang.org/x/text v0.19.0 // indirect
golang.org/x/sys v0.33.0 // indirect
golang.org/x/text v0.25.0 // indirect
)

20
go.sum
View File

@@ -10,8 +10,8 @@ github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.5.0 h1:mlmW46Q0B79I+Aj4a
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.5.0/go.mod h1:PXe2h+LKcWTX9afWdZoHyODqR4fBa5boUM/8uJfZ0Jo=
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU=
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI=
github.com/aws/aws-sdk-go v1.55.3 h1:0B5hOX+mIx7I5XPOrjrHlKSDQV/+ypFZpIHOx5LOk3E=
github.com/aws/aws-sdk-go v1.55.3/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU=
github.com/aws/aws-sdk-go v1.55.7 h1:UJrkFq7es5CShfBwlWAC8DA077vp8PyVbQd3lqLiztE=
github.com/aws/aws-sdk-go v1.55.7/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU=
github.com/bramvdbogaerde/go-scp v1.5.0 h1:a9BinAjTfQh273eh7vd3qUgmBC+bx+3TRDtkZWmIpzM=
github.com/bramvdbogaerde/go-scp v1.5.0/go.mod h1:on2aH5AxaFb2G0N5Vsdy6B0Ml7k9HuHSwfo1y0QzAbQ=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -41,16 +41,16 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw=
golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U=
golang.org/x/crypto v0.38.0 h1:jt+WWG8IZlBnVbomuhg2Mdq0+BBQaHbtqHEFEigjUV8=
golang.org/x/crypto v0.38.0/go.mod h1:MvrbAqul58NNYPKnOra203SB9vpuZW0e+RRZV+Ggqjw=
golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo=
golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0=
golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo=
golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24=
golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M=
golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM=
golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/term v0.32.0 h1:DR4lr0TjUs3epypdhTOkMmuF5CDFJ/8pOnbzMZPQ7bg=
golang.org/x/term v0.32.0/go.mod h1:uZG1FhGx848Sqfsq4/DlJr3xGGsYMu/L5GW4abiaEPQ=
golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4=
golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=

View File

@@ -44,14 +44,14 @@ type Config struct {
Host string
User string
Password string
Port string
Port int
LocalPath string
RemotePath string
}
// createClient creates FTP Client
func createClient(conf Config) (*ftp.ServerConn, error) {
ftpClient, err := ftp.Dial(fmt.Sprintf("%s:%s", conf.Host, conf.Port), ftp.DialWithTimeout(5*time.Second))
ftpClient, err := ftp.Dial(fmt.Sprintf("%s:%d", conf.Host, conf.Port), ftp.DialWithTimeout(5*time.Second))
if err != nil {
return nil, fmt.Errorf("failed to connect to FTP: %w", err)
}

View File

@@ -178,16 +178,16 @@ func (s s3Storage) Prune(retentionDays int) error {
Key: object.Key,
})
if err != nil {
fmt.Printf("failed to delete object %s: %v", *object.Key, err)
fmt.Printf("failed to delete object %s: %v\n", *object.Key, err)
} else {
fmt.Printf("Deleted object %s", *object.Key)
fmt.Printf("Deleted object %s\n", *object.Key)
}
}
}
return !lastPage
})
if err != nil {
return fmt.Errorf("failed to list objects: %v", err)
return fmt.Errorf("failed to list objects: %v\n", err)
}
return nil

View File

@@ -46,7 +46,7 @@ type Config struct {
Host string
User string
Password string
Port string
Port int
IdentifyFile string
LocalPath string
RemotePath string
@@ -54,15 +54,15 @@ type Config struct {
// createClient creates SSH Client
func createClient(conf Config) (scp.Client, error) {
if _, err := os.Stat(conf.IdentifyFile); os.IsNotExist(err) {
if _, err := os.Stat(conf.IdentifyFile); !os.IsNotExist(err) {
clientConfig, err := auth.PrivateKey(conf.User, conf.IdentifyFile, ssh.InsecureIgnoreHostKey())
return scp.NewClient(fmt.Sprintf("%s:%s", conf.Host, conf.Port), &clientConfig), err
return scp.NewClient(fmt.Sprintf("%s:%d", conf.Host, conf.Port), &clientConfig), err
} else {
if conf.Password == "" {
return scp.Client{}, errors.New("ssh password required")
}
clientConfig, err := auth.PasswordKey(conf.User, conf.Password, ssh.InsecureIgnoreHostKey())
return scp.NewClient(fmt.Sprintf("%s:%s", conf.Host, conf.Port), &clientConfig), err
return scp.NewClient(fmt.Sprintf("%s:%d", conf.Host, conf.Port), &clientConfig), err
}
}

1
pkg/ssh/ssh_test.go Normal file
View File

@@ -0,0 +1 @@
package ssh