api_func_ip.go 558 B

1234567891011121314151617181920212223242526
  1. package route
  2. import (
  3. "opennamu/route/tool"
  4. jsoniter "github.com/json-iterator/go"
  5. )
  6. func Api_func_ip(call_arg []string) string {
  7. var json = jsoniter.ConfigCompatibleWithStandardLibrary
  8. other_set := map[string]string{}
  9. json.Unmarshal([]byte(call_arg[0]), &other_set)
  10. db := tool.DB_connect()
  11. defer db.Close()
  12. ip_data := tool.IP_parser(db, other_set["data"], other_set["ip"])
  13. new_data := make(map[string]interface{})
  14. new_data["response"] = "ok"
  15. new_data["data"] = ip_data
  16. json_data, _ := json.Marshal(new_data)
  17. return string(json_data)
  18. }