Compare commits

...

5 Commits
v2.3.0 ... main

  1. 6
      README.md
  2. 2
      src/addr/local.go
  3. 2
      src/checksum/checksum.go
  4. 2
      src/checksum/checksum_test.go
  5. 2
      src/encryption/decrypt.go
  6. 2
      src/encryption/encrypt.go
  7. 2
      src/encryption/encryption_test.go
  8. 2
      src/encryption/key.go
  9. 2
      src/fsys/dir.go
  10. 2
      src/fsys/dir_test.go
  11. 4
      src/fsys/file.go
  12. 2
      src/fsys/file_test.go
  13. 2
      src/fsys/symlink.go
  14. 20
      src/fsys/symlink_test.go
  15. 4
      src/go.mod
  16. 20
      src/main.go
  17. 38
      src/node/node.go
  18. 2
      src/node/options.go
  19. 2
      src/protocol/constants.go
  20. 2
      src/protocol/headers.go
  21. 4
      src/protocol/packet.go
  22. 4
      src/protocol/packetConstruct.go
  23. 4
      src/protocol/packetDecode.go
  24. 2
      src/protocol/protocol_test.go
  25. 2
      src/protocol/recv.go
  26. 6
      src/protocol/send.go

6
README.md

@ -16,7 +16,7 @@ In order to transfer one file on one computer to another - they need to establis
In order to establish a connection - there needs to be a 1) sender (server) (the owner of the file), waiting for connections, and a 2) receiver (client), who will try to connect to a sender (server). If the requirements are met - client will connect to server and the packet exchange will begin.
The server and the client needs to communicate with packets according to certain rules, given by a [protocol](https://github.com/Unbewohnte/ftu/tree/main/src/protocol).
The server and the client needs to communicate with packets according to certain rules, given by a [protocol](http://unbewohnte.xyz:3000/Unbewohnte/ftu/src/branch/main/src/protocol).
The packet has its header and body. They are divided into several groups of use by headers, this way we can specify what kind of data is stored inside packet`s body and react accordingly.
@ -28,13 +28,13 @@ Thus, with a connection and a way of communication, the sender will send some pa
## ● Installation
### ● From release (Pre-compiled)
- Proceed to [releases page](https://github.com/Unbewohnte/ftu/releases)
- Proceed to [releases page](http://unbewohnte.xyz:3000/Unbewohnte/ftu/releases)
- Choose a version/architecture you have and download an archive
- Unpack an archive
- If on GNU/Linux - run `chmod +x install.sh && sudo ./install.sh`
### ● From source (Compile it yourself) (You need [Go](https://golang.org/dl/) and [git](https://git-scm.com/) to be installed on your machine)
- `git clone https://github.com/Unbewohnte/ftu.git`
- `git clone http://unbewohnte.xyz:3000/Unbewohnte/ftu`
- `cd` into the folder
- If on GNU/Linux - run `make && sudo make install` or `make && chmod +x install.sh && sudo ./install`
- else - cd into src/ folder and simply run `go build`; after that you`re free to put the binary wherever you desire

2
src/addr/local.go

@ -1,6 +1,6 @@
/*
ftu - file transferring utility.
Copyright (C) 2021,2022 Kasyanov Nikolay Alexeevich (Unbewohnte (https://unbewohnte.xyz/))
Copyright (C) 2021,2022 Kasyanov Nikolay Alexeyevich (Unbewohnte)
This file is a part of ftu

2
src/checksum/checksum.go

@ -1,6 +1,6 @@
/*
ftu - file transferring utility.
Copyright (C) 2021,2022 Kasyanov Nikolay Alexeevich (Unbewohnte (https://unbewohnte.xyz/))
Copyright (C) 2021,2022 Kasyanov Nikolay Alexeyevich (Unbewohnte)
This file is a part of ftu

2
src/checksum/checksum_test.go

@ -1,6 +1,6 @@
/*
ftu - file transferring utility.
Copyright (C) 2021,2022 Kasyanov Nikolay Alexeevich (Unbewohnte (https://unbewohnte.xyz/))
Copyright (C) 2021,2022 Kasyanov Nikolay Alexeyevich (Unbewohnte)
This file is a part of ftu

2
src/encryption/decrypt.go

@ -1,6 +1,6 @@
/*
ftu - file transferring utility.
Copyright (C) 2021,2022 Kasyanov Nikolay Alexeevich (Unbewohnte (https://unbewohnte.xyz/))
Copyright (C) 2021,2022 Kasyanov Nikolay Alexeyevich (Unbewohnte)
This file is a part of ftu

2
src/encryption/encrypt.go

@ -1,6 +1,6 @@
/*
ftu - file transferring utility.
Copyright (C) 2021,2022 Kasyanov Nikolay Alexeevich (Unbewohnte (https://unbewohnte.xyz/))
Copyright (C) 2021,2022 Kasyanov Nikolay Alexeyevich (Unbewohnte)
This file is a part of ftu

2
src/encryption/encryption_test.go

@ -1,6 +1,6 @@
/*
ftu - file transferring utility.
Copyright (C) 2021,2022 Kasyanov Nikolay Alexeevich (Unbewohnte (https://unbewohnte.xyz/))
Copyright (C) 2021,2022 Kasyanov Nikolay Alexeyevich (Unbewohnte)
This file is a part of ftu

2
src/encryption/key.go

@ -1,6 +1,6 @@
/*
ftu - file transferring utility.
Copyright (C) 2021,2022 Kasyanov Nikolay Alexeevich (Unbewohnte (https://unbewohnte.xyz/))
Copyright (C) 2021,2022 Kasyanov Nikolay Alexeyevich (Unbewohnte)
This file is a part of ftu

2
src/fsys/dir.go

@ -1,6 +1,6 @@
/*
ftu - file transferring utility.
Copyright (C) 2021,2022 Kasyanov Nikolay Alexeevich (Unbewohnte (https://unbewohnte.xyz/))
Copyright (C) 2021,2022 Kasyanov Nikolay Alexeyevich (Unbewohnte)
This file is a part of ftu

2
src/fsys/dir_test.go

@ -1,6 +1,6 @@
/*
ftu - file transferring utility.
Copyright (C) 2021,2022 Kasyanov Nikolay Alexeevich (Unbewohnte (https://unbewohnte.xyz/))
Copyright (C) 2021,2022 Kasyanov Nikolay Alexeyevich (Unbewohnte)
This file is a part of ftu

4
src/fsys/file.go

@ -1,6 +1,6 @@
/*
ftu - file transferring utility.
Copyright (C) 2021,2022 Kasyanov Nikolay Alexeevich (Unbewohnte (https://unbewohnte.xyz/))
Copyright (C) 2021,2022 Kasyanov Nikolay Alexeyevich (Unbewohnte)
This file is a part of ftu
@ -25,7 +25,7 @@ import (
"os"
"path/filepath"
"github.com/Unbewohnte/ftu/checksum"
"unbewohnte/ftu/checksum"
)
// A struct that represents the necessary file information for transportation through node

2
src/fsys/file_test.go

@ -1,6 +1,6 @@
/*
ftu - file transferring utility.
Copyright (C) 2021,2022 Kasyanov Nikolay Alexeevich (Unbewohnte (https://unbewohnte.xyz/))
Copyright (C) 2021,2022 Kasyanov Nikolay Alexeyevich (Unbewohnte)
This file is a part of ftu

2
src/fsys/symlink.go

@ -1,6 +1,6 @@
/*
ftu - file transferring utility.
Copyright (C) 2021,2022 Kasyanov Nikolay Alexeevich (Unbewohnte (https://unbewohnte.xyz/))
Copyright (C) 2021,2022 Kasyanov Nikolay Alexeyevich (Unbewohnte)
This file is a part of ftu

20
src/fsys/symlink_test.go

@ -1,3 +1,23 @@
/*
ftu - file transferring utility.
Copyright (C) 2021,2022 Kasyanov Nikolay Alexeyevich (Unbewohnte)
This file is a part of ftu
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package fsys
import (

4
src/go.mod

@ -1,3 +1,3 @@
module github.com/Unbewohnte/ftu
module unbewohnte/ftu
go 1.17
go 1.18

20
src/main.go

@ -1,6 +1,6 @@
/*
ftu - file transferring utility.
Copyright (C) 2021,2022 Kasyanov Nikolay Alexeevich (Unbewohnte (https://unbewohnte.xyz/))
Copyright (C) 2021,2022 Kasyanov Nikolay Alexeyevich (Unbewohnte (https://unbewohnte.xyz/))
This file is a part of ftu
@ -26,13 +26,13 @@ import (
"fmt"
"os"
"github.com/Unbewohnte/ftu/node"
"unbewohnte/ftu/node"
)
var (
VERSION string = "v2.3.0"
VERSION string = "v2.3.3"
versionInformation string = fmt.Sprintf("ftu %s\nfile transferring utility\n\nCopyright (C) 2021,2022 Kasyanov Nikolay Alexeevich (Unbewohnte (me@unbewohnte.xyz))\nThis program comes with ABSOLUTELY NO WARRANTY.\nThis is free software, and you are welcome to redistribute it under certain conditions; type \"ftu -l\" for details.\n", VERSION)
versionInformation string = fmt.Sprintf("ftu %s\nfile transferring utility\n\nCopyright (C) 2021,2022 Kasyanov Nikolay Alexeyevich (Unbewohnte)\nThis program comes with ABSOLUTELY NO WARRANTY.\nThis is free software, and you are welcome to redistribute it under certain conditions; type \"ftu -l\" for details.\n", VERSION)
//go:embed COPYING
licenseInformation string
@ -55,12 +55,12 @@ func init() {
fmt.Printf("ftu -[FLAGs]\n\n")
fmt.Printf("[FLAGs]\n\n")
fmt.Printf("| -p [Uinteger_here] for port\n")
fmt.Printf("| -r [true|false] for recursive sending of a directory\n")
fmt.Printf("| -p [integer] for port\n")
fmt.Printf("| -r [true|false] send recursively or not\n")
fmt.Printf("| -a [ip_address|domain_name] address to connect to (cannot be used with -s)\n")
fmt.Printf("| -d [path_to_directory] where the files will be downloaded to (cannot be used with -s)\n")
fmt.Printf("| -s [path_to_file|directory] to send it (cannot be used with -a)\n")
fmt.Printf("| -? [true|false] to turn on|off verbose output\n")
fmt.Printf("| -s [path_to_file|directory] send it (cannot be used with -a)\n")
fmt.Printf("| -? [true|false] turn on|off verbose output\n")
fmt.Printf("| -l print license information\n")
fmt.Printf("| -v print version information\n\n\n")
@ -98,12 +98,12 @@ func init() {
// validate flags
if *SEND == "" && *ADDRESS == "" {
fmt.Printf("Neither sending nor receiving flag was specified. Run ftu -h for help\n")
fmt.Printf("[ERROR] Neither sending nor receiving flag was specified. Run ftu -h for help\n")
os.Exit(-1)
}
if *SEND != "" && *ADDRESS != "" {
fmt.Printf("Can`t send and receive at the same time. Specify either -s or -a\n")
fmt.Printf("[ERROR] Can't send and receive at the same time. Specify either -s or -a\n")
os.Exit(-1)
}

38
src/node/node.go

@ -1,6 +1,6 @@
/*
ftu - file transferring utility.
Copyright (C) 2021,2022 Kasyanov Nikolay Alexeevich (Unbewohnte (https://unbewohnte.xyz/))
Copyright (C) 2021,2022 Kasyanov Nikolay Alexeyevich (Unbewohnte)
This file is a part of ftu
@ -32,11 +32,11 @@ import (
"fmt"
"github.com/Unbewohnte/ftu/addr"
"github.com/Unbewohnte/ftu/checksum"
"github.com/Unbewohnte/ftu/encryption"
"github.com/Unbewohnte/ftu/fsys"
"github.com/Unbewohnte/ftu/protocol"
"unbewohnte/ftu/addr"
"unbewohnte/ftu/checksum"
"unbewohnte/ftu/encryption"
"unbewohnte/ftu/fsys"
"unbewohnte/ftu/protocol"
)
// netInfowork specific settings
@ -325,7 +325,7 @@ func (node *Node) send() {
incomingPacket, ok := <-node.packetPipe
if !ok {
fmt.Printf("\nThe connection has been closed unexpectedly\n")
os.Exit(-1.)
os.Exit(-1)
}
// if encryption key is set - decrypt packet on the spot
@ -536,7 +536,7 @@ func (node *Node) receive() {
// connect to the sending node
err := node.connect()
if err != nil {
fmt.Printf("\n[ERROR] Could not connect to %s:%d", node.netInfo.ConnAddr, node.netInfo.Port)
fmt.Printf("\n[ERROR] Could not connect to %s:%d\n", node.netInfo.ConnAddr, node.netInfo.Port)
os.Exit(-1)
}
@ -774,10 +774,11 @@ func (node *Node) receive() {
// accepted
// append provided bytes to the file
err = acceptedFile.Open()
if err != nil {
panic(err)
if acceptedFile.Handler == nil {
err = acceptedFile.Open()
if err != nil {
panic(err)
}
}
fileBytes := fileBytesBuffer.Bytes()
@ -788,11 +789,6 @@ func (node *Node) receive() {
}
acceptedFile.SentBytes += uint64(wrote)
node.transferInfo.Receiving.ReceivedBytes += uint64(wrote)
err = acceptedFile.Close()
if err != nil {
panic(err)
}
}
}
@ -819,9 +815,11 @@ func (node *Node) receive() {
fmt.Printf("\n[File] fully received \"%s\" -- %d bytes", acceptedFile.Name, acceptedFile.Size)
}
err = acceptedFile.Open()
if err != nil {
panic(err)
if acceptedFile.Handler == nil {
err = acceptedFile.Open()
if err != nil {
panic(err)
}
}
// remove this file from the pool

2
src/node/options.go

@ -1,6 +1,6 @@
/*
ftu - file transferring utility.
Copyright (C) 2021,2022 Kasyanov Nikolay Alexeevich (Unbewohnte (https://unbewohnte.xyz/))
Copyright (C) 2021,2022 Kasyanov Nikolay Alexeyevich (Unbewohnte)
This file is a part of ftu

2
src/protocol/constants.go

@ -1,6 +1,6 @@
/*
ftu - file transferring utility.
Copyright (C) 2021,2022 Kasyanov Nikolay Alexeevich (Unbewohnte (https://unbewohnte.xyz/))
Copyright (C) 2021,2022 Kasyanov Nikolay Alexeyevich (Unbewohnte)
This file is a part of ftu

2
src/protocol/headers.go

@ -1,6 +1,6 @@
/*
ftu - file transferring utility.
Copyright (C) 2021,2022 Kasyanov Nikolay Alexeevich (Unbewohnte (https://unbewohnte.xyz/))
Copyright (C) 2021,2022 Kasyanov Nikolay Alexeyevich (Unbewohnte)
This file is a part of ftu

4
src/protocol/packet.go

@ -1,6 +1,6 @@
/*
ftu - file transferring utility.
Copyright (C) 2021,2022 Kasyanov Nikolay Alexeevich (Unbewohnte (https://unbewohnte.xyz/))
Copyright (C) 2021,2022 Kasyanov Nikolay Alexeyevich (Unbewohnte)
This file is a part of ftu
@ -31,7 +31,7 @@ import (
"fmt"
"strings"
"github.com/Unbewohnte/ftu/encryption"
"unbewohnte/ftu/encryption"
)
// Internal representation of packet before|after the transportation

4
src/protocol/packetConstruct.go

@ -1,6 +1,6 @@
/*
ftu - file transferring utility.
Copyright (C) 2021,2022 Kasyanov Nikolay Alexeevich (Unbewohnte (https://unbewohnte.xyz/))
Copyright (C) 2021,2022 Kasyanov Nikolay Alexeyevich (Unbewohnte)
This file is a part of ftu
@ -25,7 +25,7 @@ import (
"bytes"
"encoding/binary"
"github.com/Unbewohnte/ftu/fsys"
"unbewohnte/ftu/fsys"
)
// constructs a ready to send FILE packet

4
src/protocol/packetDecode.go

@ -1,6 +1,6 @@
/*
ftu - file transferring utility.
Copyright (C) 2021,2022 Kasyanov Nikolay Alexeevich (Unbewohnte (https://unbewohnte.xyz/))
Copyright (C) 2021,2022 Kasyanov Nikolay Alexeyevich (Unbewohnte)
This file is a part of ftu
@ -26,7 +26,7 @@ import (
"encoding/binary"
"fmt"
"github.com/Unbewohnte/ftu/fsys"
"unbewohnte/ftu/fsys"
)
var ErrorWrongPacket error = fmt.Errorf("wrong type of packet header")

2
src/protocol/protocol_test.go

@ -1,6 +1,6 @@
/*
ftu - file transferring utility.
Copyright (C) 2021,2022 Kasyanov Nikolay Alexeevich (Unbewohnte (https://unbewohnte.xyz/))
Copyright (C) 2021,2022 Kasyanov Nikolay Alexeyevich (Unbewohnte)
This file is a part of ftu

2
src/protocol/recv.go

@ -1,6 +1,6 @@
/*
ftu - file transferring utility.
Copyright (C) 2021,2022 Kasyanov Nikolay Alexeevich (Unbewohnte (https://unbewohnte.xyz/))
Copyright (C) 2021,2022 Kasyanov Nikolay Alexeyevich (Unbewohnte)
This file is a part of ftu

6
src/protocol/send.go

@ -1,6 +1,6 @@
/*
ftu - file transferring utility.
Copyright (C) 2021,2022 Kasyanov Nikolay Alexeevich (Unbewohnte (https://unbewohnte.xyz/))
Copyright (C) 2021,2022 Kasyanov Nikolay Alexeyevich (Unbewohnte)
This file is a part of ftu
@ -28,8 +28,8 @@ import (
"io"
"net"
"github.com/Unbewohnte/ftu/encryption"
"github.com/Unbewohnte/ftu/fsys"
"unbewohnte/ftu/encryption"
"unbewohnte/ftu/fsys"
)
// Sends given packet to connection.

Loading…
Cancel
Save