mirror of
https://github.com/onyx-and-iris/q3rcon-proxy.git
synced 2026-04-07 15:53:29 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| fd51761ab5 | |||
| 16e5e9c010 | |||
| 916d2a2d86 | |||
|
|
1bbe3102ce | ||
|
|
f1762cf3ad |
7
.gitignore
vendored
7
.gitignore
vendored
@@ -1,3 +1,5 @@
|
||||
# Auto-generated .gitignore by gignore: github.com/onyx-and-iris/gignore
|
||||
### Go ###
|
||||
# If you prefer the allow list template instead of the deny list, see community template:
|
||||
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
|
||||
#
|
||||
@@ -20,10 +22,7 @@ bin/
|
||||
|
||||
# Go workspace file
|
||||
go.work
|
||||
# End of gignore: github.com/onyx-and-iris/gignore
|
||||
|
||||
# Added by goreleaser init:
|
||||
dist/
|
||||
|
||||
# testing
|
||||
run.sh
|
||||
server.yaml
|
||||
|
||||
14
README.md
14
README.md
@@ -22,9 +22,19 @@ Then just run the binary which you can compile yourself, download from `Releases
|
||||
|
||||
### Logging
|
||||
|
||||
Set the log level with environment variable `Q3RCON_LOGLEVEL`:
|
||||
Set the log level with environment variable `Q3RCON_LOGLEVEL`.
|
||||
|
||||
`0 = Panic, 1 = Fatal, 2 = Error, 3 = Warning, 4 = Info, 5 = Debug, 6 = Trace`
|
||||
Acceptable values are:
|
||||
|
||||
- `trace`
|
||||
- `debug`
|
||||
- `info`
|
||||
- `warn`
|
||||
- `error`
|
||||
- `fatal`
|
||||
- `panic`
|
||||
|
||||
If not set it will default to `info`.
|
||||
|
||||
### Special Thanks
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
version: '3'
|
||||
|
||||
includes:
|
||||
docker: ./docker/Taskfile.docker.yml
|
||||
|
||||
vars:
|
||||
PROGRAM: q3rcon-proxy
|
||||
SHELL: '{{if eq .OS "Windows_NT"}}powershell{{end}}'
|
||||
@@ -38,11 +41,13 @@ tasks:
|
||||
desc: Build the q3rcon-proxy project for Windows
|
||||
cmds:
|
||||
- GOOS=windows GOARCH=amd64 go build -o {{.WINDOWS}} -ldflags="-X main.Version={{.GIT_COMMIT}}" ./cmd/{{.PROGRAM}}/
|
||||
internal: true
|
||||
|
||||
build-linux:
|
||||
desc: Build the q3rcon-proxy project for Linux
|
||||
cmds:
|
||||
- GOOS=linux GOARCH=amd64 go build -o {{.LINUX}} -ldflags="-X main.Version={{.GIT_COMMIT}}" ./cmd/{{.PROGRAM}}/
|
||||
internal: true
|
||||
|
||||
test:
|
||||
desc: Run tests
|
||||
|
||||
@@ -3,7 +3,6 @@ package main
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"slices"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -13,13 +12,16 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
logLevel, err := getEnvInt("Q3RCON_LOGLEVEL")
|
||||
loglevel := os.Getenv("Q3RCON_LOGLEVEL")
|
||||
if loglevel == "" {
|
||||
loglevel = "info"
|
||||
}
|
||||
level, err := log.ParseLevel(loglevel)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to parse Q3RCON_LEVEL: %s", err.Error())
|
||||
}
|
||||
if slices.Contains(log.AllLevels, log.Level(logLevel)) {
|
||||
log.SetLevel(log.Level(logLevel))
|
||||
fmt.Fprintf(os.Stderr, "Invalid log level: %s\n", loglevel)
|
||||
os.Exit(1)
|
||||
}
|
||||
log.SetLevel(level)
|
||||
|
||||
proxyHost := os.Getenv("Q3RCON_PROXY_HOST")
|
||||
if proxyHost == "" {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM golang:1.21 AS build_image
|
||||
FROM golang:1.24 AS build_image
|
||||
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
26
docker/Taskfile.docker.yml
Normal file
26
docker/Taskfile.docker.yml
Normal file
@@ -0,0 +1,26 @@
|
||||
version: '3'
|
||||
|
||||
vars:
|
||||
IMAGE: q3rcon-proxy
|
||||
|
||||
tasks:
|
||||
build:
|
||||
desc: Build the Docker image
|
||||
cmds:
|
||||
- docker build -t {{.IMAGE}} -f docker/Dockerfile .
|
||||
dir: .
|
||||
|
||||
login:
|
||||
desc: Login to Github Container Registry
|
||||
cmds:
|
||||
- docker login ghcr.io -u {{.GHCR_USER}} --password-stdin <<< {{.GHCR_TOKEN}}
|
||||
internal: true
|
||||
|
||||
push:
|
||||
desc: Push the Docker image to Github Container Registry
|
||||
deps:
|
||||
- task: build
|
||||
- task: login
|
||||
cmds:
|
||||
- docker tag {{.IMAGE}} ghcr.io/{{.GHCR_USER}}/{{.IMAGE}}:latest
|
||||
- docker push ghcr.io/{{.GHCR_USER}}/{{.IMAGE}}:latest
|
||||
6
go.mod
6
go.mod
@@ -1,7 +1,9 @@
|
||||
module github.com/onyx-and-iris/q3rcon-proxy
|
||||
|
||||
go 1.18
|
||||
go 1.24.0
|
||||
|
||||
toolchain go1.24.1
|
||||
|
||||
require github.com/sirupsen/logrus v1.9.3
|
||||
|
||||
require golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 // indirect
|
||||
require golang.org/x/sys v0.31.0 // indirect
|
||||
|
||||
3
go.sum
3
go.sum
@@ -8,8 +8,9 @@ github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVs
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 h1:0A+M6Uqn+Eje4kHMK80dtF3JCXC4ykBgQG4Fe06QRhQ=
|
||||
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
|
||||
golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
|
||||
Reference in New Issue
Block a user