Refactor and create a start packet response so the client knows it can continue. Start to add command line/config options.

This commit is contained in:
2022-01-16 12:58:11 +10:30
parent e36d5573ff
commit 19ef8d65d5
7 changed files with 167 additions and 47 deletions

View File

@@ -182,15 +182,30 @@ const (
OperationTypeReceive
)
// PacketStart is sent from the client to the server at the beginning
// PacketStartRequest is sent from the client to the server at the beginning
// to authenticate and annonce the requested particular operation
type PacketStart struct {
type PacketStartRequest struct {
OperationType OperationTypeEnum
ClientName string
ProtocolVersion string
AuthToken string
}
type PacketStartResponseEnum byte
const (
// Client can connect
PacketStartResponseEnumOK PacketStartResponseEnum = iota
// Client using wrong protocol version
PacketStartResponseEnumWrongProtocol
// Client supplied bad auth token
PacketStartResponseEnumBadAuthToken
)
type PacketStartResponse struct {
Response PacketStartResponseEnum
}
type PacketSendDataStart struct {
Filename string
TotalSize uint32