Skip to content

Commit

Permalink
feat: set explicit dialer for custom kafka transport
Browse files Browse the repository at this point in the history
  • Loading branch information
aldy505 committed Dec 15, 2024
1 parent 3b7843e commit ab23c00
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cmd/vroom/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ import (
"crypto/tls"
"crypto/x509"
"log"
"net"
"os"
"strings"
"time"

"github.com/segmentio/kafka-go"
"github.com/segmentio/kafka-go/sasl"
Expand Down Expand Up @@ -81,5 +83,9 @@ func createKafkaRoundTripper(e ServiceConfig) kafka.RoundTripper {
return &kafka.Transport{
SASL: saslMechanism,
TLS: tlsConfig,
Dial: (&net.Dialer{
Timeout: 3 * time.Second,
DualStack: true,
}).DialContext,
}
}
}

0 comments on commit ab23c00

Please sign in to comment.