aboutsummaryrefslogtreecommitdiff
path: root/pkg/api
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/api')
-rw-r--r--pkg/api/api0/api.go8
-rw-r--r--pkg/api/api0/client.go10
-rw-r--r--pkg/api/api0/server.go4
3 files changed, 11 insertions, 11 deletions
diff --git a/pkg/api/api0/api.go b/pkg/api/api0/api.go
index 66f9a93..38d1741 100644
--- a/pkg/api/api0/api.go
+++ b/pkg/api/api0/api.go
@@ -147,9 +147,9 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
notPanicked = true
}
-// checkLauncherVersion checks if the r was made by NorthstarLauncher and if it
+// CheckLauncherVersion checks if the r was made by NorthstarLauncher and if it
// is at least MinimumLauncherVersion.
-func (h *Handler) checkLauncherVersion(r *http.Request) bool {
+func (h *Handler) CheckLauncherVersion(r *http.Request) bool {
rver, _, _ := strings.Cut(r.Header.Get("User-Agent"), " ")
if x := strings.TrimPrefix(rver, "R2Northstar/"); rver != x {
if len(x) > 0 && x[0] != 'v' {
@@ -195,9 +195,9 @@ func (h *Handler) checkLauncherVersion(r *http.Request) bool {
return true
}
-// extractLauncherVersion extracts the launcher version from r, returning an
+// ExtractLauncherVersion extracts the launcher version from r, returning an
// empty string if it's missing or invalid.
-func (h *Handler) extractLauncherVersion(r *http.Request) string {
+func (h *Handler) ExtractLauncherVersion(r *http.Request) string {
rver, _, _ := strings.Cut(r.Header.Get("User-Agent"), " ")
if x := strings.TrimPrefix(rver, "R2Northstar/"); rver != x {
if len(x) > 0 && x[0] != 'v' {
diff --git a/pkg/api/api0/client.go b/pkg/api/api0/client.go
index b8b54cb..b4e80d1 100644
--- a/pkg/api/api0/client.go
+++ b/pkg/api/api0/client.go
@@ -61,7 +61,7 @@ func (h *Handler) handleMainMenuPromos(w http.ResponseWriter, r *http.Request) {
return
}
- h.m().client_mainmenupromos_requests_total.success(h.extractLauncherVersion(r)).Inc()
+ h.m().client_mainmenupromos_requests_total.success(h.ExtractLauncherVersion(r)).Inc()
h.geoCounter2(r, h.m().client_mainmenupromos_requests_map)
var p MainMenuPromos
@@ -88,7 +88,7 @@ func (h *Handler) handleClientOriginAuth(w http.ResponseWriter, r *http.Request)
return
}
- if !h.checkLauncherVersion(r) {
+ if !h.CheckLauncherVersion(r) {
h.m().client_originauth_requests_total.reject_versiongate.Inc()
respFail(w, r, http.StatusBadRequest, ErrorCode_UNSUPPORTED_VERSION.MessageObj())
return
@@ -323,7 +323,7 @@ func (h *Handler) handleClientAuthWithServer(w http.ResponseWriter, r *http.Requ
return
}
- if !h.checkLauncherVersion(r) {
+ if !h.CheckLauncherVersion(r) {
h.m().client_authwithserver_requests_total.reject_versiongate.Inc()
respFail(w, r, http.StatusBadRequest, ErrorCode_UNSUPPORTED_VERSION.MessageObj())
return
@@ -479,7 +479,7 @@ func (h *Handler) handleClientAuthWithSelf(w http.ResponseWriter, r *http.Reques
return
}
- if !h.checkLauncherVersion(r) {
+ if !h.CheckLauncherVersion(r) {
h.m().client_authwithself_requests_total.reject_versiongate.Inc()
respFail(w, r, http.StatusBadRequest, ErrorCode_UNSUPPORTED_VERSION.MessageObj())
return
@@ -617,7 +617,7 @@ func (h *Handler) handleClientServers(w http.ResponseWriter, r *http.Request) {
h.m().client_servers_response_size_bytes.none.Update(float64(len(buf)))
}
- lver := h.extractLauncherVersion(r)
+ lver := h.ExtractLauncherVersion(r)
h.m().client_servers_requests_total.success(lver).Inc()
if lver != "" {
h.geoCounter2(r, h.m().client_servers_requests_map.northstar)
diff --git a/pkg/api/api0/server.go b/pkg/api/api0/server.go
index ad7133c..3e02a26 100644
--- a/pkg/api/api0/server.go
+++ b/pkg/api/api0/server.go
@@ -54,7 +54,7 @@ func (h *Handler) handleServerUpsert(w http.ResponseWriter, r *http.Request) {
return
}
- if !h.checkLauncherVersion(r) {
+ if !h.CheckLauncherVersion(r) {
h.m().server_upsert_requests_total.reject_versiongate(action).Inc()
respFail(w, r, http.StatusBadRequest, ErrorCode_UNSUPPORTED_VERSION.MessageObj())
return
@@ -93,7 +93,7 @@ func (h *Handler) handleServerUpsert(w http.ResponseWriter, r *http.Request) {
var s *Server
if canCreate {
s = &Server{
- LauncherVersion: h.extractLauncherVersion(r),
+ LauncherVersion: h.ExtractLauncherVersion(r),
}
}