Skip to content
Branch: master
Go to file

Latest commit


Failed to load latest commit information.
Latest commit message
Commit time


CircleCI Dependencies Status GitHub license

An unofficial client library for A Simple IP Address API.

Clojars Project


This library can worked on both Clojure/ClojureSript, you need following minimal version:

  • Clojure 1.8.0 ↑
  • ClojureScript 1.9.473 ↑

Usage (Clojure)

In Clojure, we use synchronize method to retrive data from

(ns ipify-test.core
  (:require [coldnew.ipify :as ipify]))

(defn -main []
  ;; default return edn data
  (println "Public ip (default):" (ipify/get-public-ip))    ; => {:ip ""}
  ;; You can specify the return type you want
  (println "Public ip (text):" (ipify/get-public-ip :text)) ; => ""
  (println "Public ip (json):" (ipify/get-public-ip :json)) ; => {\"ip\": \"\"}
  (println "Public ip (edn):"  (ipify/get-public-ip :edn))  ; => {:ip ""}

Usage (ClojureScript on Browser/Node.js)

ClojureScript use asynchronize method instead, it will return core.async channel. When a request has completed or failed it is put on that channel. You can take the response from that channel with the <! function within a go block.

(ns ipify-test.core
  (:require-macros [cljs.core.async.macros :refer [go]])
  (:require [coldnew.ipify :as ipify]
            [cljs.core.async :as async]))

  ;; return EDN format (default)
  (let [rsp (async/<! (ipify/get-public-ip))]
    (.log js/console "public ip (default): " rsp))  ; => {:ip ""}

  ;; return EDN format (edn)
  (let [rsp (async/<! (ipify/get-public-ip :edn))]
    (.log js/console "public ip (edn): " rsp))      ; => {:ip ""}
  ;; return TEXT format (text)
  (let [rsp (async/<! (ipify/get-public-ip :text))]
    (.log js/console "public ip (text): " rsp))     ; => ""

  ;; return JSON-string format (json)
  (let [rsp (async/<! (ipify/get-public-ip :json))]
    (.log js/console "public ip (json): " rsp))     ; => {\"ip\": \"\"}

Q & A

Q: Why I can't see return result on my browser ?

A: When use on browser, we use jsonp to fetch data. Please make sure your browser's adblock doesn't disable the jsonp call.


Copyright © 2017 Yen-Chin, Lee <>

Distributed under the MIT License.

You can’t perform that action at this time.