diff options
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()) } |
