Skip to content

Commit ce0b41d

Browse files
authored
fix: force ipv4 connection
1 parent 72f046c commit ce0b41d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

internal/events/trigger/forward_event.go

+9
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ package trigger
44

55
import (
66
"bytes"
7+
"context"
78
"crypto/hmac"
89
"crypto/sha256"
910
"fmt"
11+
"net"
1012
"net/http"
1113
"time"
1214

@@ -78,6 +80,12 @@ func ForwardEvent(p ForwardParamters) (*http.Response, error) {
7880
}
7981
}
8082

83+
var dialer net.Dialer
84+
transport := http.DefaultTransport.(*http.Transport).Clone()
85+
transport.DialContext = func (ctx context.Context, network, addr string) (net.Conn, error) {
86+
return dialer.DialContext(ctx, "tcp4", addr)
87+
}
88+
8189
if p.Secret != "" {
8290
getSignatureHeader(req, p.ID, p.Secret, p.Transport, p.Timestamp, p.JSON)
8391
}
@@ -87,6 +95,7 @@ func ForwardEvent(p ForwardParamters) (*http.Response, error) {
8795
CheckRedirect: func(req *http.Request, via []*http.Request) error {
8896
return http.ErrUseLastResponse
8997
},
98+
Transport: transport,
9099
}
91100
resp, err := client.Do(req)
92101
if err != nil {

0 commit comments

Comments
 (0)