Junior — Middle
How can you determine the IP address of a web resource or site?
sobes.tech AI
Answer from AI
The IP address of a web resource can be determined using the ping or nslookup commands in the terminal, as well as with software tools.
Examples:
- In the terminal:
ping example.com
nslookup example.com
- In Go:
package main
import (
"fmt"
"net"
)
func main() {
ips, err := net.LookupIP("example.com")
if err != nil {
fmt.Println("Error:", err)
return
}
for _, ip := range ips {
fmt.Println("IP address:", ip.String())
}
}
Thus, you can obtain the IP addresses associated with a website's domain name.