summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-03-10 06:53:30 -0500
committerJeff Carr <[email protected]>2025-03-10 07:59:25 -0500
commit22d07987494113dc85542b753c3ecc7e9db37511 (patch)
treea76bb478607a1edc58390497103a84312a7c6359 /main.go
parent2e10a2a0d96da83838dfab34015595b05dcc9058 (diff)
events table
Diffstat (limited to 'main.go')
-rw-r--r--main.go16
1 files changed, 13 insertions, 3 deletions
diff --git a/main.go b/main.go
index dab140e..916dc3a 100644
--- a/main.go
+++ b/main.go
@@ -67,6 +67,16 @@ func main() {
startHTTP()
os.Exit(0)
}
+
+ all := me.portmaps.All()
+ for all.Scan() {
+ pm := all.Next()
+ if !pm.Enabled {
+ continue
+ }
+ log.Info("portmap enabled for port", pm.Listen, "to", pm.Connect)
+ go gus3000(int(pm.Listen), pm.Connect)
+ }
// go NewWatchdog()
go startHTTP()
doGui()
@@ -92,11 +102,11 @@ func gus3000(port int, connect string) {
// log.Printf("Client connected: %s", clientConn.RemoteAddr())
// Handle the connection in a separate goroutine
- go handleConnection(clientConn, connect)
+ go handleConnection(clientConn, connect, port)
}
}
-func handleConnection(clientConn net.Conn, where string) {
+func handleConnection(clientConn net.Conn, where string, localport int) {
defer clientConn.Close()
// Connect to the target server
@@ -108,7 +118,7 @@ func handleConnection(clientConn net.Conn, where string) {
}
defer targetConn.Close()
// log.Printf("Connected to target server: %s where = %s\n", targetConn.RemoteAddr(), where)
- log.Printf("Connected to client: %s where = %s\n", clientConn.RemoteAddr(), where)
+ log.Printf("Connected on port %d from client: %s to where = %s\n", localport, clientConn.RemoteAddr(), where)
e := new(Event)
e.Address = fmt.Sprintf("%s\n", clientConn.RemoteAddr())