diff options
author | pg9182 <96569817+pg9182@users.noreply.github.com> | 2022-11-19 23:04:48 -0500 |
---|---|---|
committer | pg9182 <96569817+pg9182@users.noreply.github.com> | 2022-11-20 06:12:13 -0500 |
commit | dcf74103acc6b4c315e31fb5dde65f74eec3e982 (patch) | |
tree | 87a9e825c1309168df813039efee1ee121956a4e /pkg/api/api0/api.go | |
parent | 5603d023f9bb87d4de3e469129b4607d498348e0 (diff) | |
download | Atlas-dcf74103acc6b4c315e31fb5dde65f74eec3e982.tar.gz Atlas-dcf74103acc6b4c315e31fb5dde65f74eec3e982.zip |
pkg/api/api0: Add LookupIP field
Diffstat (limited to 'pkg/api/api0/api.go')
-rw-r--r-- | pkg/api/api0/api.go | 6 |
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 } |