Some refactoring of bitmask-core
This MR also depends on !4 (merged) (most commits are part of !4 (merged)).
Changes
- Improve logging
- Add missing Timeout to http.Client{}
- Refactor FetchService
- renamed to getService
- menshen endpoint and functions should be renamed (this endpoint is only for backwards compatibilty I think)
- use only one function: fetch and return data instead of storing it in an internal variable. This makes things easier and more intuitive
- add test
- the command line tools were not fixed and are broken. For the current state, it makes more sense to concentrate on api design and client code
Refactoring the client side API call functions (instead of using fetchService() and then Service() to return the data just use a single function) is changing the logic but I like it much better. Foreexample I had the problem of calling Service() before fetchService() which segfaulted ...
TODO:
- split /service endpint into multiple (locations, openvpn params, ...)
- I think we don't need a locations endpoint in v5 (v3 does not use bitmask-core)
- caching in bitmask-core: do we need it? I removed it
- if so: let's add a caching parameter (like 5 minutes) instead of returning the date of the last fetch
- the socks5 does not work so far. Couldn't test it. Needs a public instance (localhost throuth Tor does not work)
refactor other functions...
Edited by Pea Nut