diff --git a/client.go b/client.go index 3547374..f432c50 100644 --- a/client.go +++ b/client.go @@ -59,6 +59,7 @@ func (c *Client) Connect() error { } // now we expect to get stuff back until we don't + numFiles := 0 for { listPacket := secure.PacketListData{} err := dec.Decode(&listPacket) @@ -68,8 +69,10 @@ func (c *Client) Connect() error { if err != nil { panic(err) } - fmt.Printf("%d: %s (%s)\n", listPacket.Id, listPacket.Kind, humanize.Bytes(uint64(listPacket.FileSize))) + fmt.Printf("%d: %s (%s) - %s\n", listPacket.Id, listPacket.Kind, humanize.Bytes(uint64(listPacket.FileSize)), listPacket.Timestamp) + numFiles++ } + fmt.Printf("total: %d files\n", numFiles) conn.Close() log.Debugf("done listing") @@ -180,7 +183,7 @@ func (c *Client) connectToServer(op secure.OperationTypeEnum, enc *gob.Encoder, startPacket := secure.PacketStartRequest{ OperationType: op, ClientName: "", - ProtocolVersion: "1.0", + ProtocolVersion: "1.1", AuthToken: c.authToken, } err := enc.Encode(startPacket) diff --git a/secure/secure.go b/secure/secure.go index 86c8aa3..c7fbb15 100644 --- a/secure/secure.go +++ b/secure/secure.go @@ -7,6 +7,7 @@ import ( "errors" "io" "net" + "time" log "github.com/sirupsen/logrus" @@ -226,8 +227,9 @@ type PacketReceiveDataNext struct { } type PacketListData struct { - Id uint32 - Filename string - FileSize uint32 - Kind string + Id uint32 + Filename string + FileSize uint32 + Timestamp time.Time + Kind string } diff --git a/server.go b/server.go index 2198ac1..11f3fd0 100644 --- a/server.go +++ b/server.go @@ -108,7 +108,7 @@ func (s *Server) handleConnection(conn *net.TCPConn) { // tell teh client the dealio startResponse := secure.PacketStartResponse{} - if start.ProtocolVersion != "1.0" { + if start.ProtocolVersion != "1.1" { log.Errorf("bad protocol version") startResponse.Response = secure.PacketStartResponseEnumWrongProtocol enc.Encode(startResponse) @@ -307,6 +307,7 @@ func (s *Server) handleConnection(conn *net.TCPConn) { p.Kind = ngf.Kind p.Id = ngf.Id p.Filename = ngf.Filename + p.Timestamp = ngf.Timestamp enc.Encode(p) } log.Debugf("done sending list, closing connection")