Country Detection
The country location of the IP address is determined automatically by the information provided by Internet Service Providers (ISPs). For example, you can look up the geographic information associated with an IP address by using sites such as What Is My IP and ipinfo.io.
The IP address, and its associated location information, is determined by the network that is currently connected to. Your IP address, and its associated location information, will change as you connect to different networks, such as VPNs, WiFi hotspots, home networks, cellular networks, corporate networks, and so on. The location information is determined by the Internet Service Provider (ISP) of the network you are connected to rather than your physical location. For example, if you are physically in San Francisco, California, but your network connection is through a VPN connection to your corporate office in Toronto, Canada, then your IP location will show as Canada instead of United States.
If in doubt, check your IP address information, using sites such as What Is My IP and ipinfo.io, from all of the network connections that you use.