Skip to content

Commit

Permalink
feat: Expose a way to set the dialer control property to allow bindin…
Browse files Browse the repository at this point in the history
…g a connection to an interface (#184)
  • Loading branch information
danielealbano authored Apr 7, 2024
1 parent d7f40ad commit 156e462
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions speedtest/speedtest.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"net/url"
"runtime"
"strings"
"syscall"
"time"
)

Expand Down Expand Up @@ -41,6 +42,7 @@ type UserConfig struct {
Proxy string
Source string
DnsBindSource bool
DialerControl func(network, address string, c syscall.RawConn) error
Debug bool
PingMode Proto

Expand Down Expand Up @@ -143,12 +145,14 @@ func (s *Speedtest) NewUserConfig(uc *UserConfig) {
LocalAddr: tcpSource,
Timeout: 30 * time.Second,
KeepAlive: 30 * time.Second,
Control: uc.DialerControl,
}

s.ipDialer = &net.Dialer{
LocalAddr: icmpSource,
Timeout: 30 * time.Second,
KeepAlive: 30 * time.Second,
Control: uc.DialerControl,
}

s.config.T = &http.Transport{
Expand Down

0 comments on commit 156e462

Please sign in to comment.