mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2026-03-04 12:57:31 +00:00
chore: Add GeoIP result to metadata
This commit is contained in:
@@ -5,7 +5,6 @@ import (
|
||||
"net"
|
||||
|
||||
"github.com/oschwald/maxminddb-golang"
|
||||
"github.com/sagernet/sing/common"
|
||||
)
|
||||
|
||||
type geoip2Country struct {
|
||||
@@ -44,9 +43,11 @@ func (r Reader) LookupCode(ipAddress net.IP) []string {
|
||||
case string:
|
||||
return []string{record}
|
||||
case []any: // lookup returned type of slice is []any
|
||||
return common.Map(record, func(it any) string {
|
||||
return it.(string)
|
||||
})
|
||||
result := make([]string, 0, len(record))
|
||||
for _, item := range record {
|
||||
result = append(result, item.(string))
|
||||
}
|
||||
return result
|
||||
}
|
||||
return []string{}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user