Yet Another File Transfer Protocol.

Overview

yaftp

Yet Another File Transfer Protocol.

Build & Run

$> cargo build --release

Features

  • C2C
  • Lightweight
  • Per something per session
  • High performence
  • Resume broken transfer

Protocol

Handshake Request

+----+----------+----------+
|VER | NMETHODS | METHODS  |
+----+----------+----------+
| 1  |    1     | 1 to 255 |
+----+----------+----------+

fisrt , client will send client version and support methods .

In yaftp version 1.0 , only support 6 methods.

+-----+-----------+
| CMD |   VALUE   |
+-----+-----------+
| ls  |   0x01    |
+-----+-----------+
| cp  |   0x02    |
+-----+-----------+
| mv  |   0x03    |
+-----+-----------+
| rm  |   0x04    |
+-----+-----------+
| put |   0x05    |
+-----+-----------+
| get |   0x06    |
+-----+-----------+

Handshake Reply

+----+----------+----------+
|VER | NMETHODS | METHODS  |
+----+----------+----------+
| 1  |    1     | 1 to 255 |
+----+----------+----------+

yaftp will reply server version and support methods.

Send Command

+-------+-------+
|  CMD  | NARG  |
+-------+-------+
| 1(u8) | 1(u8) |
+-------+-------+

client send command message to server , tell server command type , arguments count , and next argument size.

if command has two arguments and above, client will keep send argument message until last one.

+-----------------+---------------------+
| NEXT_ARG_SIZE   |         ARG         |
+-----------------+---------------------+
|      4(u32)     |       Variable      |
+-----------------+---------------------+

next , we need know every command argument and type.

Command Arguments

|---------+------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------|
| Command | NArg | Arg1                  | Arg2                  | Arg3                  | Arg4                  | Arg5                  |
|---------|------|-----------------------|-----------------------|-----------------------|-----------------------+-----------------------|
| ls      | 1    | path [string]         |                       |                       |                       |                       |
| cp      | 2    | source path [string]  | target path [string]  |                       |                       |                       |
| mv      | 2    | source path [string]  | target path [string]  |                       |                       |                       |
| rm      | 1    | path [string]         |                       |                       |                       |                       |
| rm      | 1    | path [string]         |                       |                       |                       |                       |
| put     | 4    | path [string]         | md5[u32]              | start_pos[u128]       | end_pos[u128]         | data[stream]          |
| get     | 4    | path [string]         | start_pos[u128]       | end_pos[u128]         |                       |                       |
|---------+------+-----------------------+-----------------------+-----------------------+-----------------------+-----------------------|

Command Reply

server received command arguments will check if valid and reply a code and arguments count.

+-----------+-----------+
|  RETCODE  |  NARG     |
+-----------+-----------+
|  1(u8)    |  1(u8)    |
+-----------+-----------+

if check vaild return 0x00 , else return 1~255.

+-----------+-----------------------------+
|  RETCODE  |  Reason                     |
+-----------+-----------------------------+
|  1        |  not support the version    |
+-----------+-----------------------------+
|  2        |  not support the command    |
+-----------+-----------------------------+
|  3        |  No permission              |
+-----------+-----------------------------+
|  4        |  source path not found      |
+-----------+-----------------------------+
|  5        |  start pos unvalid          |
+-----------+-----------------------------+
|  6        |  end pos unvalid            |
+-----------+-----------------------------+
|  7        |  check hash faild           |
+-----------+-----------------------------+

Note : The yaftp protocol is full-duplex, so depending on the command, the returned data may not be returned until the command parameters are completely sent. Therefore, the returned data needs to be processed asynchronously. For example: after the put method submits the first three parameters, it may directly return a non-zero retcode.

Command Reply Arguments

command reply arguments same with command arguments.

+-----------------+---------------------+
| NEXT_ARG_SIZE   |         ARG         |
+-----------------+---------------------+
|      4(u32)     |       Variable      |
+-----------------+---------------------+

ls - 0x01

|---------+-----------+-----------------------+-----------------------+
| Command | NArg      | Arg1                  |  ArgN                 |
|---------|-----------|-----------------------+-----------------------+
| ls      | 0 or N    | column(string)        | row(string)           |
|---------+-----------+-----------------------+-----------------------+

command ls will return a table like ls list. First argument is columns use | split.

others arguments is rows(use '|' split).

cp - 0x02

|---------+------+
| Command | NArg |
|---------|------|
| ls      | 0    |
|---------+------+

command cp just return a code tell client if success.

mv - 0x03

|---------+------+
| Command | NArg |
|---------|------|
| mv      | 0    |
|---------+------+

command mv just return a code tell client if success.

rm - 0x04

|---------+------+
| Command | NArg |
|---------|------|
| rm      | 0    |
|---------+------+

command rm just return a code tell client if success.

put - 0x05

|---------+-----------+-----------------------+
| Command | NArg      | Arg1                  |
|---------|-----------|-----------------------+
| put     | 0 or 1    | md5(u32)              |
|---------+-----------+-----------------------+

command put if retcode eq 0 will return a md5 hash after transfer finished.

