Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
New constructs a new file-exchange handler.
It has the following routes: a) GET / - serve upload page c) POST / - handle upload, always sets X-Upload-Hash response header b) GET /{hash} - serve file
If cfg.AuthRead is provided, it demands HTTP Basic auth for read operations (GET-s). If cfg.AuthWrite is provided, it demands HTTP Basic auth for write operations (POST-s).
If cfg.Oneshot is enabled, the handler works in oneshot mode: uploaded file is removed after first successful (2xx) download. Note: this is protected only with cfg.AuthRead.
If cfg.Aliasing is enabled, files can be downloaded like /{hash}.{ext} or /{hash}/{filename}.
Types ¶
type Config ¶ added in v0.0.6
type Config struct { AuthRead map[string]string `split_words:"true"` AuthWrite map[string]string `split_words:"true"` Oneshot bool `default:"false"` // rm file after first successful serve Aliasing bool `default:"false"` // allow to alias file/ext on download (freeform) }
Configig defines a file-exchange handler config.