mirror of
https://github.com/onyx-and-iris/q3rcon-proxy.git
synced 2026-04-19 21:43:30 +00:00
Compare commits
2 Commits
v1.8.0
...
225188bb70
| Author | SHA1 | Date | |
|---|---|---|---|
| 225188bb70 | |||
| 63cf99b217 |
@@ -62,7 +62,7 @@ Acceptable values are:
|
||||
- `fatal`
|
||||
- `panic`
|
||||
|
||||
If not set it will default to `info`.
|
||||
It defaults to `info`.
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user