diff options
| author | Jeff Carr <[email protected]> | 2025-03-10 05:46:37 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-03-10 07:59:25 -0500 |
| commit | 2e10a2a0d96da83838dfab34015595b05dcc9058 (patch) | |
| tree | 567cc0e04ef9ae1ef9331074174703bf98de757e /main.go | |
| parent | 8fda4d7c870e36772f1ea0a62179e6e661131b21 (diff) | |
make an event log
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -11,9 +11,11 @@ import ( "os" "time" + "github.com/google/uuid" "go.wit.com/dev/alexflint/arg" "go.wit.com/gui" "go.wit.com/log" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" ) var VERSION string @@ -31,10 +33,12 @@ func main() { pp.WriteHelp(os.Stdout) os.Exit(0) } + log.Info("tmp hack", uuid.New().String()) me = new(gusconf) me.pollDelay = 10 * time.Second me.portmaps = ConfigLoad() + me.events = EventLoad() if me.portmaps == nil { me.portmaps = NewPortmaps() @@ -103,9 +107,18 @@ func handleConnection(clientConn net.Conn, where string) { return } defer targetConn.Close() - log.Printf("Connected to target server: %s where = %s\n", targetConn.RemoteAddr(), where) + // 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) + + e := new(Event) + e.Address = fmt.Sprintf("%s\n", clientConn.RemoteAddr()) + e.Where = where + e.Ctime = timestamppb.New(time.Now()) + + me.events.Append(e) // Bidirectional copy of data go io.Copy(targetConn, clientConn) // Client -> Target io.Copy(clientConn, targetConn) // Target -> Client + e.Etime = timestamppb.New(time.Now()) } |
