Add file timestamps
This commit is contained in:
parent
1026cc5dd9
commit
80d23b514c
@ -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)
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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")
|
||||
|
Loading…
x
Reference in New Issue
Block a user