func ExitOnConnectionLoss() func() bool {
	return func() bool {
		terminationMsg := "Lost connection to CSI driver, exiting"
		if err := ioutil.WriteFile(terminationLogPath, []byte(terminationMsg), 0644); err != nil {
			klog.Errorf("%s: %s", terminationLogPath, err)
		}
		klog.Exit(terminationMsg)
		return false
	}
}
ExitOnConnectionLoss returns callback for OnConnectionLoss() that writes
an error to /dev/termination-log and exits.
package connection
import (
	"context"
	"errors"
	"io/ioutil"
	"net"
	"strings"
	"time"
	"github.com/kubernetes-csi/csi-lib-utils/metrics"
	"github.com/kubernetes-csi/csi-lib-utils/protosanitizer"
	"google.golang.org/grpc"
	"k8s.io/klog/v2"
)
const (
	connectionLoggingInterval = 10 * time.Second
	probeInterval = 1 * time.Second
)
const terminationLogPath = "/dev/termination-log"
func Connect(address string, metricsManager metrics.CSIMetricsManager, options ...Option) (*grpc.ClientConn, error) {
	return connect(address, metricsManager, []grpc.DialOption{}, options)
}
type Option func(o *options)
func OnConnectionLoss(reconnect func() bool) Option {
	return func(o *options) {
		o.reconnect = reconnect
	}
}