|
|
|
@ -11,11 +11,11 @@ import (
|
|
|
|
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
func main() {
|
|
|
|
http.HandleFunc("/", IPHandle)
|
|
|
|
http.HandleFunc("/", IPHandle)
|
|
|
|
|
|
|
|
log.Println("server start!")
|
|
|
|
http.ListenAndServe(":8080", nil)
|
|
|
|
http.ListenAndServe(":8080", nil)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func IPHandle(w http.ResponseWriter, req *http.Request) {
|
|
|
|
func IPHandle(w http.ResponseWriter, req *http.Request) {
|
|
|
|
log.Println("server start!")
|
|
|
|
|
|
|
|
address := req.FormValue("address")
|
|
|
|
address := req.FormValue("address")
|
|
|
|
var ipInfo ip2region.IpInfo
|
|
|
|
var ipInfo ip2region.IpInfo
|
|
|
|
if address != "" {
|
|
|
|
if address != "" {
|
|
|
|
|