Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] Vortex: A P2P File Transfer Protocol Based on TLV #3753

Open
gaius-qi opened this issue Jan 7, 2025 · 0 comments
Open

[RFC] Vortex: A P2P File Transfer Protocol Based on TLV #3753

gaius-qi opened this issue Jan 7, 2025 · 0 comments
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed
Milestone

Comments

@gaius-qi
Copy link
Member

gaius-qi commented Jan 7, 2025

Overview

Vortex is a peer-to-peer (P2P) file transfer protocol that utilizes the TLV (Tag-Length-Value) format for efficient and flexible data transmission. This protocol is designed to provide reliable and scalable file sharing capabilities.

Protocol Fields

  • Packet Identifier (8 bits): Uniquely identifies each packet.
  • Tag (T, 7 bits): Specifies the type of data in the value field.
  • Length (L, 30 bits): Indicates the length (in bytes) of the Value field, supporting up to 1GiB of data.
  • Value (V, variable length): The actual data, up to 1GiB.

Tag Definitions

Tag Name Description
0 Piece Identifier Composed of {Task ID}-{Piece ID}, where the Task ID is a 32-byte SHA-256 value and the Piece ID is a number.
1 Piece Content The content of a piece, with a maximum size of 1 GiB per piece.
2-126 Reserved Reserved for future use.
127 Error Error message.

Packet Format

Packet ID (8 bits) Tag (7 bits) Length (30 bits) Value (up to 1GiB)
8-bit 7-bit 30-bit variable
  • Packet ID: 8-bit unsigned integer.
  • Tag: 7-bit field describing the content type.
  • Length: 30-bit field specifying the size of the Value.
  • Value: Actual data, size determined by Length.

Behavior

  • Piece ID (Tag=0x00): Identifies the specific piece of the file.
  • Piece Content (Tag=0x01): Raw piece data or piece fragments.
  • Error (Tag=0x7F): Conveys error.
  • Reserved Tags: May be allocated for metadata, compression, encryption, or future protocol extensions.

Example

  • Packet ID: 0x12
  • Tag: 0x00 (piece content)
  • Length: 10 (indicating "HelloWorld" is 10 bytes)
  • Value: "HelloWorld"

Conclusion

This TLV-based protocol, with an 8-bit Packet Identifier and support for up to 1GiB in the Value field, offers flexibility, simplicity, and room for future enhancements. By reserving Tags, it is scalable for evolving P2P file transfer requirements.

References

@gaius-qi gaius-qi added enhancement New feature or request help wanted Extra attention is needed labels Jan 7, 2025
@gaius-qi gaius-qi added this to the v2.3.0 milestone Jan 7, 2025
@gaius-qi gaius-qi self-assigned this Jan 7, 2025
@gaius-qi gaius-qi changed the title [RFC] P2P File Transfer Protocol Based on TLV [RFC] DFTP(Dragonfly File Transfer Protocol) Based on TLV Jan 10, 2025
@gaius-qi gaius-qi changed the title [RFC] DFTP(Dragonfly File Transfer Protocol) Based on TLV [RFC] Vortex(P2P File Transfer Protocol) Based on TLV Jan 10, 2025
@gaius-qi gaius-qi changed the title [RFC] Vortex(P2P File Transfer Protocol) Based on TLV [RFC] Vortex: A P2P File Transfer Protocol Based on TLV Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant