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`
|
- `fatal`
|
||||||
- `panic`
|
- `panic`
|
||||||
|
|
||||||
If not set it will default to `info`.
|
It defaults to `info`.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"net"
|
||||||
"os"
|
"os"
|
||||||
"runtime/debug"
|
"runtime/debug"
|
||||||
"strconv"
|
"strconv"
|
||||||
@@ -158,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.Infof("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()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user