This approach is not very efficient, if used in the web, if used less can be used in this way, if used, or recommend the use of IP library
Copy Code code as follows:
#region # #得到真实IP以及所在地详细信息
Get real IP and location details
Today, I have nothing to do at home. I went online and read an article about finding a country based on the IP address. In fact, I used one for my work, but I don't know how to do it.
Next, I will share the translation
Convert the IP address to IP number and obtain the country
Today, I have nothing to do at home. I went online and read an article about finding a country based on the IP address. In fact, I used one for my work, but I don't know how to do it.
Next,
Implementation Method: capture IP addresses through regular expressions to display website data ....
Friendly reminder: This method is not highly efficient. If it is used in the Web, you can use this method if it is rarely used. If it is
This method is not efficient. If it is used in the WEB, you can use this method if it is rarely used. If it is commonly used, it is recommended to use the IP library.Copy codeThe Code is as follows:# Region # obtain the real IP address and location
Life goes on, go go go ...
Previously, there was a reference to the standard library provided by Golang: NET Package
Go Language Learning Net package (the path to go) brief aftertaste net package
func Parseip
Func Parseip (s string) IP
Parseip
One of our clients was attacked in Saturday, our network monitoring shows a 6 consecutive hours of huge abnormal traffic, we immediately contacted the customer, did not get a response, we modify and limit the customer's VPS, so that individual VPS
htAccess files (hypertext Access file) is a very powerful configuration file for Apache Web servers, and for this file, Apache has a bunch of parameters that allow you to configure almost any function you want.Use. htaccess block search engine
1.
CD geoip/
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
gzip-d GeoIP.dat.gz
ls
GeoLiteCity.dat
Other libraries: viewing
http://dev.maxmind.com/zh-hans/geoip/legacy/geolite/
2.
wget
Php obtains all the information (such as the address, postal code, country, and latitude and longitude) of the specified IP address. Php obtains all the information (such as address, zip code, country, and latitude and longitude) of a specified
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.