Terminalwire.Negotiator (Terminalwire v0.1.0)

Copy Markdown View Source

Pure handshake negotiation: given what the client speaks and what the server supports, decide the agreed protocol version and capability set. A function, not a state machine — identical across languages (conformance/vectors/negotiate). Mirrors Terminalwire::V2::Negotiator.

Summary

Functions

Returns {:welcome, protocol, capabilities} or {:incompatible, min, max}.

Functions

negotiate(client_protocol, client_capabilities, server_min, server_max, server_capabilities)

Returns {:welcome, protocol, capabilities} or {:incompatible, min, max}.

capabilities is the intersection, preserving the client's advertised order.