Skip to content

TFTP Server, written in GoLang

Notifications You must be signed in to change notification settings

marvincolgin/tftp-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 

Repository files navigation

TFTP Server

Author:

Vin Colgin
mcolgin@gmail.com
https://github.com/marvincolgin
https://www.linkedin.com/in/mcolgin
https://marvincolgin.com

Scope

TFTP Server, written in Go, following the RFC-1370 specification.

TODO

There are several features that I'd like to continue building:

TEST: Incomplete Files should not Appear

  • Expire a Loaded File with TTL
  • Implement Timeouts
  • Tests with Lots of Clients TESTED with 5/10/20/50
  • Date/Time Stamps to Messages
  • Progress Indicators for Each Thread like NPM (Pie-in-the-Sky)
  • Speed-Up in allocation of byte buffers on WRITE

Limitations

  • Does not support later RFC specifications
  • Only octet aka "binary" mode is supported

Building

go get github.com/pborman/getopt
go build -o <path to resulting binary>

Parameters

Parameters follow posix standards using the Google getopt go package.

TABLE: Command-line Parameters

param desc default
help Help for Parameters
ip IP Address for Listener 127.0.0.1
port Port for Listener 69
threads Number of Threads 16
timeout Seconds for Timeout 1

Example

Help on Parameters

tftp --help

Start Listener on 192.168.0.1:6969

tftp --ip 192.168.0.1 --port 6969

Restrict Listener to 4 threads

tftp --threads 4

Sample Execution

~$ tftp

Listener: 127.0.0.1:69
Threads: 16 Starting...Done
Listener: Loop Running
READ: REQUEST file:[test-even.dat], client:[127.0.0.1:61073]
READ: SUCCESS file:[test-even.dat], client:[127.0.0.1:61073]
READ: REQUEST file:[test-odd.dat], client:[127.0.0.1:61075]
READ: SUCCESS file:[test-odd.dat], client:[127.0.0.1:61075]

Testing

Unit Test

cd src
go test

Integration Test

The following scripts will great two large files, one with a filesize that is even 512 blocks, the other is not. Compare the two MD5 hashs to confirm that the same file generated locally, sent to the tftp-server, then pulled back down is the same.

Test Single

Parameters

~$ ./test-entrypoint.sh <uniqe-id, required> <filesize, default 100000>

Example

~$ cd test
~$ ./test-entrypoint.sh 1 100000

OK #1: Perfect Match

Concurrency Testing

This testing script will spawn off X number of calls to "./test-entrypoint.sh"

Parameters

./test.sh <# of concurrent clients>

Example

~$ cd test
~$ ./test.sh 5
Spawning 1
Spawning 2
Spawning 3
Spawning 4
Spawning 5

OK #1: Perfect Match
OK #2: Perfect Match
OK #3: Perfect Match
OK #4: Perfect Match
OK #5: Perfect Match

Scripting

This software supports exit-codes for errors resulting in abnormal execution:

Code Desc
0 No Error
1 Listener Error: IP
2 Listener Error: Port

About

TFTP Server, written in GoLang

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published