mirror of
https://github.com/octoleo/syncthing.git
synced 2025-01-22 22:58:25 +00:00
cmd/strelaysrv: Use listen address for outgoing HTTP requests (fixes #3682)
This commit is contained in:
parent
94e4370c7e
commit
bb23e3940e
@ -8,6 +8,7 @@ import (
|
||||
"fmt"
|
||||
"log"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"os/signal"
|
||||
@ -120,6 +121,21 @@ func main() {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
laddr, err := net.ResolveTCPAddr(proto, listen)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
if laddr.IP != nil && !laddr.IP.IsUnspecified() {
|
||||
laddr.Port = 0
|
||||
transport, ok := http.DefaultTransport.(*http.Transport)
|
||||
if ok {
|
||||
transport.DialContext = (&net.Dialer{
|
||||
Timeout: 30 * time.Second,
|
||||
LocalAddr: laddr,
|
||||
}).DialContext
|
||||
}
|
||||
}
|
||||
|
||||
log.Println(LongVersion)
|
||||
|
||||
maxDescriptors, err := osutil.MaximizeOpenFileLimit()
|
||||
|
Loading…
x
Reference in New Issue
Block a user