19 Commits

Author SHA1 Message Date
github-actions[bot]
b3adaab63c chore: auto-update Go modules 2026-04-13 00:20:37 +00:00
github-actions[bot]
29ee1afb67 chore: auto-update Go modules 2026-04-06 00:18:32 +00:00
github-actions[bot]
40463b004b chore: auto-update Go modules 2026-03-30 00:17:59 +00:00
b3c4eb9cc9 regen gitignore 2026-03-27 14:04:29 +00:00
7b6b26c7f9 add pre-commit config 2026-03-21 14:01:53 +00:00
github-actions[bot]
dc05e156f0 chore: auto-update Go modules 2026-03-16 00:17:47 +00:00
github-actions[bot]
124344b9a1 chore: auto-update Go modules 2026-03-09 00:13:54 +00:00
github-actions[bot]
251168d2d4 chore: auto-update Go modules 2026-03-02 00:14:07 +00:00
github-actions[bot]
ca006d7d73 chore: auto-update Go modules 2026-02-23 00:14:45 +00:00
225188bb70 use net.JoinHostPort to build addresses 2026-02-18 14:51:35 +00:00
63cf99b217 reword 2026-02-18 14:34:38 +00:00
7a83fd6573 add 1.8.0 to CHANGELOG
fix date of 1.7.3
2026-02-18 14:33:19 +00:00
b494e6cf8f upd Taskfile to match changes to --port-map flag 2026-02-18 14:33:01 +00:00
9be4344144 ports-mapping flag now reimplemented as a StringSliceFlag and renamed to port-map. 2026-02-18 14:32:38 +00:00
775979bfc8 update README 2026-02-18 14:28:31 +00:00
6bffa14240 upd go.mod go.sum 2026-02-16 10:30:50 +00:00
74493e6f61 add 1.7.3 to CHANGELOG 2026-02-16 10:29:34 +00:00
51a0065e79 swap out logrus for charm log 2026-02-16 10:29:27 +00:00
f07a45c81b add macos target to goreleaser config 2026-02-16 10:28:52 +00:00
12 changed files with 167 additions and 59 deletions

25
.gitignore vendored
View File

@@ -1,5 +1,6 @@
# Auto-generated .gitignore by gignore: github.com/onyx-and-iris/gignore # Generated by ignr: github.com/onyx-and-iris/ignr
### Go ###
## Go ##
# If you prefer the allow list template instead of the deny list, see community template: # 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 # https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
# #
@@ -9,23 +10,29 @@
*.dll *.dll
*.so *.so
*.dylib *.dylib
bin/
# Test binary, built with `go test -c` # Test binary, built with `go test -c`
*.test *.test
# Output of the go coverage tool, specifically when used with LiteIDE # Code coverage profiles and other test artifacts
*.out *.out
coverage.*
*.coverprofile
profile.cov
# Dependency directories (remove the comment below to include it) # Dependency directories (remove the comment below to include it)
# vendor/ # vendor/
# Go workspace file # Go workspace file
go.work go.work
# End of gignore: github.com/onyx-and-iris/gignore go.work.sum
# Added by goreleaser init: # env file
dist/ .env
# env files
.envrc .envrc
# Editor/IDE
# .idea/
# .vscode/
# End of ignr

View File

@@ -22,6 +22,7 @@ builds:
goos: goos:
- linux - linux
- windows - windows
- darwin
goarch: goarch:
- amd64 - amd64

5
.pre-commit-config.yaml Normal file
View File

@@ -0,0 +1,5 @@
repos:
- repo: https://github.com/tekwizely/pre-commit-golang
rev: v1.0.0-rc.4
hooks:
- id: go-mod-tidy

View File

