/
rest.go
38 lines (30 loc) · 1.06 KB
/
rest.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package common
import "github.com/dgrijalva/jwt-go"
// SoftwareName is the name of this software
const SoftwareName = "vic2-multi-proxy"
// SoftwareVersion is the version of this software
const SoftwareVersion = "v1.0.1-alpha"
// APIVersion is the version of the REST API implemented in this file
const APIVersion uint = 3
// InfoResponse is the JSON response to the /info REST method
type InfoResponse struct {
Software string `json:"software"`
Version string `json:"version"`
API uint `json:"apiVersion"`
}
// CheckinResponse is the JSON response to the /checkin REST method
type CheckinResponse struct {
Lobbies map[string]RestLobby `json:"lobbies"`
Hosting bool `json:"hosting"`
LinkedLobby uint64 `json:"linkedTo"`
}
// RestLobby represents a Lobby in the lobbies dictionary in the CheckinResponse struct
type RestLobby struct {
Name string `json:"name"`
Host string `json:"host"`
}
// JWT Claims type for the authentication token
type AuthTokenCustomClaims struct {
UserID uint64 `json:"uid"`
jwt.StandardClaims
}