FtGo is server and client application designed for secure file transfer. It utilizes a custom protocol that ensures end-to-end encryption for data transmission. This repository contains the file transfer protocol, server application, and client application.
- Custom Protocol: FtGo uses a custom file transfer protocol designed for secure and efficient data transmission.
- End-to-End Encryption: All data transferred between the server and client is encrypted, ensuring privacy and security.
- Server Application: The server application allows users to host their own file transfer servers.
- Client Application: The client application enables users to connect to servers and transfer files securely.
Command | Description |
---|---|
ftgo server add -SERVERNAME -SERVERADDRESS |
Adds server to list for using again |
ftgo server list |
Lists all servers saved to client |
ftgo server rm -SERVERNAME |
Removes server from client |
ftgo package new -PACKAGENAME |
Creates new package |
ftgo package add -PACKAGENAME -PATH |
Adds file or directory to package |
ftgo package rm -PACKAGENAME |
Removes package |
ftgo package rm -PACKAGENAME -FILE/DIRECTORY |
Removes file or directory from package |
ftgo package list -PACKAGENAME |
Adds file or directory to package |
ftgo package push -PACKAGENAME [-SERVERNAME or -SERVERADDRESS] |
Pushes package to server |
ftgo push -FILE/DIRECTORY [-SERVERNAME or -SERVERADDRESS] |
Pushes file or directory to server |
ftgo server connect [-SERVERNAME or -SERVERADDRESS] |
Connects to server and lists all files and directories |
ftgo dir set -PATH |
Sets the default directory for pulling |
ftgo dir get |
Gets the default directory for pulling |
Command | Description |
---|---|
ftgosv serve |
Starts server daemon for serving |
ftgosv status |
Lists all server information |
ftgosv port add -PORT |
Adds port for listening |
ftgosv port rm -PORT |
Removes port |
ftgosv port list |
Lists all ports |
ftgosv dir set -PATH |
Sets the serving directory |
ftgosv dir get |
Gets the serving directory |
ftgosv perm write set -PERM |
Sets the permission for write operations |
ftgosv perm write get |
Gets the permission for write operations |
ftgosv perm read set -PERM |
Sets the permission for read operations |
ftgosv perm read get |
Gets the permission for read operations |
ftgosv perm list -PERM |
Lists all usable permissions |
ftgosv perm ip add -IP |
Adds IP for IP-based permission |
ftgosv perm ip rm -IP |
Removes IP from allowed IP list |
ftgosv perm ip list |
Lists allowed IPs |
ftgosv perm password set -PASSWORD |
Sets password for password authentication permission |
The protocol API facilitates bidirectional communication between client and server, both using the same API. To establish a connection, the CreateConnection
function requires a net.Conn
interface. For client-to-server connection, we use net.Dial
, while for server-side, we use net.Listen
. Once connected, both can utilize the same methods.
However, there are some fundamental rules:
-
Each message between client and server is preceded by 4 bytes. The first 3 bytes are zeroes, and the 4th byte represents the message itself. You can find message definitions in
common/messages.go
. These messages are integers ranging from 0 to 127. -
It's mandatory to add a message if the protocol function doesn't handle it for us.
-
After establishing a connection, we use the
Read
method to wait for data. Following this, we must utilize eitherGetMessage
orIgnoreMessage
method to extract the message from the buffer. Then, we can retrieve the desired data using methods likeGetString
,GetJson
, etc. -
For sending data, we have two types of methods for each data type (For example: JSON or raw string):
- One doesn't require a message as a parameter and sends the data along with a success message.
- The other type wants a message parameter in the function body.
By adhering to these guidelines, we ensure smooth communication between the client and server using the protocol.
// Creating connection object for using protocol
conn := common.CreateConnection(n)
// We are sending "LIST DIRECTORIES/FILES inside /hello" message to server
conn.SendMessageWithData(common.CListDirs, "/hello")
// Creating a message for holding the response
var m common.Message
// Firstly, we are reading the response from the server. After that, we are extracting the message to our message holder.
conn.Read().GetMessage(&m)
// Creating a file info slice
var infos []common.FileInfo
if m == common.Success {
// We don't need to authenticate because message is success, so let's directly extract JSON.
conn.GetJson(&infos)
// We can use our file info JSON.
// ...
} else if m == common.SAuthenticate {
// Server wants authentication so we are sending our password
conn.SendString("testpassword") // This method adds a success message for us; we don't need to pass any message.
// Reading the response from the server
conn.Read().GetMessage(&m)
if m == common.Success {
// Message is success; we successfully authenticated, let's get our file infos.
conn.GetJson(&infos)
// We can use our file info JSON.
// ...
} else { // We can look for other message cases as well. But we are skipping in tutorial
// Message is not success; we couldn't authenticate.
// ...
}
}
FTGO is an open-source project designed for fast and secure file transfer. It utilizes a custom security layer with TCP rather than TLS for encryption, providing end-to-end encryption for file transfers. However, it's important to note that while FTGO strives to ensure security, as an open-source project, there's no absolute guarantee of security. While FTGO endeavors to provide a secure file transfer solution, users should exercise caution when transferring sensitive or important files. If security is a primary concern, it's advisable to explore alternative solutions or consult with security experts.
This project is licensed under the GNU General Public License v3.0, which means that everyone is free to view, modify, distribute, and use the software for non-commercial purposes. Any derivative works must also be licensed under the GNU GPL. For more details, please refer to the LICENSE file.