Skip to content

Commit

Permalink
rename Q3RCON_STALE_SESSION_TIMEOUT to Q3RCON_SESSION_TIMEOUT
Browse files Browse the repository at this point in the history
  • Loading branch information
onyx-and-iris committed Oct 23, 2024
1 parent 82ca15f commit abc1ea9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cmd/q3rcon-proxy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,19 @@ func main() {
host = "0.0.0.0"
}

staleTimeout, err := getEnvInt("Q3RCON_STALE_SESSION_TIMEOUT")
sessionTimeout, err := getEnvInt("Q3RCON_SESSION_TIMEOUT")
if err != nil {
log.Fatalf("unable to parse Q3RCON_STALE_SESSION_TIMEOUT: %s", err.Error())
log.Fatalf("unable to parse Q3RCON_SESSION_TIMEOUT: %s", err.Error())
}

for _, proxy := range strings.Split(proxies, ";") {
go start(host, proxy, staleTimeout)
go start(host, proxy, sessionTimeout)
}

<-make(chan int)
}

func start(host, proxy string, staleTimeout int) {
func start(host, proxy string, sessionTimeout int) {
port, target := func() (string, string) {
x := strings.Split(proxy, ":")
return x[0], x[1]
Expand All @@ -52,7 +52,7 @@ func start(host, proxy string, staleTimeout int) {
c, err := udpproxy.New(
fmt.Sprintf("%s:%s", host, port),
fmt.Sprintf("127.0.0.1:%s", target),
udpproxy.WithStaleTimeout(time.Duration(staleTimeout)*time.Minute))
udpproxy.WithSessionTimeout(time.Duration(sessionTimeout)*time.Minute))
if err != nil {
log.Fatal(err)
}
Expand Down

0 comments on commit abc1ea9

Please sign in to comment.