Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindMirrors ¶
Find mirrors that suit the given location.
Rules:
- Prefer mirrors of the same country.
- Then prefer mirrors of the same continent.
- Fallback to the default mirror.
- If multiple mirrors in the same country/continent, order by distance via latitude/longitude.
- Append the default to the last as the fallback.
- If location is nil, then return the default mirror.
Types ¶
type Record ¶
type Record struct {
Continent struct {
// Two-letter code
Code string `maxminddb:"code"`
} `maxminddb:"continent"`
Country struct {
// Two-letter code
Code string `maxminddb:"iso_code"`
} `maxminddb:"country"`
Location struct {
Latitude float64 `maxminddb:"latitude"`
Longitude float64 `maxminddb:"longitude"`
} `maxminddb:"location"`
}
MaxMind and DB-IP use the same schema for the selected fields here.
Click to show internal directories.
Click to hide internal directories.