RejectHotlink

package
v0.7.10 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllowedReferer

func AllowedReferer(referer string, AllowedReferer []string) bool

func HasExtension

func HasExtension(path string, FileExtensions []string) bool

func IgnoreHost

func IgnoreHost(Host string, IgnoreHosts []string) bool

Types

type RejectHotlinkType

type RejectHotlinkType struct {
	Next           http.Handler //
	Paths          []string     // Usually for this paths include all, so just set to "/", or maybee /js/, /css/, /image/
	AllowedReferer []string     // www.example.com, example.com etc.
	FileExtensions []string     // Set of file extenstions to apply this to,  ".js", ".gif", ".jpg", ".png" - not normally to .html
	AlloweEmpty    string       //
	IgnoreHosts    []string     // These hosts are completely ignored by this -- i.e. "localhost", "127.0.0.1" - useful for testing
	ReturnError    string       // if false, "no" - then return a file - usually empty.
	LineNo         int          //
	// contains filtered or unexported fields
}

func NewRejectHotLinkServer

func NewRejectHotLinkServer(n http.Handler, p []string, all []string, ext []string) *RejectHotlinkType

func NewRejectPathServer(n http.Handler, p []string) *RejectHotlinkType {

func (*RejectHotlinkType) InitializeWithConfigData

func (hdlr *RejectHotlinkType) InitializeWithConfigData(next http.Handler, gCfg *cfg.ServerGlobalConfigType, serverName string, pNo, callNo int) (err error)

func (*RejectHotlinkType) PreValidate

func (hdlr *RejectHotlinkType) PreValidate(gCfg *cfg.ServerGlobalConfigType, cfgData map[string]interface{}, serverName string, pNo, callNo int) (err error)

func (*RejectHotlinkType) ServeHTTP

func (hdlr *RejectHotlinkType) ServeHTTP(www http.ResponseWriter, req *http.Request)

Jump to

Keyboard shortcuts

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