package common import ( "dubbo.apache.org/dubbo-go/v3/common/constant" "fmt" "fonchain-fiee/pkg/e" "os" ) type Result struct { IP string `json:"ip"` Location Location `json:"location"` AdInfo AdInfo `json:"ad_info"` } type Location struct { Lat float64 `json:"lat"` Lng float64 `json:"lng"` } type AdInfo struct { Nation string `json:"nation"` Province string `json:"province"` City string `json:"city"` District string `json:"district"` AdcodE int `json:"adcode"` } type IpResult struct { Status int `json:"status"` Message string `json:"message"` RequestID string `json:"request_id"` Result Result `json:"result"` } type IPDict struct { fileData []byte //文件数据 offset uint32 //当前下标定位 firstOffset uint32 //第一条IP记录的偏移地址 lastOffset uint32 //最后一条IP记录的偏移地址 totalIPNum uint32 //IP记录的总条数(不包含版本信息记录) } type IPLocation struct { IP string `json:"ip"` BeginIP string `json:"begin_ip"` EndIP string `json:"end_ip"` Country string `json:"country"` Area string `json:"area"` } func GetConf() (iniConf string, err error) { if os.Getenv(e.MODE_ENV) != "" { if err = os.Setenv(constant.ConfigFileEnvKey, fmt.Sprintf("./conf/%s/%s", os.Getenv(e.MODE_ENV), e.SERVER_DUBBOGO_CONFIG)); err != nil { return } } if os.Getenv(e.MODE_ENV) == "" { iniConf = fmt.Sprintf("../conf/%s", e.SERVER_CONFIG) } else { iniConf = fmt.Sprintf("./conf/%s/%s", os.Getenv(e.MODE_ENV), e.SERVER_CONFIG) } return }