diff options
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -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()) |
