Move protocol version to a const
This commit is contained in:
parent
3baccaccac
commit
58a078b9f9
@ -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)
|
||||||
|
2
main.go
2
main.go
@ -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
|
||||||
|
@ -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)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user