aws / aws-dax-go

AWS DAX SDK for the Go programming language. https://aws.amazon.com/dynamodb/dax
Apache License 2.0
47 stars 48 forks source link

Allow Users to Connect With a Custom Dialer. #13

Closed joshi4 closed 3 years ago

joshi4 commented 5 years ago

The Cluster Config Should expose an optional Custom Dialer.

Why ?

Our DAX cluster for local dev is not exposed to the public internet. We access it via a proxy running on our machines. All traffic is first directed to the local proxy via a custom dialer.

Currently, our integration tests don't work when run locally due to this issue.

The Updated Config would look like:

type Config struct {
    MaxPendingConnectionsPerHost int
    ClusterUpdateThreshold       time.Duration
    ClusterUpdateInterval        time.Duration
        // Connect is an optional function
    Connect                      func(ctx context.Context, network, addr string) (net.Conn, error)

    HostPorts   []string
    Region      string
    Credentials *credentials.Credentials
}

This would mean the Connect Func needs to propagated to where it is used in the tubepool files. 

Note while fixing this it would be great if we passed the context all the way down to the Dial Func.

cep21 commented 5 years ago

Looks helpful! I think it would involve changing https://github.com/aws/aws-dax-go/blob/0fcc214c2a2d153fda96c8cd5ba13c05b56ef0ad/dax/internal/client/tubepool.go#L33 to be passinable with tubePoolOptions and making func(string, string) (net.Conn, error) match the newer Go API of net.DialContext

VasilyFomin commented 4 years ago

Have you tried to configure the client with the proxy's address as the dax cluster address?