LocalAddr returns a functional option which sets the local address an Attacker will use with its requests.
(addr net.IPAddr)
| 174 | // LocalAddr returns a functional option which sets the local address |
| 175 | // an Attacker will use with its requests. |
| 176 | func LocalAddr(addr net.IPAddr) func(*Attacker) { |
| 177 | return func(a *Attacker) { |
| 178 | tr := a.client.Transport.(*http.Transport) |
| 179 | a.dialer.LocalAddr = &net.TCPAddr{IP: addr.IP, Zone: addr.Zone} |
| 180 | tr.DialContext = a.dialer.DialContext |
| 181 | } |
| 182 | } |
| 183 | |
| 184 | // KeepAlive returns a functional option which toggles KeepAlive |
| 185 | // connections on the dialer and transport. |
no outgoing calls