evh

command
v0.0.0-...-56c27d6 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2017 License: MIT Imports: 27 Imported by: 0

Documentation

Overview

assetHandler controls all request for existing (already uploaded) file data. This either a listing of files in an upload session or the contents of a specific file.

This code is based on an example of streaming http client uploads I found here: https://github.com/gebi/go-fileupload-example/blob/master/main.go.

This code is the brains of the CLI version of this app. In a nutshell it builds the http connection and streams the files to the server. By streaming the files there is no maximum upload file size limit (unless the server doesn't have the necessary disk space).

Configuration is where we store the necessary information for this app to function properly. Most pieces of this app access the same instance of a Configuration object.

NOTE: If you want to add settings to the config file, you must add them here first and re-compile. Otherwise the app will crash when loading the config. Items missing from the config file are okay as they will just have their default (nil) values for their respective types.

The daemon is a set of go routines that run in endless loops and perform necessary back-end functions. These are spawned one by one in main.go.

Expirations are how the daemon knows when to clean up submitted files. These are set via the configuration file ONLY. Having muliple is recommended. There is no current way to set an expiration to unlimited (never delete).

Expirations are set in the format of <integer>:<suffix>. Current available suffixes are as follows:

m = minutes
h = hours
d = days
w = weeks

A default expiration is hard-coded for 1 day (1:d) and is used as the value when an unsupported expiration is set by the client.

NOTE: If you wand to add additional suffixes, please update the inline documentation in the sample-config.gcfg file.

The File object is used by the tracker for managing uploaded file properties.

These functions are http handlers too small to warrant their own file.

EVH is designed to be a single-use file transfer system. Its purpose is to replace aging methods of sharing files such as FTP. With the advent of services like DropBox, Box, Google Drive and the like, this type of service is becoming more commonplace EVH has some differentiating features that make it an especially good tool for corporations and/or home use.

EVH runs in two modes: server and client. Server hosts a web server interface for uploading and downloading files. The Client is for uploading only and runs in a terminal. This app is designed to run on all platforms that Go supports.

The Page object facilitates transfer of information into the HTML templating engine.

NOTE: As html templates expand, this object should house the necessary data objects.

The EvhRequest object is for managing upload/download session data. This data is not stored on disk. See Tracker for persistent data. All console logging is done through the EvhRequest object when possible.

The tracker is a json file that contains all info about a download session and the files it contains.

This data is persistent and stored on disk in an info.json file.

The TrackerOfTrackers object is used for viewing all of the available uploads currently in the system. This is currently only used by the /admin/ page.

uploadHandler controls showing the upload form and the processing of POSTed data. Files are saved automatically (via http package) to env(TMPDIR). Files are then moved to the specified assets directory.

NOTE: It is strongly recommended that you set the TMPDIR environment variable when you launch the evh service and set it to a directory on the same filesystem as assets. Moving the temp file to the permament location will be much faster this way.

These are a collection of smaller functions that don't really fit anywhere else.

Jump to

Keyboard shortcuts

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