2 Commits

Author SHA1 Message Date
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
2 changed files with 6 additions and 5 deletions

View File

@@ -62,7 +62,7 @@ Acceptable values are:
- `fatal`
- `panic`
If not set it will default to `info`.
It defaults to `info`.
---

View File

@@ -4,6 +4,7 @@ package main
import (
"context"
"fmt"
"net"
"os"
"runtime/debug"
"strconv"
@@ -158,18 +159,18 @@ func main() {
func launchProxy(cfg proxyConfig, errChan chan<- error) {
proxyPort, targetPort := cfg.portsMapping[0], cfg.portsMapping[1]
hostAddr := fmt.Sprintf("%s:%s", cfg.proxyHost, proxyPort)
proxyAddr := fmt.Sprintf("%s:%s", cfg.targetHost, targetPort)
proxyAddr := net.JoinHostPort(cfg.proxyHost, proxyPort)
targetAddr := net.JoinHostPort(cfg.targetHost, targetPort)
server, err := udpproxy.New(
hostAddr, proxyAddr,
proxyAddr, targetAddr,
udpproxy.WithSessionTimeout(time.Duration(cfg.sessionTimeout)*time.Minute))
if err != nil {
errChan <- fmt.Errorf("failed to create proxy: %w", err)
return
}
log.Infof("q3rcon-proxy initialised: [proxy] (%s) [target] (%s)", hostAddr, proxyAddr)
log.Infof("q3rcon-proxy initialised: [proxy] (%s) [target] (%s)", proxyAddr, targetAddr)
errChan <- server.ListenAndServe()
}