-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d56b88b
commit 240902f
Showing
790 changed files
with
121,344 additions
and
30,535 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,33 @@ | ||
module github.com/appit-online/redis-dumper | ||
|
||
go 1.17 | ||
go 1.21 | ||
|
||
require ( | ||
github.com/mediocregopher/radix/v4 v4.0.0 | ||
github.com/spf13/cobra v1.2.1 | ||
github.com/spf13/viper v1.9.0 | ||
github.com/redis/go-redis/v9 v9.3.0 | ||
github.com/spf13/cobra v1.8.0 | ||
github.com/spf13/viper v1.17.0 | ||
) | ||
|
||
require ( | ||
github.com/fsnotify/fsnotify v1.5.1 // indirect | ||
github.com/cespare/xxhash/v2 v2.2.0 // indirect | ||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect | ||
github.com/fsnotify/fsnotify v1.7.0 // indirect | ||
github.com/hashicorp/hcl v1.0.0 // indirect | ||
github.com/inconshreveable/mousetrap v1.0.0 // indirect | ||
github.com/magiconair/properties v1.8.5 // indirect | ||
github.com/mitchellh/mapstructure v1.4.3 // indirect | ||
github.com/pelletier/go-toml v1.9.4 // indirect | ||
github.com/spf13/afero v1.6.0 // indirect | ||
github.com/spf13/cast v1.4.1 // indirect | ||
github.com/spf13/jwalterweatherman v1.1.0 // indirect | ||
github.com/inconshreveable/mousetrap v1.1.0 // indirect | ||
github.com/magiconair/properties v1.8.7 // indirect | ||
github.com/mitchellh/mapstructure v1.5.0 // indirect | ||
github.com/pelletier/go-toml/v2 v2.1.0 // indirect | ||
github.com/sagikazarmark/locafero v0.3.0 // indirect | ||
github.com/sagikazarmark/slog-shim v0.1.0 // indirect | ||
github.com/sourcegraph/conc v0.3.0 // indirect | ||
github.com/spf13/afero v1.10.0 // indirect | ||
github.com/spf13/cast v1.5.1 // indirect | ||
github.com/spf13/pflag v1.0.5 // indirect | ||
github.com/subosito/gotenv v1.2.0 // indirect | ||
github.com/tilinna/clock v1.0.2 // indirect | ||
golang.org/x/sys v0.0.0-20211210111614-af8b64212486 // indirect | ||
golang.org/x/text v0.3.7 // indirect | ||
gopkg.in/ini.v1 v1.66.2 // indirect | ||
gopkg.in/yaml.v2 v2.4.0 // indirect | ||
github.com/subosito/gotenv v1.6.0 // indirect | ||
go.uber.org/multierr v1.11.0 // indirect | ||
golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect | ||
golang.org/x/sys v0.14.0 // indirect | ||
golang.org/x/text v0.14.0 // indirect | ||
gopkg.in/ini.v1 v1.67.0 // indirect | ||
gopkg.in/yaml.v3 v3.0.1 // indirect | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,33 @@ | ||
package agent | ||
|
||
import ( | ||
"context" | ||
"crypto/tls" | ||
"log" | ||
"net" | ||
|
||
"github.com/mediocregopher/radix/v4" | ||
"github.com/redis/go-redis/v9" | ||
) | ||
|
||
var pattern, sourcePassword, targetPassword string | ||
var scanCount, logInterval int | ||
var sourceUseTLS, targetUseTLS bool | ||
|
||
func createClient(ctx context.Context, password string, redisUrl string, enableTLS bool) radix.Client { | ||
scannerDialer := radix.Dialer{ | ||
AuthPass: password, | ||
} | ||
ctx = context.WithValue(ctx, "TLSEnabled", enableTLS) | ||
client, err := scannerDialer.Dial(ctx, "tcp", redisUrl) | ||
func createClient(redisAddr string, password string) *redis.Client { | ||
hostname, _, err := net.SplitHostPort(redisAddr) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
client := redis.NewClient(&redis.Options{ | ||
Addr: redisAddr, | ||
Password: password, | ||
ReadTimeout: 0, | ||
WriteTimeout: 0, | ||
PoolSize: 30, | ||
MinIdleConns: 30, | ||
TLSConfig: &tls.Config{ | ||
ServerName: hostname, | ||
}, | ||
}) | ||
|
||
return client | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.