🏗️ microservice fabric splitting

This commit is contained in:
2024-12-24 00:38:41 +08:00
parent 462e811742
commit 89d64336f5
311 changed files with 18384 additions and 2428 deletions

View File

@@ -0,0 +1,27 @@
package ip2region
import (
"os"
"path/filepath"
"github.com/lionsoul2014/ip2region/binding/golang/xdb"
)
// NewIP2Region creates a new IP2Region searcher instance.
func NewIP2Region() *xdb.Searcher {
cwd, err := os.Getwd()
if err != nil {
panic(err)
}
dbPath := filepath.Join(cwd, "resources/ip2region", "ip2region.xdb")
cBuff, err := xdb.LoadContentFromFile(dbPath)
if err != nil {
panic(err)
}
searcher, err := xdb.NewWithBuffer(cBuff)
if err != nil {
panic(err)
return nil
}
return searcher
}