ISSUE-203

This commit is contained in:
Andrea Spacca
2019-05-11 14:42:59 +02:00
parent 5bbafa9ed7
commit cc401433a6
6745 changed files with 436 additions and 5109502 deletions

View File

@ -229,6 +229,12 @@ func HttpAuthCredentials(user string, pass string) OptionFn {
}
}
func FilterOptions(options IPFilterOptions) OptionFn {
return func(srvr *Server) {
srvr.ipFilterOptions = &options
}
}
type Server struct {
AuthUser string
AuthPass string
@ -247,6 +253,8 @@ type Server struct {
forceHTTPs bool
ipFilterOptions *IPFilterOptions
VirusTotalKey string
ClamAVDaemonHost string
@ -397,7 +405,17 @@ func (s *Server) Run() {
s.logger.Printf("Transfer.sh server started.\nusing temp folder: %s\nusing storage provider: %s", s.tempPath, s.storage.Type())
h := handlers.PanicHandler(handlers.LogHandler(LoveHandler(s.RedirectHandler(r)), handlers.NewLogOptions(s.logger.Printf, "_default_")), nil)
h := handlers.PanicHandler(
IPFilterHandler(
handlers.LogHandler(
LoveHandler(
s.RedirectHandler(r)),
handlers.NewLogOptions(s.logger.Printf, "_default_"),
),
s.ipFilterOptions,
),
nil,
)
if !s.TLSListenerOnly {
srvr := &http.Server{