remove: eliminar GeoIP completamente, no era necesario
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
d66fe95514
commit
1d152b6de0
@@ -35,15 +35,6 @@ func LoadBuiltInMiddlewares(app *config.AppConfig) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
func Location(c *fiber.Ctx) (string, error) {
|
|
||||||
if Http.GeoIP == nil {
|
|
||||||
return "127.0.0.1", nil
|
|
||||||
}
|
|
||||||
ip := IP(c)
|
|
||||||
_, err := Http.GeoIP.GetLocation(ip)
|
|
||||||
return "127.0.0.1", err
|
|
||||||
}
|
|
||||||
|
|
||||||
var fetchIpFromString = regexp.MustCompile(`(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})`)
|
var fetchIpFromString = regexp.MustCompile(`(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})`)
|
||||||
var possibleHeaderes = []string{
|
var possibleHeaderes = []string{
|
||||||
"X-Original-Forwarded-For",
|
"X-Original-Forwarded-For",
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import (
|
|||||||
"github.com/joho/godotenv"
|
"github.com/joho/godotenv"
|
||||||
"github.com/oarkflow/log"
|
"github.com/oarkflow/log"
|
||||||
"github.com/sujit-baniya/flash"
|
"github.com/sujit-baniya/flash"
|
||||||
"github.com/sujit-baniya/ip"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Config is a application configuration structure
|
// Config is a application configuration structure
|
||||||
@@ -31,7 +30,6 @@ type AppConfig struct {
|
|||||||
Token Token `yaml:"token"`
|
Token Token `yaml:"token"`
|
||||||
Profiler ProfilerConfig `yaml:"profiler"`
|
Profiler ProfilerConfig `yaml:"profiler"`
|
||||||
Flash *flash.Flash
|
Flash *flash.Flash
|
||||||
GeoIP *ip.GeoIpDB
|
|
||||||
ConfigFile string
|
ConfigFile string
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,10 +50,6 @@ func (cfg *AppConfig) Setup() {
|
|||||||
modelFile := filepath.Join(cfg.Server.AssetPath, "rbac_model.conf")
|
modelFile := filepath.Join(cfg.Server.AssetPath, "rbac_model.conf")
|
||||||
cfg.Auth.Setup(cfg.Database.DB, modelFile)
|
cfg.Auth.Setup(cfg.Database.DB, modelFile)
|
||||||
}
|
}
|
||||||
mmdbPath := filepath.Join(cfg.Server.AssetPath, "GeoLite2-City.mmdb")
|
|
||||||
if _, err := os.Stat(mmdbPath); err == nil {
|
|
||||||
cfg.GeoIP = ip.NewGeoIpDB(MakeDir(mmdbPath))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cfg *AppConfig) PrepareLog() {
|
func (cfg *AppConfig) PrepareLog() {
|
||||||
|
|||||||
Reference in New Issue
Block a user