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 7f6fa31c8a
commit 8f118a358c

View File

@ -115,14 +115,15 @@ func main() {
if !raw { if !raw {
channel := comms.NewGOBChannel(wsConn) channel := comms.NewGOBChannel(wsConn)
// receive protocol version // receive protocol version
protocolVersion, err := comms.ReceiveWithTimeout[comms.ProtocolVersion](channel) serverProtocol, err := comms.ReceiveWithTimeout[comms.ProtocolVersion](channel)
if err != nil { if err != nil {
log.Printf("Error receiving protocol version %v", err) log.Printf("Error receiving protocol version %v", err)
os.Exit(1) os.Exit(1)
} }
if protocolVersion.Version != comms.PROTOCOL_VERSION { if serverProtocol.Version != comms.PROTOCOL_VERSION {
log.Printf("Protocol version mismmatch: client %d, server %d", 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) os.Exit(1)
} }
// receive confirmation about the agent id. // receive confirmation about the agent id.