fix(strelaysrv): properly use bind address for outgoing requests (fixes #10658) (#10659)

This was lost in #7217 a while back.

---------

Signed-off-by: Jakob Borg <jakob@kastelo.net>
This commit is contained in:
Jakob Borg
2026-04-24 15:18:18 +02:00
committed by GitHub
parent 97fb677887
commit 1a7825c7ec
2 changed files with 16 additions and 27 deletions
+14 -7
View File
@@ -71,9 +71,13 @@ var (
// httpClient is the HTTP client we use for outbound requests. It has a
// timeout and may get further options set during initialization.
var httpClient = &http.Client{
Timeout: 30 * time.Second,
}
var (
httpTransport = &http.Transport{}
httpClient = &http.Client{
Timeout: 30 * time.Second,
Transport: httpTransport,
}
)
func main() {
log.SetFlags(log.Lshortfile | log.LstdFlags)
@@ -132,9 +136,7 @@ func main() {
// also come from that address.
laddr.Port = 0
boundDialer := &net.Dialer{LocalAddr: laddr}
httpClient.Transport = &http.Transport{
DialContext: boundDialer.DialContext,
}
httpTransport.DialContext = boundDialer.DialContext
}
log.Println(longVer)
@@ -163,6 +165,11 @@ func main() {
}
}
// Outgoing HTTPS requests may use our certificate for authentication
httpTransport.TLSClientConfig = &tls.Config{
Certificates: []tls.Certificate{cert},
}
tlsCfg := &tls.Config{
Certificates: []tls.Certificate{cert},
NextProtos: []string{protocol.ProtocolName},
@@ -277,7 +284,7 @@ func main() {
for _, pool := range pools {
pool = strings.TrimSpace(pool)
if len(pool) > 0 {
go poolHandler(pool, uri, mapping, cert)
go poolHandler(pool, uri, mapping)
}
}