aboutsummaryrefslogtreecommitdiff
path: root/pkg/api/api0/api.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/api/api0/api.go')
-rw-r--r--pkg/api/api0/api.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/pkg/api/api0/api.go b/pkg/api/api0/api.go
index 3df86b1..6e1077f 100644
--- a/pkg/api/api0/api.go
+++ b/pkg/api/api0/api.go
@@ -18,12 +18,14 @@ import (
"encoding/hex"
"encoding/json"
"net/http"
+ "net/netip"
"strconv"
"strings"
"sync"
"time"
"github.com/klauspost/compress/gzip"
+ "github.com/pg9182/ip2x/ip2location"
"github.com/r2northstar/atlas/pkg/origin"
"github.com/rs/zerolog/hlog"
"golang.org/x/mod/semver"
@@ -79,6 +81,10 @@ type Handler struct {
// AllowGameServerIPv6 controls whether to allow game servers to use IPv6.
AllowGameServerIPv6 bool
+ // LookupIP looks up an IP2Location record for an IP. If not provided,
+ // server regions are disabled.
+ LookupIP func(netip.Addr, ip2location.Field) (ip2location.Record, error)
+
metricsInit sync.Once
metricsObj apiMetrics
}