func WithCompressors(fn func([]string) []string) ConnectionOption {
	return func(c *connectionConfig) error {
		c.compressors = fn(c.compressors)
		return nil
	}
}
WithCompressors sets the compressors that can be used for communication.
package topology
import (
	"context"
	"crypto/tls"
	"net"
	"time"
	"go.mongodb.org/mongo-driver/event"
	"go.mongodb.org/mongo-driver/x/mongo/driver"
	"go.mongodb.org/mongo-driver/x/mongo/driver/ocsp"
)
type Dialer interface {
	DialContext(ctx context.Context, network, address string) (net.Conn, error)
}
type DialerFunc func(ctx context.Context, network, address string) (net.Conn, error)
func (df DialerFunc) DialContext(ctx context.Context, network, address string) (net.Conn, error) {
	return df(ctx, network, address)
}
var DefaultDialer Dialer = &net.Dialer{}
type Handshaker = driver.Handshaker
type connectionConfig struct {
	appName                  string
	connectTimeout           time.Duration
	dialer                   Dialer
	handshaker               Handshaker
	idleTimeout              time.Duration
	cmdMonitor               *event.CommandMonitor
	poolMonitor              *event.PoolMonitor
	readTimeout              time.Duration
	writeTimeout             time.Duration
	tlsConfig                *tls.Config
	compressors              []string
	zlibLevel                *int
	zstdLevel                *int
	ocspCache                ocsp.Cache
	disableOCSPEndpointCheck bool
	errorHandlingCallback    func(error, uint64)
	tlsConnectionSource      tlsConnectionSource
}
func newConnectionConfig(opts ...ConnectionOption) (*connectionConfig, error) {
	cfg := &connectionConfig{
		connectTimeout:      30 * time.Second,
		dialer:              nil,
		tlsConnectionSource: defaultTLSConnectionSource,
	}
	for _, opt := range opts {
		err := opt(cfg)
		if err != nil {
			return nil, err
		}
	}
	if cfg.dialer == nil {
		cfg.dialer = &net.Dialer{}
	}
	return cfg, nil
}
type ConnectionOption func(*connectionConfig) error
func withTLSConnectionSource(fn func(tlsConnectionSource) tlsConnectionSource) ConnectionOption {
	return func(c *connectionConfig) error {
		c.tlsConnectionSource = fn(c.tlsConnectionSource)
		return nil
	}
}
func withErrorHandlingCallback(fn func(error, uint64)) ConnectionOption {
	return func(c *connectionConfig) error {
		c.errorHandlingCallback = fn
		return nil
	}
}