Documentation
¶
Index ¶
- Variables
- func CacheQuaFile(m db.Map) (string, error)
- func DownloadFile(filepath string, url string) error
- func FixMapNotFound(m *db.Map) error
- func GetFileMD5(path string) (string, error)
- func GetIpFromRequest(c *gin.Context) string
- func InitializeAzure()
- func InitializeDiscordWebhooks()
- func IsValidMD5(s string) bool
- func SendAnticheatWebhook(user *db.User, mapData *db.Map, scoreId int, isPersonalBest bool, ...) error
- func SendFirstPlaceWebhook(user *db.User, score *db.Score, m *db.Map, oldUser *db.User) error
- func SendFixedMapNotFoundWebhook(id int) error
- func SendScoreSubmissionErrorWebhook(user *db.User, reason string) error
- func SendScoreSubmissionWarningWebhook(user *db.User, reason string) error
- func UpdateElasticSearchMapset(id int) error
- type AzureStorageClient
Constants ¶
This section is empty.
Variables ¶
var Anticheat *discordhook.WebhookAPI
var ErrAzureBlobNotFound = errors.New("BlobNotFound")
var ErrAzureMismatchedMD5 = errors.New("MD5 hash of cached file mismatches database")
var FirstPlace *discordhook.WebhookAPI
var ScoreSubmissionErrors *discordhook.WebhookAPI
Functions ¶
func CacheQuaFile ¶
CacheQuaFile Downloads a .qua file from the API to disk
func DownloadFile ¶
DownloadFile Downloads a file from a URL
func FixMapNotFound ¶
FixMapNotFound Attempts to fix a missing map file from azure storage. This will find the mapset, retrieve the .qua from it, and upload it.
func GetFileMD5 ¶
GetFileMD5 Returns the MD5 hash of a file
func GetIpFromRequest ¶
GetIpFromRequest Gets the client's proper ip address from a request.
func InitializeDiscordWebhooks ¶
func InitializeDiscordWebhooks()
func SendAnticheatWebhook ¶
func SendAnticheatWebhook(user *db.User, mapData *db.Map, scoreId int, isPersonalBest bool, reason string) error
SendAnticheatWebhook Sends an anti-cheat related webhook to Discord
func SendFirstPlaceWebhook ¶
SendFirstPlaceWebhook Sends a first place webhook
func SendFixedMapNotFoundWebhook ¶
SendFixedMapNotFoundWebhook Sends a webhook to Discord stating that a blob not found issue has been fixed.
func SendScoreSubmissionErrorWebhook ¶
SendScoreSubmissionErrorWebhook Sends a message to Discord that score submission has failed.
func SendScoreSubmissionWarningWebhook ¶
SendScoreSubmissionWarningWebhook Sends a message to Discord that a warning has occurred during score submission
func UpdateElasticSearchMapset ¶
UpdateElasticSearchMapset Tells the API to update a mapset in elasticsearch
Types ¶
type AzureStorageClient ¶
type AzureStorageClient struct {
// contains filtered or unexported fields
}
var AzureClient AzureStorageClient
AzureClient Global storage client used throughout the application. Must call InitializeAzure to create
func (*AzureStorageClient) DownloadFile ¶
func (c *AzureStorageClient) DownloadFile(container string, name string, path string) (bytes.Buffer, error)
DownloadFile Downloads a blob from a given container
func (*AzureStorageClient) UploadFile ¶
func (c *AzureStorageClient) UploadFile(container string, fileName string, data []byte) error
UploadFile Uploads a file to a given container