sapics / ip-location-db

ip to location database by ASN, GeoFeed, Whois, iptoasn.com, db-ip lite, GeoLite2
Other
1.08k stars 110 forks source link

Web tester and protocol buffers api #33

Open gedw99 opened 4 months ago

gedw99 commented 4 months ago

Would you like a web tester ( just a simple index.html and a protocol buffers ali server ?

it will make it easy for devs to see how this works.

we can then also do real world testing by rolling out golang clients to 26 locations with fly.io and then from a simple CLI call all of them and hence check they all get the correct answers using the global fly.io network.

sapics commented 4 months ago

Thank you for your advice! Sorry, I am not good at English, thus, I could not understand your advice well. Could you please tell me, "what" we need to test?

gedw99 commented 4 months ago

Hey @sapics

no problem. May English is pretty bad and I am English :)

At the moment everything is just CSV files, which are highly useful, but not easily usable yet.

I would like to extend this to provide a usable API using standard golang HTTP API. No complex dependencies.

There are many ways to do this, and I am just starting up the conversation around it.

sapics commented 4 months ago

Looks great! As you noticed, HTTP API is much easier to use. If such an API were created, many people would be very pleased!

gedw99 commented 4 months ago

How about this ??

  1. First the data layer

this is just a CLI to get a feel for the query. works well. go install github.com/mithrandie/csvq@latest

THIS is the golang driver: https://github.com/mithrandie/csvq-driver

It's slow but good enough for now.

  1. Then the REST API that uses the csvq-driver, and returns the data.

Just type with JSON Serialisation.

  1. Then Web Components GUI that uses no JS using the DSD Web Components.

maybe 10 lines of code that displays the forms variables, posts the form back, parses the values into the API layer, and then pushes a WebCompnent back from the Server with the results.

https://github.com/ryoid/go-streaming-html-ooo


Later add a SQLITE DB to replace the CSV. Can easily make a loader to load the CSV into the SQLIte.

sapics commented 4 months ago

I know little about golang, thus, it is difficult to discuss whether that is a good approach or not. Either way, the HTTP API is very useful, so it would be helpful if you could share a link to the HTTP API in this issue. Also, if you could describe how to use the HTTP API, I would be happy to share it in a README or similar.

We also think it would be useful to create it in SQLite, so we would like to create a link to that as well, when you publish it. However, we would like to keep the data in CSV format for existing users.

gedw99 commented 4 months ago

Ok thanks for the reply and letting me know about your opinions about how useful this would be for other devs.

I could publish it on my repo and set it up so that it pulls the csv files from your repo.

does that sound like a good plan ?

sapics commented 4 months ago

Thanks! Looks great!

gedw99 commented 4 months ago

Ok let me get to it. A bit snowed under right now.