Feat: location data at /v1/publicip/ip
This commit is contained in:
@@ -4,6 +4,8 @@ import (
|
||||
"context"
|
||||
"net"
|
||||
"net/http"
|
||||
|
||||
"github.com/qdm12/gluetun/internal/publicip/models"
|
||||
)
|
||||
|
||||
// MultiInfo obtains the public IP address information for every IP
|
||||
@@ -13,12 +15,12 @@ import (
|
||||
// an error is returned, so the results returned should be considered
|
||||
// incomplete in this case.
|
||||
func MultiInfo(ctx context.Context, client *http.Client, ips []net.IP) (
|
||||
results []Result, err error) {
|
||||
results []models.IPInfoData, err error) {
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
|
||||
type asyncResult struct {
|
||||
index int
|
||||
result Result
|
||||
result models.IPInfoData
|
||||
err error
|
||||
}
|
||||
resultsCh := make(chan asyncResult)
|
||||
@@ -33,7 +35,7 @@ func MultiInfo(ctx context.Context, client *http.Client, ips []net.IP) (
|
||||
}(i, ip)
|
||||
}
|
||||
|
||||
results = make([]Result, len(ips))
|
||||
results = make([]models.IPInfoData, len(ips))
|
||||
for i := 0; i < len(ips); i++ {
|
||||
aResult := <-resultsCh
|
||||
if aResult.err != nil {
|
||||
|
||||
Reference in New Issue
Block a user