get - 0x06

|---------+-----------+-----------------------+-----------------------|
| Command | NArg      | Arg1                  | Arg2                  |
|---------|-----------|-----------------------+-----------------------|
| get     | 0 or 2    | md5(u32)              | data[stream]          |
|---------+-----------+-----------------------+-----------------------|

command get if retcode eq 0 will return request file data md5 hash , then server will send client request data.

Finally

Server will close the session connection.

You might also like...
๐Ÿค– brwrs is a new protocol running over TCP/IP that is intended to be a suitable candidate for terminal-only servers

brwrs is a new protocol running over TCP/IP that is intended to be a suitable candidate for terminal-only servers (plain text data). That is, although it can be accessed from a browser, brwrs will not correctly interpret the browser's GET request.

A multi-protocol network relay

A multi-protocol network relay

A Rust library for parsing the SOME/IP network protocol (without payload interpretation).

someip_parse A Rust library for parsing the SOME/IP network protocol (without payload interpretation). Usage Add the following to your Cargo.toml: [de

The Graph is a protocol for building decentralized applications (dApps) quickly on Ethereum and IPFS using GraphQL.

Graph Node The Graph is a protocol for building decentralized applications (dApps) quickly on Ethereum and IPFS using GraphQL. Graph Node is an open s

๐Ÿค– Autonomous Twitter bot that posts analytics of the APYs available on the Solend Protocol.
๐Ÿค– Autonomous Twitter bot that posts analytics of the APYs available on the Solend Protocol.

Solend APY Twitter Bot Solana Ignition Hackathon 2021 View Demo ยท Report Bug ยท Request Feature Table of Contents About The Project Motivation Challeng

An End-to-End Privacy Computing Protocol on Layer 2

Eigen Network Eigen Network is an end-to-end privacy computation network for a better digital economy based on hybrid privacy computation protocols an

Shade Protocol is an array of connected privacy-preserving dApps built on Secret Network

Shade Protocol Core Contracts Contract Reference Description mint doc Handles asset burning and silk minting oracle doc Handles asset price queries tr

IDP2P is a peer-to-peer identity protocol which enables a controller to create, manage and share its own proofs as well as did documents
IDP2P is a peer-to-peer identity protocol which enables a controller to create, manage and share its own proofs as well as did documents

IDP2P Experimental, inspired by ipfs, did:peer and keri Background See also (related topics): Decentralized Identifiers (DIDs) Verifiable Credentials

Rustus - TUS protocol implementation in Rust.

Rustus Tus protocol implementation written in Rust. Features This implementation has several features to make usage as simple as possible. Rustus is r

Releases(v0.1.0)
Owner
b23r0
If the code cant run , thats not what i wrote.
b23r0
Transfer file in LAN is so easy

txrx Transfer file in LAN is so easy. Purpose Finding machine IP before executing netcat Multiplatform transfer is collapsing Usage Just run $ txrx fi

Konge 4 Sep 5, 2022
Quick Peer-To-Peer UDP file transfer

qft QFT is a small application for Quick (and really reliable) Peer-To-Peer UDP file transfer. If a friend sent you here... ...look at the "Releases"

Daniel H. 99 Jan 7, 2023
P2P File Transfer

P2P File Transfer Overview This is a small project to help solve a problem that should've been solved by now: file transfer. For in-person file transf

Saksham Mittal 2 Dec 15, 2022
Yet another youtube (and more) down loader

Yet another youtube (and more) down loader

Cthulhux 203 Dec 25, 2022
A minimalistic encryption protocol for rust async streams/packets, based on noise protocol and snow.

Snowstorm A minimalistic encryption protocol for rust async streams / packets, based on noise protocol and snow. Quickstart Snowstorm allows you to se

Black Binary 19 Nov 22, 2022
YAC (Yac is Another Chat) is an example of Chat using WebSocket.

YAC (Yac is Another Chat) is an example of Chat using WebSocket. Because often the example you find in internet are "not so production ready", I would like to try to implement something more robust.

Tommaso Allevi 8 May 24, 2022
Rust library that helps you change the domain of the link to another domain ๐Ÿฆ€๐Ÿ”

Rust library that helps you to change the domain of the link to another domain, the library helps with privacy. It can be used to change the domain of sites that do not care about privacy to another that does.

TheAwiteb 2 Mar 28, 2022
Easy protocol definitions in Rust

protocol Documentation Easy protocol definitions in Rust. This crate adds a custom derive that can be added to types, allowing structured data to be s

Dylan McKay 157 Dec 30, 2022
A Constrained Application Protocol(CoAP) library implemented in Rust.

coap-rs A fast and stable Constrained Application Protocol(CoAP) library implemented in Rust. Features: CoAP core protocol RFC 7252 CoAP Observe optio

Covertness 170 Dec 19, 2022
๐Ÿฅง Savoury implementation of the QUIC transport protocol and HTTP/3

quiche is an implementation of the QUIC transport protocol and HTTP/3 as specified by the IETF. It provides a low level API for processing QUIC packet

Cloudflare 7.1k Jan 8, 2023