wsproxy now giving a more friendly error message when there is a protocol mismatch describing what the user should do.

This commit is contained in:
Erik Brakkee 2024-08-10 15:07:05 +02:00
parent 128be0ebb5
commit 4a3448dcc3

View File

@ -115,14 +115,15 @@ func main() {
if !raw {
channel := comms.NewGOBChannel(wsConn)
// receive protocol version
protocolVersion, err := comms.ReceiveWithTimeout[comms.ProtocolVersion](channel)
serverProtocol, err := comms.ReceiveWithTimeout[comms.ProtocolVersion](channel)
if err != nil {
log.Printf("Error receiving protocol version %v", err)
os.Exit(1)
}
if protocolVersion.Version != comms.PROTOCOL_VERSION {
if serverProtocol.Version != comms.PROTOCOL_VERSION {
log.Printf("Protocol version mismmatch: client %d, server %d",
comms.PROTOCOL_VERSION, protocolVersion.Version)
comms.PROTOCOL_VERSION, serverProtocol.Version)
log.Println("Download a compatible version of 'wsproxy' from the server to fix this issue. ")
os.Exit(1)
}
// receive confirmation about the agent id.