firstIP returns the first IP address from the DNS response.
(resp *dns.Msg)
| 176 | |
| 177 | // firstIP returns the first IP address from the DNS response. |
| 178 | func firstIP(resp *dns.Msg) (ip net.IP) { |
| 179 | for _, ans := range resp.Answer { |
| 180 | a, ok := ans.(*dns.A) |
| 181 | if !ok { |
| 182 | continue |
| 183 | } |
| 184 | |
| 185 | return a.A |
| 186 | } |
| 187 | |
| 188 | return nil |
| 189 | } |
| 190 | |
| 191 | type testUpstream struct { |
| 192 | ans []dns.RR |
no outgoing calls
no test coverage detected
searching dependent graphs…