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
+2 -20
View File
@@ -4,7 +4,6 @@ package main
import (
"bytes"
"crypto/tls"
"encoding/json"
"io"
"log"
@@ -17,7 +16,7 @@ const (
httpStatusEnhanceYourCalm = 429
)
func poolHandler(pool string, uri *url.URL, mapping mapping, ownCert tls.Certificate) {
func poolHandler(pool string, uri *url.URL, mapping mapping) {
if debug {
log.Println("Joining", pool)
}
@@ -32,24 +31,7 @@ func poolHandler(pool string, uri *url.URL, mapping mapping, ownCert tls.Certifi
uriCopy.String(),
})
poolUrl, err := url.Parse(pool)
if err != nil {
log.Printf("Could not parse pool url '%s': %v", pool, err)
}
client := http.DefaultClient
if poolUrl.Scheme == "https" {
// Sent our certificate in join request
client = &http.Client{
Transport: &http.Transport{
TLSClientConfig: &tls.Config{
Certificates: []tls.Certificate{ownCert},
},
},
}
}
resp, err := client.Post(pool, "application/json", &b)
resp, err := httpClient.Post(pool, "application/json", &b) //nolint:noctx
if err != nil {
log.Printf("Error joining pool %v: HTTP request: %v", pool, err)
time.Sleep(time.Minute)