TLS
Valkey GLIDE supports secure TLS connections to a data store.
It’s important to note that TLS support in Valkey GLIDE relies on rustls. Currently, Valkey GLIDE employs the default rustls settings with no option for customization.
Example: Connecting with TLS Mode Enabled to a Cluster
Section titled “Example: Connecting with TLS Mode Enabled to a Cluster”import ( glide "github.com/valkey-io/valkey-glide/go/v2" "github.com/valkey-io/valkey-glide/go/v2/config")
func ConnectClusterWithTLS() { myConfig := config.NewClusterClientConfiguration(). WithAddress(&config.NodeAddress{Host: "address.example.com", Port: 6379}). WithUseTLS(true)
client, err := glide.NewClusterClient(myConfig)}Example: Connecting with TLS Mode Enabled to a Standalone server
Section titled “Example: Connecting with TLS Mode Enabled to a Standalone server”import ( glide "github.com/valkey-io/valkey-glide/go/v2" "github.com/valkey-io/valkey-glide/go/v2/config")
func ConnectStandaloneWithTLS() { myConfig := config.NewClientConfiguration(). WithAddress(&config.NodeAddress{Host: "primary.example.com", Port: 6379}). WithUseTLS(true)
client, err := glide.NewClient(myConfig)}