fs-over-http

command module
v0.0.0-...-ca4efd0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 10, 2023 License: ISC Imports: 19 Imported by: 0

README

fs-over-http

time tracker Docker Pulls Docker Build CodeFactor

A filesystem interface over http.

NOTE: I wrote this when I was still learning Go, and as such many improvements can be made. I have detailed what I would like to improve in the TODO section, with Partial Content, better error handling and response syntax being the main focus.

Contributing

Contributions to fix my code are welcome, as well as any improvements.

To build:

git clone git@github.com:5HT2/fs-over-http.git
cd fs-over-http
make

To run:

# I recommend using genpasswd https://gist.github.com/5HT2/30f98284e9f92e1b47b4df6e05a063fc
AUTH='some secure token'
echo "$AUTH" > token

# Change the port to whatever you'd like. 
# Change localhost to your public IP if you'd like.
./fs-over-http -addr=localhost:6060

Usage

Please see USAGE.md for examples of interacting with a fs-over-http server.

IPv6

IPv6 is supported, do note that you need to format the addr flag differently.

# Example IPv4
./fs-over-http -addr "10.0.1.1:6060"
# Example IPv6
./fs-over-http -addr "[2fb1:e540:13a7:3fa1:37bc:80b4:0b96:dbb8]:6060"
Production

I recommend using Caddy for automatic renewal + as a reverse proxy.

# Caddyfile example
i.l1v.in {
  header Server Caddy "Nintendo Wii"
  reverse_proxy localhost:6060
}

There is also a docker image available with the following command, or checkout the update.sh script for automatically updating a live docker image.

docker pull l1ving/fs-over-http:latest

TODO

  • Binary file support
  • Allow marking a folder as public
  • Custom shell for interacting
  • Partial Content support (docs)
  • Switch X-File-Content to using forms
    • eg: curl -X POST -H "Auth: $TOKEN" -d 'content=File content' localhost:6060/file.txt
    • Switch folder creation to same syntax with empty content
    • Read 512 bytes at a time like so.
  • Move error handling to ListenAndServe instead of individually sending the error
    • Switch to using X-Error-Message instead of printing it out, add a newline end of normal responses
  • Refactor use of JoinStr to fmt.Sprintf/Sprintln and +
  • Set ReadTimeout and WriteTimeout to prevent abuse
  • Add Docker image
    • Add CI service
  • Add Caddyfile example
    • Maybe with rate limit options and the such
    • Refactor docs about TLS
  • Encoding of uploading text-based files (eg the ● character)
  • Cleanup README
  • Fix scripts to use new format

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL