Feat: location data at /v1/publicip/ip

This commit is contained in:
Quentin McGaw (desktop)
2021-09-05 22:54:10 +00:00
parent 82ac568ee3
commit f9cb71027c
9 changed files with 62 additions and 42 deletions

View File

@@ -70,7 +70,6 @@ func (l *Loop) Run(ctx context.Context, done chan<- struct{}) {
l.stopped <- struct{}{}
case ip := <-ipCh:
getCancel()
l.state.SetPublicIP(ip)
message := "Public IP address is " + ip.String()
result, err := Info(ctx, l.client, ip)
@@ -81,6 +80,9 @@ func (l *Loop) Run(ctx context.Context, done chan<- struct{}) {
}
l.logger.Info(message)
result.SetIP(ip)
l.state.SetData(result)
filepath := l.state.GetSettings().IPFilepath
err = persistPublicIP(filepath, ip.String(), l.puid, l.pgid)
if err != nil {