New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/relaypoolsrv, cmd/ursrv: Automatically manage GeoIP updates #9342
base: main
Are you sure you want to change the base?
Conversation
* main: lib/model: Typo in method name (fixes syncthing#9389) lib/model: Typo in debug print (fixes syncthing#9386) build: Update dependencies (syncthing#9379) build(deps): bump actions/cache from 3 to 4 (syncthing#9363) lib/api: Improve folder summary event, verbose service (syncthing#9370) lib/protocol: Refactor interface (syncthing#9375) gui, man, authors: Update docs, translations, and contributors lib/fs: Add invalid UTF-8 guards to watcher (fixes syncthing#9369) (syncthing#9372) lib/api: Remove remnants of CSRF tokens file mentions (ref syncthing#9284) gui, man, authors: Update docs, translations, and contributors gui: Remove non-functional HTML from External Versioning tooltip (ref syncthing#8923) (syncthing#9358) cmd/ursrv: Add FreeBSD detection (syncthing#9351) cmd/ursrv: Fix Arch detection (syncthing#9350) lib/ignore: Optimise ignoring directories for filesystem watcher (fixes syncthing#9339) (syncthing#9340) gui, man, authors: Update docs, translations, and contributors lib/ignore: Refactor out result type (syncthing#9343)
} | ||
} | ||
|
||
func (p *Provider) City(ip net.IP) (*geoip2.City, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might download the entire db, right? Seems a bit unexpected. What about doing it in the constructor, and then afterwards in the background to avoid taking a long time calling this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed
func (p *Provider) open(ctx context.Context) (*geoip2.Reader, error) { | ||
if p.licenseKey == "" { | ||
return nil, errors.New("open: no license key set") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't remember, but I'm surprised this is now mandatory?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is...
* main: lib/logger: Split STTRACE into list of strings (syncthing#9402) gui, man, authors: Update docs, translations, and contributors
* release: build: Use Go 1.22.3 at minimum
* main: (45 commits) build: Use Go 1.22.3 at minimum build: Use Go 1.22.3 at minimum gui: Add Hindi (hi) translation template (syncthing#9530) gui, man, authors: Update docs, translations, and contributors lib/connections: Add syncthing_connections_active metric (fixes syncthing#9527) (syncthing#9528) etc: Use 7MiB buffer size (syncthing#9524) gui: Fix Firefox bookmark favicon (fixes syncthing#9506) (syncthing#9507) gui, man, authors: Update docs, translations, and contributors gui, man, authors: Update docs, translations, and contributors gui, man, authors: Update docs, translations, and contributors lib/nat: Don't crash on empty address list (fixes syncthing#9503) (syncthing#9504) lib/db: Drop indexes for outgoing data to force refresh (ref syncthing#9496) (syncthing#9502) gui: Fix missing link to device editor for names with superscript (ref syncthing#9472) (syncthing#9494) lib/db: Hold update lock while taking snapshot (syncthing#9496) build: Update dependencies (syncthing#9497) gui, man, authors: Update docs, translations, and contributors gui, man, authors: Update docs, translations, and contributors Removed no longer relevant Bountysource link (syncthing#9480) lib/api: Missing return after HTTP error lib/api: Extract session store (syncthing#9425) ...
This adds a small package
geoip
which knows how to download and manage the Maxmind GeoLite2 database we use. This removes the need for various scripts to download and manage the geoip database, something that today happens on Docker startup for the relay pool server and using various hand written hacks for the usage reporting server.The database is downloaded when needed and then refreshed on a best-effort basis weekly.