更好地支持IPv6

This commit is contained in:
GoEdgeLab
2024-04-06 09:12:17 +08:00
parent ba4213d0db
commit 5893fd7b3a
22 changed files with 1237 additions and 137 deletions

View File

@@ -214,7 +214,12 @@ func (this *Updater) Loop() error {
func (this *Updater) loadFile(fp *os.File) error {
this.source.LogInfo("load ip library from '" + fp.Name() + "' ...")
fileReader, err := NewFileDataReader(fp, "")
var version = ReaderVersionV1
if strings.HasSuffix(fp.Name(), ".v2.db") {
version = ReaderVersionV2
}
fileReader, err := NewFileDataReader(fp, "", version)
if err != nil {
return fmt.Errorf("load ip library from reader failed: %w", err)
}