Skip to content

Commit ba0e22e

Browse files
committed
Add --tls flags
1 parent 77c96f9 commit ba0e22e

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

redis-bechmark-go.go

+15-4
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,9 @@ package main
22

33
import (
44
"context"
5+
tls "crypto/tls"
56
"flag"
67
"fmt"
7-
hdrhistogram "github.com/HdrHistogram/hdrhistogram-go"
8-
radix "github.com/mediocregopher/radix/v4"
9-
"github.com/redis/rueidis"
10-
"golang.org/x/time/rate"
118
"log"
129
"math/rand"
1310
"net"
@@ -16,6 +13,11 @@ import (
1613
"strings"
1714
"sync"
1815
"time"
16+
17+
hdrhistogram "github.com/HdrHistogram/hdrhistogram-go"
18+
radix "github.com/mediocregopher/radix/v4"
19+
"github.com/redis/rueidis"
20+
"golang.org/x/time/rate"
1921
)
2022

2123
func benchmarkRoutine(radixClient Client, ruedisClient rueidis.Client, useRuedis, useCSC, enableMultiExec bool, datapointsChan chan datapoint, continueOnError bool, cmdS [][]string, commandsCDF []float32, keyspacelen, datasize, number_samples uint64, loop bool, debug_level int, wg *sync.WaitGroup, keyplace, dataplace []int, readOnly []bool, useLimiter bool, rateLimiter *rate.Limiter, waitReplicas, waitReplicasMs int, cacheOptions *rueidis.CacheOptions) {
@@ -182,6 +184,7 @@ func main() {
182184
rpsburst := flag.Int64("rps-burst", 0, "Max rps burst. If 0 the allowed burst will be the ammount of clients.")
183185
username := flag.String("u", "", "Username for Redis Auth.")
184186
password := flag.String("a", "", "Password for Redis Auth.")
187+
enableTls := flag.Bool("tls", false, "Use TLS connection.")
185188
jsonOutFile := flag.String("json-out-file", "", "Results file. If empty will not save.")
186189
seed := flag.Int64("random-seed", 12345, "random seed to be used.")
187190
clients := flag.Uint64("c", 50, "number of clients.")
@@ -288,6 +291,14 @@ func main() {
288291
opts.Protocol = "3"
289292
alwaysRESP2 = false
290293
}
294+
if *enableTls {
295+
opts.NetDialer = &tls.Dialer{
296+
NetDialer: nil,
297+
Config: &tls.Config{
298+
ServerName: *host,
299+
},
300+
}
301+
}
291302

292303
ips := make([]net.IP, 0)
293304
if *nameserver != "" {

0 commit comments

Comments
 (0)