Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

VPN RPC protocol does not have good support for version negotiation #15601

Assignees
deansheather
Labels
@deansheather

Description

@deansheather

Currently we're usingapiversion.APIVersion as our version type for the VPN RPC code. This code was originally written for client=>server version negotiation where only the server would support multiple versions, and the client would only send it's best version. In the VPN RPC protocol though, we would conceivably have situations where either side could be newer and so both sides should be able to negotiate the best version.

Proposal

Change ourcodervpn header/handshake format fromcodervpn <version> <role_enum> tocodervpn <role_enum> <versions...>.

The sent versions in the header would be each major version and the maximum supported minor version on that major version. E.g.codervpn manager 1.3 2.2 3.0 means:1.0, 1.1, 1.2, 1.3, 2.0, 2.1, 2.2, 3.0 are supported by this peer.

Once each end of the connection receives it's peer's handshake, it will compare the versions against each other to determine the highest mutual version. E.g. withcodervpn peer1 1.3 2.2 3.0 andcodervpn peer2 1.3 2.1 the version used will be2.1. If the peers decide that no version is shared, they should log/notify the user and close the connection.

We will most likely need a new type to store these API versions and compare them. Maybe it should go in theapiversion package but we rename the old type and give this type a different name.

The validation method should have a signature like so, returning the best major/minor combination or an error if the two peers are not compatible.

func (v Version) NegotiateVersion(peer Version) (int major, int minor, err error) {}

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp