Documentation ¶
Index ¶
- Constants
- func LoveHandler(h http.Handler) http.HandlerFunc
- func NewEncryptWrapperReader(plaintext io.Reader, armored, encrypt io.WriteCloser, buffer io.ReadWriter) io.ReadCloser
- func WrapIPFilter(next http.Handler, opts *IPFilterOptions) http.Handler
- type IPFilterOptions
- type OptionFn
- func ClamavHost(s string) OptionFn
- func CorsDomains(s string) OptionFn
- func EmailContact(emailContact string) OptionFn
- func EnableProfiler() OptionFn
- func FilterOptions(options IPFilterOptions) OptionFn
- func ForceHTTPS() OptionFn
- func GoogleAnalytics(gaKey string) OptionFn
- func HTTPAUTHFilterOptions(options IPFilterOptions) OptionFn
- func HTTPAuthCredentials(user string, pass string) OptionFn
- func HTTPAuthHtpasswd(htpasswdPath string) OptionFn
- func Listener(s string) OptionFn
- func LogFile(logger *log.Logger, s string) OptionFn
- func Logger(logger *log.Logger) OptionFn
- func MaxUploadSize(kbytes int64) OptionFn
- func PerformClamavPrescan(b bool) OptionFn
- func ProfileListener(s string) OptionFn
- func ProxyPath(s string) OptionFn
- func ProxyPort(s string) OptionFn
- func Purge(days, interval int) OptionFn
- func RandomTokenLength(length int) OptionFn
- func RateLimit(requests int) OptionFn
- func TLSConfig(cert, pk string) OptionFn
- func TLSListener(s string, t bool) OptionFn
- func TempPath(s string) OptionFn
- func UseLetsEncrypt(hosts []string) OptionFn
- func UseStorage(s storage.Storage) OptionFn
- func UserVoice(userVoiceKey string) OptionFn
- func VirustotalKey(s string) OptionFn
- func WebPath(s string) OptionFn
- type Server
Constants ¶
const (
// SYMBOLS characters used for short-urls
SYMBOLS = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
)
Variables ¶
This section is empty.
Functions ¶
func LoveHandler ¶
func LoveHandler(h http.Handler) http.HandlerFunc
LoveHandler Create a log handler for every request it receives.
func NewEncryptWrapperReader ¶
func NewEncryptWrapperReader(plaintext io.Reader, armored, encrypt io.WriteCloser, buffer io.ReadWriter) io.ReadCloser
func WrapIPFilter ¶
func WrapIPFilter(next http.Handler, opts *IPFilterOptions) http.Handler
WrapIPFilter is equivalent to newIPFilter(opts) then Wrap(next)
Types ¶
type IPFilterOptions ¶
type IPFilterOptions struct { //explicity allowed IPs AllowedIPs []string //explicity blocked IPs BlockedIPs []string //block by default (defaults to allow) BlockByDefault bool // TrustProxy enable check request IP from proxy TrustProxy bool Logger interface { Printf(format string, v ...interface{}) } }
IPFilterOptions for ipFilter. Allowed takes precedence over Blocked. IPs can be IPv4 or IPv6 and can optionally contain subnet masks (/24). Note however, determining if a given IP is included in a subnet requires a linear scan so is less performant than looking up single IPs.
This could be improved with some algorithmic magic.
type OptionFn ¶
type OptionFn func(*Server)
OptionFn is the option function type
func FilterOptions ¶
func FilterOptions(options IPFilterOptions) OptionFn
FilterOptions sets ip filtering
func HTTPAUTHFilterOptions ¶
func HTTPAUTHFilterOptions(options IPFilterOptions) OptionFn
HTTPAUTHFilterOptions sets basic http auth ips whitelist
func HTTPAuthCredentials ¶
HTTPAuthCredentials sets basic http auth credentials
func HTTPAuthHtpasswd ¶
HTTPAuthHtpasswd sets basic http auth htpasswd file
func PerformClamavPrescan ¶
PerformClamavPrescan enables clamav prescan on upload
func ProfileListener ¶
ProfileListener sets profile listener
func RandomTokenLength ¶
RandomTokenLength sets random token length
func TLSListener ¶
TLSListener sets TLS listener and option
func UseLetsEncrypt ¶
UseLetsEncrypt set letsencrypt usage
type Server ¶
type Server struct { VirusTotalKey string ClamAVDaemonHost string TLSListenerOnly bool CorsDomains string ListenerString string TLSListenerString string ProfileListenerString string Certificate string LetsEncryptCache string // contains filtered or unexported fields }
Server is the main application
func (*Server) RedirectHandler ¶
func (s *Server) RedirectHandler(h http.Handler) http.HandlerFunc
RedirectHandler handles redirect