Files
gluetun/internal/publicip/models/ipinfo.go
Quentin McGaw 83b4a3fe55 chore(publicip): refactoring
- Exported `Fetcher` interface
- Inject `Fetcher` to publicip loop and updaters
- Get public IP and information at the same time
- Only query ipinfo.io
- Make `MultiInfo` part of the `Fetch` object
2022-06-12 00:46:08 +00:00

23 lines
576 B
Go

package models
import "net"
type IPInfoData struct {
IP net.IP `json:"ip,omitempty"`
Region string `json:"region,omitempty"`
Country string `json:"country,omitempty"`
City string `json:"city,omitempty"`
Hostname string `json:"hostname,omitempty"`
Loc string `json:"loc,omitempty"`
Org string `json:"org,omitempty"`
Postal string `json:"postal,omitempty"`
Timezone string `json:"timezone,omitempty"`
}
func (i IPInfoData) Copy() (copied IPInfoData) {
copied = i
copied.IP = make(net.IP, len(i.IP))
copy(copied.IP, i.IP)
return copied
}