Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example for interacting with remote file servers #1061

Closed
wants to merge 25 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
f9b6f1e
adding basic file interaction commands for ftp and sftp
RahulMohanK Sep 18, 2024
fa1a01e
adding readme for the example
RahulMohanK Sep 27, 2024
1de2f75
fixing lint issues
RahulMohanK Sep 28, 2024
4db8d92
Merge branch 'development' into files-interaction
RahulMohanK Sep 28, 2024
f20c54a
using logger to display logs in CMD
RahulMohanK Oct 4, 2024
728ca92
Merge branch 'development' into files-interaction
RahulMohanK Oct 4, 2024
0e2104f
initializing new module for files-interaction example
RahulMohanK Oct 5, 2024
eff4310
reverting go.sum
RahulMohanK Oct 5, 2024
eb55c61
Merge branch 'files-interaction' of github.com:RahulMohanK/gofr into …
RahulMohanK Oct 5, 2024
468ec01
Merge branch 'development' of github.com:RahulMohanK/gofr into files-…
RahulMohanK Oct 5, 2024
cc68a76
injecting logger into function and refactoring test
RahulMohanK Oct 9, 2024
00c7304
adding basic file interaction commands for ftp and sftp
RahulMohanK Sep 18, 2024
6f4622d
adding readme for the example
RahulMohanK Sep 27, 2024
0746677
fixing lint issues
RahulMohanK Sep 28, 2024
50258a7
using logger to display logs in CMD
RahulMohanK Oct 4, 2024
5daf5e1
initializing new module for files-interaction example
RahulMohanK Oct 5, 2024
9b6eac8
reverting go.sum
RahulMohanK Oct 5, 2024
6a0511d
injecting logger into function and refactoring test
RahulMohanK Oct 9, 2024
a1630f3
Merge branch 'files-interaction' of github.com:RahulMohanK/gofr into …
RahulMohanK Oct 13, 2024
b055d27
Merge branch 'gofr-dev:development' into files-interaction
RahulMohanK Oct 28, 2024
44d96e8
files interaction refactor
RahulMohanK Oct 28, 2024
38c1590
Merge branch 'files-interaction' of github.com:RahulMohanK/gofr into …
RahulMohanK Oct 28, 2024
1a7a540
refactor
RahulMohanK Oct 28, 2024
5c09cbb
Merge branch 'files-interaction-v2' into files-interaction
RahulMohanK Oct 28, 2024
da7c876
using handlers for subcommands
RahulMohanK Oct 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions examples/using-add-filestore/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Add FileStore Example

This GoFr example demonstrates a CMD application that can be used to interact with a remote file server using FTP or SFTP protocol

### Setting up an FTP server in local machine
- https://security.appspot.com/vsftpd.html
- https://pypi.org/project/pyftpdlib/

Choose a library listed above and follow their respective documentation to configure an FTP server in your local machine and replace the configs/env file with correct HOST,USER_NAME,PASSWORD,PORT and REMOTE_DIR_PATH details.

### To run the example use the commands below:
To print the current working directory of the configured remote file server
```console
go run main.go pwd
```
To get the list of all directories or files in the given path of the configured remote file server

```
go run main.go ls -path=/
```
To grep the list of all files and directories in the given path that is matching with the keyword provided

```
go run main.go grep -keyword=fi -path=/
```

To create a file in the current working directory with the provided filename
```
go run main.go createfile -filename=file.txt
```

To remove the file with the provided filename from the current working directory
```
go run main.go rm -filename=file.txt
```
5 changes: 5 additions & 0 deletions examples/using-add-filestore/configs/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
HOST=localhost
USER_NAME=anonymous
PASSWORD=test
PORT=21
REMOTE_DIR_PATH=/
104 changes: 104 additions & 0 deletions examples/using-add-filestore/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
module gofr.dev/examples/using-add-filestore

go 1.22

require gofr.dev v1.22.1

require (
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/jlaffaye/ftp v0.2.0 // indirect
)

require (
cloud.google.com/go v0.115.1 // indirect
cloud.google.com/go/auth v0.9.5 // indirect
cloud.google.com/go/auth/oauth2adapt v0.2.4 // indirect
cloud.google.com/go/compute/metadata v0.5.2 // indirect
cloud.google.com/go/iam v1.2.0 // indirect
cloud.google.com/go/pubsub v1.42.0 // indirect
filippo.io/edwards25519 v1.1.0 // indirect
github.com/DATA-DOG/go-sqlmock v1.5.2 // indirect
github.com/XSAM/otelsql v0.34.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/eclipse/paho.mqtt.golang v1.5.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-sql-driver/mysql v1.8.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt/v5 v5.2.1 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/google/s2a-go v0.1.8 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.4 // indirect
github.com/googleapis/gax-go/v2 v2.13.0 // indirect
github.com/gorilla/mux v1.8.1 // indirect
github.com/gorilla/websocket v1.5.3 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
github.com/joho/godotenv v1.5.1 // indirect
github.com/klauspost/compress v1.17.9 // indirect
github.com/lib/pq v1.10.9 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/ncruces/go-strftime v0.1.9 // indirect
github.com/openzipkin/zipkin-go v0.4.3 // indirect
github.com/pierrec/lz4/v4 v4.1.21 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.20.4 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.59.1 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/redis/go-redis/extra/rediscmd/v9 v9.0.5 // indirect
github.com/redis/go-redis/extra/redisotel/v9 v9.0.5 // indirect
github.com/redis/go-redis/v9 v9.6.1 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
github.com/segmentio/kafka-go v0.4.47 // indirect
github.com/stretchr/testify v1.9.0
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.54.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.55.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.55.0 // indirect
go.opentelemetry.io/otel v1.30.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.30.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.30.0 // indirect
go.opentelemetry.io/otel/exporters/prometheus v0.52.0 // indirect
go.opentelemetry.io/otel/exporters/zipkin v1.30.0 // indirect
go.opentelemetry.io/otel/metric v1.30.0 // indirect
go.opentelemetry.io/otel/sdk v1.30.0 // indirect
go.opentelemetry.io/otel/sdk/metric v1.30.0 // indirect
go.opentelemetry.io/otel/trace v1.30.0 // indirect
go.opentelemetry.io/proto/otlp v1.3.1 // indirect
go.uber.org/mock v0.4.0
gofr.dev/pkg/gofr/datasource/file/ftp v0.1.0
golang.org/x/crypto v0.27.0 // indirect
golang.org/x/net v0.29.0 // indirect
golang.org/x/oauth2 v0.23.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/sys v0.25.0 // indirect
golang.org/x/term v0.24.0 // indirect
golang.org/x/text v0.18.0 // indirect
golang.org/x/time v0.6.0 // indirect
google.golang.org/api v0.199.0 // indirect
google.golang.org/genproto v0.0.0-20240903143218-8af14fe29dc1 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect
google.golang.org/grpc v1.67.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
modernc.org/gc/v3 v3.0.0-20240107210532-573471604cb6 // indirect
modernc.org/libc v1.55.3 // indirect
modernc.org/mathutil v1.6.0 // indirect
modernc.org/memory v1.8.0 // indirect
modernc.org/sqlite v1.33.1 // indirect
modernc.org/strutil v1.2.0 // indirect
modernc.org/token v1.1.0 // indirect
)
Loading
Loading