Home
Softono
goof

goof

Open source MIT Go
26
Stars
2
Forks
2
Issues
2
Watchers
5 years
Last Commit

About goof

goof is a lightweight command-line utility written in Golang that simplifies serving files and directories over a network. Modeled after the classic Python script woof, this tool addresses the difficulty of quickly sharing data across a local network without complex server configurations. It allows users to host single files or entire directories via a simple HTTP server. When a directory is selected, the tool automatically compresses its contents into a ZIP archive before delivery. Users can customize the service behavior by specifying the listening IP address, port number, and the number of times a file should be served before the process exits. Additionally, goof includes a client mode that ingests a URL argument to download and save remote files directly to the current working directory. A unique feature allows the application to serve its own binary to other machines, facilitating easy distribution and installation. The software is designed for speed and simplicity, requiring minimal system resources. It

Platforms

Web Self-hosted

Languages

Go

Links

goof

An implementation of Simon's wonderful woof Python script in Golang.

It's 2018 and serving a file over a network is not as easy as it should be.. The original script, as well as this Go command-line application try to provide a solution to this problem.

Usage

The binary can either serve a file/directory or itself to the specified IP and port. If a URL is provided, it will download from that URL.
The help text is pretty straightforward and conveys the main idea.

$ ./goof --help

Serves a single file <count> times via http on port <port>, on IP address <ip_addr>.
If a directory is specified, a .zip archive of that directory archive is served instead.

If started with an url as an argument, goof will act as a client, and will download and save the file in the current directory.

Usage of ./goof:
  -c int
        -c <count>.      How many times the file or directory will get served. (default 1)
  -i string
        -i <ip_addr>.    The address to serve the file or directory from. (default "127.0.0.1")
  -p string
        -p <port>.       The port to serve the file or directory from. (default "8080")
  -s    -s.              When specified, goof will distribute/serve itself

Can only serve single files/directories
$ ./goof myfile
Now serving on http://127.0.0.1:8080/myfile
# after file has been received on the other end
Exiting gracefully...

$ ./goof http://ipv4.download.thinkbroadband.com:8080/10MB.zip
Download Progress : 10.0 MiB complete

File downloaded in: 4.531359s

$ ./goof -s 
Now serving on http://127.0.0.1:8080/goof

Installation

The code was developed using go v1.9.7, but should run on any non-totally-antiquated go version.
You can clone the repository or download the goof.go source file and then go build it to get the executable binary, or go install goof.go to put in on your $GOPATH/bin.
To access the binary from anywhere in your system, you can add its location to $PATH.

ToDo List

  • Add test coverage
  • Make code more Golang-idiomatic
  • Document and port on other platforms.
  • Test throughput limits
  • Get feedback for future improvements

Feedback

It's my first Go code that I'm getting out in public, so criticism and improvement points are not only welcome, but encouraged. Feel free to open an issue, or send me an email!

                    __ 
                   / _|
  ____  ___   ___ | |_ 
 / _  |/ _ \ / _ \|  _|
| (_| | (_) | (_) | |  
 \__, |\___/ \___/|_|  
  __/ |                
 |___/