Move protocol version to a const

This commit is contained in:
Justin Hawkins 2022-01-26 10:49:23 +10:30
parent 3baccaccac
commit 58a078b9f9
3 changed files with 5 additions and 3 deletions

View File

@ -183,7 +183,7 @@ func (c *Client) connectToServer(op secure.OperationTypeEnum, enc *gob.Encoder,
startPacket := secure.PacketStartRequest{ startPacket := secure.PacketStartRequest{
OperationType: op, OperationType: op,
ClientName: "", ClientName: "",
ProtocolVersion: "1.1", ProtocolVersion: ProtocolVersion,
AuthToken: c.authToken, AuthToken: c.authToken,
} }
err := enc.Encode(startPacket) err := enc.Encode(startPacket)

View File

@ -15,6 +15,8 @@ import (
var CurrentVersion = "v0.0.3" var CurrentVersion = "v0.0.3"
const ProtocolVersion = "1.1"
type PasteValue struct { type PasteValue struct {
PasteRequired bool PasteRequired bool
PasteNumber uint PasteNumber uint

View File

@ -105,10 +105,10 @@ func (s *Server) handleConnection(conn *net.TCPConn) {
return return
} }
// tell teh client the dealio // tell the client if the connection is ok.
startResponse := secure.PacketStartResponse{} startResponse := secure.PacketStartResponse{}
if start.ProtocolVersion != "1.1" { if start.ProtocolVersion != ProtocolVersion {
log.Errorf("bad protocol version") log.Errorf("bad protocol version")
startResponse.Response = secure.PacketStartResponseEnumWrongProtocol startResponse.Response = secure.PacketStartResponseEnumWrongProtocol
enc.Encode(startResponse) enc.Encode(startResponse)