From 58a078b9f9c3826f07391e6defd2e85523d71c3b Mon Sep 17 00:00:00 2001 From: Justin Hawkins Date: Wed, 26 Jan 2022 10:49:23 +1030 Subject: [PATCH] Move protocol version to a const --- client.go | 2 +- main.go | 2 ++ server.go | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/client.go b/client.go index f432c50..349b5e9 100644 --- a/client.go +++ b/client.go @@ -183,7 +183,7 @@ func (c *Client) connectToServer(op secure.OperationTypeEnum, enc *gob.Encoder, startPacket := secure.PacketStartRequest{ OperationType: op, ClientName: "", - ProtocolVersion: "1.1", + ProtocolVersion: ProtocolVersion, AuthToken: c.authToken, } err := enc.Encode(startPacket) diff --git a/main.go b/main.go index 7aea834..e63f11f 100644 --- a/main.go +++ b/main.go @@ -15,6 +15,8 @@ import ( var CurrentVersion = "v0.0.3" +const ProtocolVersion = "1.1" + type PasteValue struct { PasteRequired bool PasteNumber uint diff --git a/server.go b/server.go index 11f3fd0..055c9b5 100644 --- a/server.go +++ b/server.go @@ -105,10 +105,10 @@ func (s *Server) handleConnection(conn *net.TCPConn) { return } - // tell teh client the dealio + // tell the client if the connection is ok. startResponse := secure.PacketStartResponse{} - if start.ProtocolVersion != "1.1" { + if start.ProtocolVersion != ProtocolVersion { log.Errorf("bad protocol version") startResponse.Response = secure.PacketStartResponseEnumWrongProtocol enc.Encode(startResponse)