Some countries folders do not have ipv6 file
Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
@@ -17,6 +17,7 @@ package geoloc
|
|||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
@@ -60,6 +61,9 @@ func (s *Service) ImportFromDir(ctx context.Context, dataDir string) error {
|
|||||||
path := filepath.Join(countryDir, entry.Name(), filename)
|
path := filepath.Join(countryDir, entry.Name(), filename)
|
||||||
|
|
||||||
cidrs, err := parseCIDRFile(path)
|
cidrs, err := parseCIDRFile(path)
|
||||||
|
if errors.Is(err, os.ErrNotExist) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("cannot parse CIDR file %s: %w", path, err)
|
return fmt.Errorf("cannot parse CIDR file %s: %w", path, err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user