Files
warmbly/internal/pkg/geo/client.go
T
Matthew Meszaros 2430095197 feat: move infrastructure state off dynamodb
Remove DynamoDB-backed storage paths, add Postgres/HTTP repositories for mailbox state maps, wire the internal message-map API, and add provisioning runner/migration plumbing.
2026-06-02 15:54:12 +02:00

31 lines
406 B
Go

package geo
import "github.com/oschwald/geoip2-golang/v2"
type Client struct {
r *geoip2.Reader
}
func New(location string) (*Client, error) {
if location == "" {
return &Client{
r: nil,
}, nil
}
db, err := geoip2.Open(location)
if err != nil {
return nil, err
}
return &Client{
r: db,
}, nil
}
func (c *Client) Close() {
if c == nil || c.r == nil {
return
}
_ = c.r.Close()
}