Maintenance: improve publicip with Result struct

This commit is contained in:
Quentin McGaw
2021-05-08 23:30:29 +00:00
parent 248cc0d3d3
commit d9a70fd094
3 changed files with 24 additions and 18 deletions

View File

@@ -154,11 +154,11 @@ func (l *looper) Run(ctx context.Context, wg *sync.WaitGroup) {
l.state.setPublicIP(ip)
message := "Public IP address is " + ip.String()
country, region, city, err := Info(ctx, l.client, ip)
result, err := Info(ctx, l.client, ip)
if err != nil {
l.logger.Warn(err)
} else {
message += " (" + country + ", " + region + ", " + city + ")"
message += " (" + result.Country + ", " + result.Region + ", " + result.City + ")"
}
l.logger.Info(message)