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
This commit is contained in:
@@ -3,7 +3,7 @@ package models
|
||||
import "net"
|
||||
|
||||
type IPInfoData struct {
|
||||
IP net.IP `json:"public_ip"`
|
||||
IP net.IP `json:"ip,omitempty"`
|
||||
Region string `json:"region,omitempty"`
|
||||
Country string `json:"country,omitempty"`
|
||||
City string `json:"city,omitempty"`
|
||||
@@ -20,8 +20,3 @@ func (i IPInfoData) Copy() (copied IPInfoData) {
|
||||
copy(copied.IP, i.IP)
|
||||
return copied
|
||||
}
|
||||
|
||||
func (i *IPInfoData) SetIP(ip net.IP) {
|
||||
i.IP = make(net.IP, len(ip))
|
||||
copy(i.IP, ip)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user