@@ -11,6 +11,23 @@ Before any major/minor/patch bump all unit tests will be run to verify they pass
- [x] - [x]
## [1.8.0] - 2026-02-18
### Changed
- *--ports-mapping* flag has been replaced with *--port-map*, which may be called several times. See [Flags](https://github.com/onyx-and-iris/q3rcon-proxy?tab=readme-ov-file#flags).
- This also affects the env variable which is now `Q3RCON_PORT_MAP`, see [Environment Variables](https://github.com/onyx-and-iris/q3rcon-proxy?tab=readme-ov-file#environment-variables)
## [1.7.3] - 2026-02-16
### Added
- *--version/-v* flag for printing the version of the CLI.
### Changed
- now using [charmbracelet/log][charmlog] package for logging.
## [1.7.0] - 2025-06-05 ## [1.7.0] - 2025-06-05
### Added ### Added
@@ -99,3 +116,4 @@ Before any major/minor/patch bump all unit tests will be run to verify they pass
- All source files for lilproxy including full commit history. - All source files for lilproxy including full commit history.
[logrus]: https://github.com/sirupsen/logrus [logrus]: https://github.com/sirupsen/logrus
[charmlog]: https://github.com/charmbracelet/log

View File

@@ -6,6 +6,8 @@ A modification of [lilproxy][lilproxy_url] that forwards only Q3 rcon/query pack
Unfortunately the Q3Rcon engine ties the rcon port to the game servers public port used for client connections. This proxy will allow you to run rcon through a separate whitelisted port. Unfortunately the Q3Rcon engine ties the rcon port to the game servers public port used for client connections. This proxy will allow you to run rcon through a separate whitelisted port.
---
### Use ### Use
#### Flags #### Flags
@@ -16,7 +18,7 @@ Unfortunately the Q3Rcon engine ties the rcon port to the game servers public po
/usr/local/bin/q3rcon-proxy \ /usr/local/bin/q3rcon-proxy \
--proxy-host=0.0.0.0 \ --proxy-host=0.0.0.0 \
--target-host=localhost \ --target-host=localhost \
--ports-mapping=28961:28960 \ --port-map=20000:28960 --port-map=20001:28961 --port-map=20002:28962 \
--session-timeout=20 \ --session-timeout=20 \
--loglevel=debug --loglevel=debug
``` ```
@@ -27,18 +29,25 @@ Each of the flags has a corresponding environment variable:
- `Q3RCON_PROXY_HOST`: The host the proxy server sits on. - `Q3RCON_PROXY_HOST`: The host the proxy server sits on.
- `Q3RCON_TARGET_HOST`: The host the game servers sit on. - `Q3RCON_TARGET_HOST`: The host the game servers sit on.
- `Q3RCON_PORTS_MAPPING`: A mapping as a string with `source:target` pairs delimited by `;`. - `Q3RCON_PORT_MAP`: A mapping as a string with `source:target` pairs delimited by `,`.
- `Q3RCON_SESSION_TIMEOUT`: Timeout in seconds for each udp session. - `Q3RCON_SESSION_TIMEOUT`: Timeout in seconds for each udp session.
- `Q3RCON_LOGLEVEL`: The application's logging level (see [Logging][logging]). - `Q3RCON_LOGLEVEL`: The application's logging level (see [Logging][logging]).
Multiple rcon proxies may be configured by setting *--ports-mapping/Q3RCON_PORTS_MAPPING* like so: example .envrc:
```console ```bash
export Q3RCON_PORTS_MAPPING="20000:28960;20001:28961;20002:28962" #!/usr/bin/env bash
export Q3RCON_PROXY_HOST="0.0.0.0"
export Q3RCON_TARGET_HOST="localhost"
export Q3RCON_PORT_MAP="20000:28960,20001:28961,20002:28962"
export Q3RCON_SESSION_TIMEOUT=20
``` ```
This would configure q3rcon-proxy to run 3 proxy servers listening on ports 20000, 20001 and 20002 that redirect rcon requests to game servers on ports 28960, 28961 and 28962 respectively. This would configure q3rcon-proxy to run 3 proxy servers listening on ports 20000, 20001 and 20002 that redirect rcon requests to game servers on ports 28960, 28961 and 28962 respectively.
---
### Logging ### Logging
Set the log level with environment variable `Q3RCON_LOGLEVEL`. Set the log level with environment variable `Q3RCON_LOGLEVEL`.
@@ -53,7 +62,9 @@ Acceptable values are:
- `fatal` - `fatal`
- `panic` - `panic`
If not set it will default to `info`. It defaults to `info`.
---
### Special Thanks ### Special Thanks

View File

@@ -74,6 +74,6 @@ tasks:
go run ./cmd/{{.PROGRAM}} \ go run ./cmd/{{.PROGRAM}} \
--proxy-host=0.0.0.0 \ --proxy-host=0.0.0.0 \
--target-host=localhost \ --target-host=localhost \
--ports-mapping=28961:28960 \ --port-map=28961:28960 \
--session-timeout=20 \ --session-timeout=20 \
--loglevel=debug --loglevel=debug

View File

@@ -4,13 +4,14 @@ package main
import ( import (
"context" "context"
"fmt" "fmt"
"net"
"os" "os"
"runtime/debug" "runtime/debug"
"strconv" "strconv"
"strings" "strings"
"time" "time"
log "github.com/sirupsen/logrus" "github.com/charmbracelet/log"
"github.com/urfave/cli/v3" "github.com/urfave/cli/v3"
udpproxy "github.com/onyx-and-iris/q3rcon-proxy" udpproxy "github.com/onyx-and-iris/q3rcon-proxy"
@@ -61,32 +62,47 @@ func main() {
Usage: "Target host address", Usage: "Target host address",
Sources: cli.EnvVars("Q3RCON_TARGET_HOST"), Sources: cli.EnvVars("Q3RCON_TARGET_HOST"),
}, },
&cli.StringFlag{ &cli.StringSliceFlag{
Name: "ports-mapping", Name: "port-map",
Usage: "Proxy and target ports (proxy:target)", Usage: "Ports mapping in the format proxyPort:targetPort (e.g., 27950:27960)",
Sources: cli.EnvVars("Q3RCON_PORTS_MAPPING"), Sources: cli.EnvVars("Q3RCON_PORT_MAP"),
Required: true, Required: true,
Action: func(_ context.Context, _ *cli.Command, v string) error { Action: func(_ context.Context, cmd *cli.Command, v []string) error {
// Validate the ports mapping // Validate the ports mapping format and values
for mapping := range strings.SplitSeq(v, ";") { for _, mapping := range v {
ports := strings.Split(mapping, ":") src, dst := func(m string) (string, string) {
if len(ports) != 2 { parts := strings.Split(m, ":")
return fmt.Errorf("invalid ports mapping: %s", mapping) if len(parts) != 2 {
} return "", ""
proxyPort, err := strconv.Atoi(ports[0]) }
if err != nil || proxyPort < 1 || proxyPort > 65535 { return parts[0], parts[1]
return fmt.Errorf("invalid proxy port: %s", ports[0]) }(mapping)
}
targetPort, err := strconv.Atoi(ports[1]) if src == "" || dst == "" {
if err != nil || targetPort < 1 || targetPort > 65535 {
return fmt.Errorf("invalid target port: %s", ports[1])
}
if proxyPort == targetPort {
return fmt.Errorf( return fmt.Errorf(
"proxy and target ports cannot be the same: %s", "invalid ports mapping: %s (expected format: proxyPort:targetPort)",
mapping, mapping,
) )
} }
n, err := strconv.Atoi(src)
if err != nil || n <= 0 || n > 65535 {
return fmt.Errorf("invalid proxy port: %s", src)
}
n, err = strconv.Atoi(dst)
if err != nil || n <= 0 || n > 65535 {
return fmt.Errorf("invalid target port: %s", dst)
}
if src == dst {
return fmt.Errorf(
"proxy port and target port cannot be the same: %s",
src,
)
}
log.Debugf(
"Validated ports mapping: proxy port %s -> target port %s",
src,
dst,
)
} }
return nil return nil
}, },
@@ -115,7 +131,7 @@ func main() {
Action: func(_ context.Context, cmd *cli.Command) error { Action: func(_ context.Context, cmd *cli.Command) error {
errChan := make(chan error) errChan := make(chan error)
for mapping := range strings.SplitSeq(cmd.String("ports-mapping"), ";") { for _, mapping := range cmd.StringSlice("port-map") {
cfg := proxyConfig{ cfg := proxyConfig{
proxyHost: cmd.String("proxy-host"), proxyHost: cmd.String("proxy-host"),
targetHost: cmd.String("target-host"), targetHost: cmd.String("target-host"),
@@ -143,18 +159,18 @@ func main() {
func launchProxy(cfg proxyConfig, errChan chan<- error) { func launchProxy(cfg proxyConfig, errChan chan<- error) {
proxyPort, targetPort := cfg.portsMapping[0], cfg.portsMapping[1] proxyPort, targetPort := cfg.portsMapping[0], cfg.portsMapping[1]
hostAddr := fmt.Sprintf("%s:%s", cfg.proxyHost, proxyPort) proxyAddr := net.JoinHostPort(cfg.proxyHost, proxyPort)
proxyAddr := fmt.Sprintf("%s:%s", cfg.targetHost, targetPort) targetAddr := net.JoinHostPort(cfg.targetHost, targetPort)
server, err := udpproxy.New( server, err := udpproxy.New(
hostAddr, proxyAddr, proxyAddr, targetAddr,
udpproxy.WithSessionTimeout(time.Duration(cfg.sessionTimeout)*time.Minute)) udpproxy.WithSessionTimeout(time.Duration(cfg.sessionTimeout)*time.Minute))
if err != nil { if err != nil {
errChan <- fmt.Errorf("failed to create proxy: %w", err) errChan <- fmt.Errorf("failed to create proxy: %w", err)
return return
} }
log.Printf("q3rcon-proxy initialised: [proxy] (%s) [target] (%s)", hostAddr, proxyAddr) log.Infof("q3rcon-proxy initialised: [proxy] (%s) [target] (%s)", proxyAddr, targetAddr)
errChan <- server.ListenAndServe() errChan <- server.ListenAndServe()
} }

28
go.mod
View File

@@ -1,12 +1,28 @@
module github.com/onyx-and-iris/q3rcon-proxy module github.com/onyx-and-iris/q3rcon-proxy
go 1.24.0 go 1.25.0
toolchain go1.24.1
require ( require (
github.com/sirupsen/logrus v1.9.4 github.com/charmbracelet/log v1.0.0
github.com/urfave/cli/v3 v3.6.2 github.com/urfave/cli/v3 v3.8.0
) )
require golang.org/x/sys v0.41.0 // indirect require (
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
github.com/charmbracelet/colorprofile v0.4.3 // indirect
github.com/charmbracelet/lipgloss v1.1.0 // indirect
github.com/charmbracelet/x/ansi v0.11.6 // indirect
github.com/charmbracelet/x/cellbuf v0.0.15 // indirect
github.com/charmbracelet/x/term v0.2.2 // indirect
github.com/clipperhouse/displaywidth v0.11.0 // indirect
github.com/clipperhouse/uax29/v2 v2.7.0 // indirect
github.com/go-logfmt/logfmt v0.6.1 // indirect
github.com/lucasb-eyer/go-colorful v1.4.0 // indirect
github.com/mattn/go-isatty v0.0.21 // indirect
github.com/mattn/go-runewidth v0.0.23 // indirect
github.com/muesli/termenv v0.16.0 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
golang.org/x/exp v0.0.0-20260410095643-746e56fc9e2f // indirect
golang.org/x/sys v0.43.0 // indirect
)

46
go.sum
View File

@@ -1,14 +1,48 @@
github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k=
github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8=
github.com/charmbracelet/colorprofile v0.4.3 h1:QPa1IWkYI+AOB+fE+mg/5/4HRMZcaXex9t5KX76i20Q=
github.com/charmbracelet/colorprofile v0.4.3/go.mod h1:/zT4BhpD5aGFpqQQqw7a+VtHCzu+zrQtt1zhMt9mR4Q=
github.com/charmbracelet/lipgloss v1.1.0 h1:vYXsiLHVkK7fp74RkV7b2kq9+zDLoEU4MZoFqR/noCY=
github.com/charmbracelet/lipgloss v1.1.0/go.mod h1:/6Q8FR2o+kj8rz4Dq0zQc3vYf7X+B0binUUBwA0aL30=
github.com/charmbracelet/log v1.0.0 h1:HVVVMmfOorfj3BA9i8X8UL69Hoz9lI0PYwXfJvOdRc4=
github.com/charmbracelet/log v1.0.0/go.mod h1:uYgY3SmLpwJWxmlrPwXvzVYujxis1vAKRV/0VQB7yWA=
github.com/charmbracelet/x/ansi v0.11.6 h1:GhV21SiDz/45W9AnV2R61xZMRri5NlLnl6CVF7ihZW8=
github.com/charmbracelet/x/ansi v0.11.6/go.mod h1:2JNYLgQUsyqaiLovhU2Rv/pb8r6ydXKS3NIttu3VGZQ=
github.com/charmbracelet/x/cellbuf v0.0.15 h1:ur3pZy0o6z/R7EylET877CBxaiE1Sp1GMxoFPAIztPI=
github.com/charmbracelet/x/cellbuf v0.0.15/go.mod h1:J1YVbR7MUuEGIFPCaaZ96KDl5NoS0DAWkskup+mOY+Q=
github.com/charmbracelet/x/term v0.2.2 h1:xVRT/S2ZcKdhhOuSP4t5cLi5o+JxklsoEObBSgfgZRk=
github.com/charmbracelet/x/term v0.2.2/go.mod h1:kF8CY5RddLWrsgVwpw4kAa6TESp6EB5y3uxGLeCqzAI=
github.com/clipperhouse/displaywidth v0.11.0 h1:lBc6kY44VFw+TDx4I8opi/EtL9m20WSEFgwIwO+UVM8=
github.com/clipperhouse/displaywidth v0.11.0/go.mod h1:bkrFNkf81G8HyVqmKGxsPufD3JhNl3dSqnGhOoSD/o0=
github.com/clipperhouse/uax29/v2 v2.7.0 h1:+gs4oBZ2gPfVrKPthwbMzWZDaAFPGYK72F0NJv2v7Vk=
github.com/clipperhouse/uax29/v2 v2.7.0/go.mod h1:EFJ2TJMRUaplDxHKj1qAEhCtQPW2tJSwu5BF98AuoVM=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/go-logfmt/logfmt v0.6.1 h1:4hvbpePJKnIzH1B+8OR/JPbTx37NktoI9LE2QZBBkvE=
github.com/go-logfmt/logfmt v0.6.1/go.mod h1:EV2pOAQoZaT1ZXZbqDl5hrymndi4SY9ED9/z6CO0XAk=
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
github.com/lucasb-eyer/go-colorful v1.4.0 h1:UtrWVfLdarDgc44HcS7pYloGHJUjHV/4FwW4TvVgFr4=
github.com/lucasb-eyer/go-colorful v1.4.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
github.com/mattn/go-isatty v0.0.21 h1:xYae+lCNBP7QuW4PUnNG61ffM4hVIfm+zUzDuSzYLGs=
github.com/mattn/go-isatty v0.0.21/go.mod h1:ZXfXG4SQHsB/w3ZeOYbR0PrPwLy+n6xiMrJlRFqopa4=
github.com/mattn/go-runewidth v0.0.23 h1:7ykA0T0jkPpzSvMS5i9uoNn2Xy3R383f9HDx3RybWcw=
github.com/mattn/go-runewidth v0.0.23/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs=
github.com/muesli/termenv v0.16.0 h1:S5AlUN9dENB57rsbnkPyfdGuWIlkmzJjbFf0Tf5FWUc=
github.com/muesli/termenv v0.16.0/go.mod h1:ZRfOIKPFDYQoDFF4Olj7/QJbW60Ol/kL1pU3VfY/Cnk=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/sirupsen/logrus v1.9.4 h1:TsZE7l11zFCLZnZ+teH4Umoq5BhEIfIzfRDZ1Uzql2w= github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
github.com/sirupsen/logrus v1.9.4/go.mod h1:ftWc9WdOfJ0a92nsE2jF5u5ZwH8Bv2zdeOC42RjbV2g= github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
github.com/urfave/cli/v3 v3.6.2 h1:lQuqiPrZ1cIz8hz+HcrG0TNZFxU70dPZ3Yl+pSrH9A8= github.com/urfave/cli/v3 v3.8.0 h1:XqKPrm0q4P0q5JpoclYoCAv0/MIvH/jZ2umzuf8pNTI=
github.com/urfave/cli/v3 v3.6.2/go.mod h1:ysVLtOEmg2tOy6PknnYVhDoouyC/6N42TMeoMzskhso= github.com/urfave/cli/v3 v3.8.0/go.mod h1:ysVLtOEmg2tOy6PknnYVhDoouyC/6N42TMeoMzskhso=
golang.org/x/sys v0.41.0 h1:Ivj+2Cp/ylzLiEU89QhWblYnOE9zerudt9Ftecq2C6k= github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no=
golang.org/x/sys v0.41.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM=
golang.org/x/exp v0.0.0-20260410095643-746e56fc9e2f h1:W3F4c+6OLc6H2lb//N1q4WpJkhzJCK5J6kUi1NTVXfM=
golang.org/x/exp v0.0.0-20260410095643-746e56fc9e2f/go.mod h1:J1xhfL/vlindoeF/aINzNzt2Bket5bjo9sdOYzOsU80=
golang.org/x/sys v0.43.0 h1:Rlag2XtaFTxp19wS8MXlJwTvoh8ArU6ezoyFsMyCTNI=
golang.org/x/sys v0.43.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

View File

@@ -3,7 +3,7 @@ package udpproxy
import ( import (
"time" "time"
log "github.com/sirupsen/logrus" "github.com/charmbracelet/log"
) )
// Option is a functional option type that allows us to configure the Client. // Option is a functional option type that allows us to configure the Client.

View File

@@ -7,7 +7,7 @@ import (
"strings" "strings"
"time" "time"
log "github.com/sirupsen/logrus" "github.com/charmbracelet/log"
) )
type session struct { type session struct {

View File

@@ -6,7 +6,7 @@ import (
"net" "net"
"time" "time"
log "github.com/sirupsen/logrus" "github.com/charmbracelet/log"
) )
// Client represents a UDP proxy server that forwards rcon and query packets between clients and a target server. // Client represents a UDP proxy server that forwards rcon and query packets between clients and a target server.
@@ -87,7 +87,7 @@ func (c *Client) pruneSessions() {
for _, session := range c.sessionCache.data { for _, session := range c.sessionCache.data {
if time.Since(session.updateTime) > c.sessionTimeout { if time.Since(session.updateTime) > c.sessionTimeout {
c.sessionCache.delete(session.caddr.String()) c.sessionCache.delete(session.caddr.String())
log.Tracef("session for %s deleted", session.caddr) log.Debugf("session for %s deleted", session.caddr)
} }
} }
} }