# Function envelope::check_version

> Checks an inbound envelope's `v` against the connection's negotiated version.

`zaun_community_protocol::envelope::check_version` · Function

```rust
pub fn check_version(v: u16, negotiated: Option<u16>) -> Result<(), ErrorBody>
```

Checks an inbound envelope's `v` against the connection's negotiated version.

After negotiation `v` MUST equal it; otherwise `UNSUPPORTED_VERSION` with this crate's
range (`VersionRange::CURRENT`). Before negotiation any `v` passes: only `session.hello`
is answered then (anything else gets `HELLO_REQUIRED`), and its `versions` body decides.

# Errors
`UNSUPPORTED_VERSION` when `v` differs from the negotiated version.

[Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/envelope/version/fn.check_version.html)
