|
@@ -8,8 +8,6 @@ import (
|
|
|
"github.com/vladimirok5959/golang-ip2location/internal/consts"
|
|
|
)
|
|
|
|
|
|
-const dbFileName = "IP2LOCATION-LITE-DB3.BIN"
|
|
|
-
|
|
|
type Client struct {
|
|
|
ctx context.Context
|
|
|
base *ip2location.DB
|
|
@@ -23,7 +21,7 @@ type Result struct {
|
|
|
}
|
|
|
|
|
|
func New(ctx context.Context, shutdown context.CancelFunc) (*Client, error) {
|
|
|
- f, err := consts.DataPathFile(dbFileName)
|
|
|
+ f, err := consts.DataPathFile(consts.DBFileName)
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
@@ -57,7 +55,7 @@ func (c *Client) IP2Location(ctx context.Context, ip string) (*Result, error) {
|
|
|
}
|
|
|
|
|
|
func (c *Client) ReloadDatabase(ctx context.Context) error {
|
|
|
- f, err := consts.DataPathFile(dbFileName)
|
|
|
+ f, err := consts.DataPathFile(consts.DBFileName)
|
|
|
if err != nil {
|
|
|
return err
|
|
|
}
|