Code Monkey home page Code Monkey logo

geojs's Introduction

Hi there πŸ‘‹

I'm a Infrastructure Engineer at Ghost helping build their hosting platform Ghost(Pro) πŸ‘»

I built GeoJS a geo-location 🌏 lookup API serving 120 million requests daily πŸš€

You can find my blog over here and I'm also on Twitter πŸ¦‰ and Mastodon 🐘

geojs's People

Contributors

jloh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

geojs's Issues

Slack endpoint tests for help command

At the moment there aren't any tests for the /geojs help command

geojs/conf/v1/hooks.conf

Lines 175 to 182 in 431b163

-- If people are just asking for help just reply with that
if slack_req == "help" then
resp_text = "Having some trouble? The GeoJS slack app can be used like so `/geojs 8.8.8.8`. Give it a try!\nIf you continue to have trouble reach out to us at [email protected]"
message = {
text = resp_text
}
ngx.say(json_encode(message))
else

Compare tables for tests

Could be a nicer way of doing tests? As opposed to doing all the string magic write a function that ensures two tables match and check that way.

Slack endpoint needs fallback text

The slack endpoint currently doesn't have any fallback text. This is very poor form and goes against their standards!

geojs/conf/v1/hooks.conf

Lines 255 to 268 in c7e8c5b

message = {
response_type = slack_response_type,
attachments = {{
mrkdwn_in = {
"text",
"pretext"
},
fallback = "", -- TODO: Actually put something here good lord
pretext = title,
text = resp,
footer = "Powered by <https://geojs.io|GeoJS>",
footer_icon = "https://static.jloh.co/geojs/avatar/hipchat/v1/geojs-icon_2x.png"
}}
}

Finish Geo Unit Tests

Finish off unit tests for Geo endpoint

This is going to be a bit difficult since the JSON that gets returned can change the order its in for some reason which is breaking string comparisons.

get.geojs.io throws 500 for certain source ip's

Hello,

Someone was complaining about a network I maintain, and said that my network is bad. However we found the application was depending on the following:

root@obproxy:~# wget -SHO - https://get.geojs.io/v1/ip/geo.json
--2023-01-08 15:59:37--  https://get.geojs.io/v1/ip/geo.json
Resolving get.geojs.io (get.geojs.io)... 2606:4700:20::681a:64, 2606:4700:20::681a:164, 2606:4700:20::ac43:46e9, ...
Connecting to get.geojs.io (get.geojs.io)|2606:4700:20::681a:64|:443... connected.
HTTP request sent, awaiting response...
  HTTP/1.1 500 Internal Server Error
  Date: Sun, 08 Jan 2023 15:59:38 GMT
  Content-Type: text/html; charset=utf-8
  Transfer-Encoding: chunked
  Connection: keep-alive
  x-request-id: f4ffd7e64972ea270b7f89f527228b92-AMS
  strict-transport-security: max-age=15552000; includeSubDomains; preload
  access-control-allow-origin: *
  access-control-allow-methods: GET
  pragma: no-cache
  Cache-Control: no-store, no-cache, must-revalidate, private, max-age=0
  x-geojs-location: AMS
  CF-Cache-Status: DYNAMIC
  Report-To: {"endpoints":[{"url":"https:\\/\\/a.nel.cloudflare.com\\/report\\/v3?s=yBx8lTgrKvBcwNOrOJa8Dyr9P49F7WBpMu34EOAELjcKk7pomCyk%2B96oL%2F%2BCv21%2FAF6LQnoHLKJ6eQxjsVQYdCc9e1YW0vXFYhIWsNrBn6%2BqS8Y9RW45HF6%2BPOR1QAUK0Zl%2F1Sd63Yniqg%3D%3D"}],"group":"cf-nel","max_age":604800}
  NEL: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
  X-Content-Type-Options: nosniff
  Server: cloudflare
  CF-RAY: 78662438fb850eaf-AMS
  alt-svc: h3=":443"; ma=86400, h3-29=":443"; ma=86400
2023-01-08 15:59:39 ERROR 500: Internal Server Error.

Since the 500 means that cloudflare received an error from the application I assume the application breaks for certain source ip's.

I would love to tell you the source ip/range, but I'd rather not invite an army of port scanners on that network.
I assume the 500 would be traceable in the logs.

Thank you for looking at it.
In the mean time I hope we can ask the software provider to make that request optional.

GeoIP down?

Weird, https://status.geojs.io/ says 100% up
but
https://get.geojs.io/
https://www.geojs.io/docs/v1/endpoints/geo/
https://www.geojs.io/

etc are 100% down right now

I access it from Sweden, tried both v4/6

Probably because dig shows:

dig get.geojs.io @8.8.8.8

; <<>> DiG 9.10.6 <<>> get.geojs.io @8.8.8.8
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 25799
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;get.geojs.io.			IN	A

;; ANSWER SECTION:
get.geojs.io.		2994	IN	A	0.0.0.0

Is this some kind of DoS protection? 😦

Now status just went off-line.....

dig status.geojs.io @8.8.8.8

; <<>> DiG 9.10.6 <<>> status.geojs.io @8.8.8.8
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 17021
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;status.geojs.io.		IN	A

;; ANSWER SECTION:
status.geojs.io.	3435	IN	A	0.0.0.0

Finish Country Unit Tests

Finish off unit tests for Country endpoint

This is going to be a bit difficult since the JSON that gets returned can change the order its in for some reason which is breaking string comparisons.

Reorder unit tests

Just a placeholder issue so I don't forget. When I increase the tests for util I should make sure they run first

Create currency endpoint

It’d be great if GeoJS had a currency endpoint that returned what currency the users current country used.

IPv6 Support

It seems geojs does currently not support IPv6. Is this something that could be added?

GeoJS throws 500 for spaces around IPs

If you try and hit something like this:

/v1/ip/geo.json?ip=162.253.128.178, 64.252.74.175

GeoJS ends up throwing a 500. Really it should just throw a 400 or ideally we should just chomp up the space and return proper data.

Fix variables not being local

Several of the Variables used in the GeoJS code base are not scoped to be local which can lead to race conditions. Everything should be scoped locally where possible.

Start Hook Unit Tests

This is going to be a bit harder since we'll have to do POST requests and fake our auth token

List of countries with pretty names

Hi Jloh, and thanks for building this! It really does make the forms on our website so much more user friendly.

For digital marketing purposes, we're looking for a list of all the pretty names that the country API returns. Do you know where could we find such a list?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.