aboutsummaryrefslogtreecommitdiffstats
Gomf usage
==========


Requirements
------------

	- Go1.6 or newer: https://golang.org/dl/

	- libmagic (on Debian/Ubuntu, `aptitude install libmagic-dev`)


Installation
------------

	- `go install git.clsr.net/gomf/gomf@latest`

	- Go to a directory where you want to have the website files and `git clone https://git.clsr.net/gomf/gomf-web`


Running
-------

	- Go to the directory with gomf-web

	- Run `gomf`

	Optional options for `gomf`:
		--http HOST:PORT
			serves HTTP on HOST:PORT
			example: --http example.com:80

		--https HOST:PORT
			serves HTTPS on HOST:PORT
			needs --cert and --key
			example: --https example.com:443 --cert ssl/cert.pem --key ssl/cert.key

		--cert PATH
			uses PATH as the TLS certificate for HTTPS

		--key PATH
			uses PATH as the TLS certificate key for HTTPS

		--redirect-https
			redirect HTTP request to HTTPS
			example: --redirect-https

		--hsts
			enables the HSTS header
			example: --hsts

		--name NAME
			sets website name to NAME
			example: --name Example

		--id-charset CHARSET
			sets the charset for file IDs in URLs to CHARSET; should only include URL-safe characters and no slashes
			example: --id-charset 0123456789

		--id-length LENGTH
			sets the length of file IDs in the URLs to LENGTH
			example: --id-length 5

		--max-size BYTES
			sets BYTES as the upload file size limit in bytes
			example (10 MiB): --max-size 10485760
			equivalent bash example: --max-size $((1024 * 1024 * 10))

		--filter-ext EXTS
			filter file extensions contained in the comma-separated list EXTS
			forbids extensions by default, unless --whitelist is in effect
			example: --filter-ext exe,dll,scr

		--filter-mime TYPES
			filter MIME types contained in the comma-separated list TYPES
			forbids types by default, unless --whitelist is in effect
			example: --filters-mime application/x-dosexec

		--whitelist
			treat file extension and MIME type filters as whitelists instead of blacklists
			forbids any upload whose type or extension is not on at least one of the filters
			example: --whitelist --filter-ext png,jpg,gif --filter-mime=

		--contact EMAIL
			sets the contact email address to EMAIL
			example: --contact contact@example.com

		--abuse EMAIL
			sets the abuse email address to EMAIL
			example: --abuse abuse@example.com

		--upload-host HOSTS
			all request to hosts in the comma-separated list HOSTS will serve files directly ($host/$file, while other hosts serve them on $host/u/$file)
			example: --upload-host u.example.com

		--upload-url URL
			uses URL as the prefix for address of uploaded files
			if missing, uses --upload-host, --https or --http to construct the URL
			example: --upload-url http://u.example.com/

		--csp CSP
			sets the Content-Security-Header to CSP; blank to disable the header
			example: --csp=

		--allow-html
			serve text/html and application/xhtml+xml files with their original filetype instead of text/plain
			example: --allow-html

		--cors
			sets the Access-Control-Allow-Origin header to * to allow CORS from any origin
			example: --cors

		--grill
			enables grills
			example: --grill

		--log
			enables logging of uploads
			example: --log --log-hash-salt 'somerandomsaltstringhere' --log-ip-hash --log-ua --log-referer --proxy-count 1

		--log-hash-salt SALT
			salt to use for hashed log entries
			if missing, no salt is used when hashing

		--log-ip
			enables logging of uploaders' IP addresses

		--log-ip-hash
			enables logging of hashes of uploaders' IP addresses
			used for privacy in order to avoid logging raw IP addresses while permitting comparison with other hashed entries

		--log-ua
			enables logging of uploaders' User-Agent headers

		--log-ua-hash
			enables logging of hashes of uploaders' User-Agent headers
			used for privacy in order to avoid logging raw user-agents while permitting comparison with other hashed entries

		--log-referer
			enables logging of uploaders' Referer headers

		--log-referer-hash
			enables logging of hashes of uploaders' Referer headers
			used for privacy in order to avoid logging raw referers while permitting comparison with other hashed entries

		--proxy-count COUNT
			the count of trusted reverse proxies (e.g. nginx) for logging IP addresses
			when set to a positive number N, takes the N-th most recent entry in X-Forwarded-For as the uploader's IP address for logging