Overview
TheYSviaversion module provides version adaptation functionality, allowing clients running different YSFlight versions to connect to the server by translating login packets to match the server’s expected version.
Functions
genViaVersion()
The player’s username (maximum 16 characters)
The target YSFlight version number to port to (e.g., 20181124 for YSFlight version 20181124)
A binary packet containing:
- Packet size (4 bytes): Always 24
- Packet type (4 bytes): Always 1 (LOGON)
- Username (16 bytes): ASCII-encoded username with null padding
- Version (4 bytes): The target version number
Packet Structure
The generated packet follows this binary format:- Size: Total payload size (24 bytes)
- Type: Packet type identifier (1 for LOGON)
- Username: 16-byte field with ASCII characters followed by null padding
- Version: Target version as unsigned 32-bit integer
Example
Usage in Proxy
Version adaptation is automatically applied when a player connects with a different version than the server expects:Configuration
Version adaptation is controlled by configuration variables:Notes
- Usernames longer than 16 characters will be truncated
- Usernames shorter than 16 characters are padded with null bytes (
\x00) - Each character is encoded as ASCII bytes
- The feature is experimental and may not support all version differences
- Players receive chat notifications when version porting is applied
- The original login packet is replaced with the generated version-adapted packet
Limitations
- Only modifies the login packet version field
- Does not translate protocol differences between versions
- May not work for significantly different YSFlight versions
- Experimental feature requiring testing with various version combinations