{"modulePath":"github.com/patrickhener/goshs","version":"v1.1.4","isLatest":true,"isStandardLibrary":false,"goos":"linux","goarch":"amd64","docs":"# package httpserver\n\nPackage httpserver will contain the main httpserver functionality of goshs\n\n## Functions\n\n```go\nfunc GenerateQRCode(uri string) string\n```\n\n```go\nfunc GenerateToken() string\n```\n\n```go\nfunc GetClientIP(r *http.Request, whitelist *Whitelist) string\n```\n\n## Types\n\n```go\ntype CustomMux struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewCustomMux() *CustomMux\n```\nNewCustomMux creates a new CustomMux instance.\n\n```go\nfunc (cm *CustomMux) Handle(pattern string, handler http.Handler)\n```\nHandle registers a new route with the CustomMux, applying all middleware in reverse order.\n\n```go\nfunc (cm *CustomMux) HandleFunc(pattern string, handler http.HandlerFunc)\n```\nHandleFunc registers a new route with the CustomMux, applying all middleware in reverse order.\n\n```go\nfunc (cm *CustomMux) ServeHTTP(w http.ResponseWriter, r *http.Request)\n```\nServeHTTP implements the http.Handler interface, allowing the CustomMux to be used as an HTTP server.\n\n```go\nfunc (cm *CustomMux) Use(mw Middleware)\n```\nUse simulates the behavior of http.ServeMux.Use, allowing you to add middleware to the CustomMux.\n\n```go\ntype DownloadEntry struct {\n\tDownloadURL string\n\tQRCode      template.URL\n}\n```\n\n```go\ntype FileServer struct {\n\tIP             string\n\tPort           int\n\tCLI            bool\n\tWebdavPort     int\n\tWebroot        string\n\tUploadFolder   string\n\tSSL            bool\n\tSelfSigned     bool\n\tLetsEncrypt    bool\n\tMyKey          string\n\tMyCert         string\n\tMyP12          string\n\tP12NoPass      bool\n\tUser           string\n\tPass           string\n\tCACert         string\n\tDropUser       string\n\tVersion        string\n\tFingerprint256 string\n\tFingerprint1   string\n\tUploadOnly     bool\n\tReadOnly       bool\n\tNoClipboard    bool\n\tNoDelete       bool\n\tSilent         bool\n\tInvisible      bool\n\tEmbedded       bool\n\tVerbose        bool\n\tWebhook        webhook.Webhook\n\tHub            *ws.Hub\n\tClipboard      *clipboard.Clipboard\n\tWhitelist      *Whitelist\n\tSharedLinks    map[string]SharedLink\n\tTunnel         bool\n}\n```\nFileServer holds the fileserver information\n\n```go\nfunc (files *FileServer) AddCertAuth(server *http.Server)\n```\n\n```go\nfunc (fs *FileServer) BasicAuthMiddleware(next http.Handler) http.Handler\n```\nBasicAuthMiddleware is a middleware to handle the basic auth\n\n```go\nfunc (fs *FileServer) CreateShareHandler(w http.ResponseWriter, r *http.Request)\n```\n\n```go\nfunc (fs *FileServer) DeleteShareHandler(w http.ResponseWriter, r *http.Request)\n```\n\n```go\nfunc (fs *FileServer) IPWhitelistMiddleware(next http.Handler) http.Handler\n```\nIPWhitelistMiddleware checks if the request's IP is in the whitelist\n\n```go\nfunc (fs *FileServer) InvisibleBasicAuthMiddleware(next http.Handler) http.Handler\n```\nInvisibleBasicAuthMiddleware is a middleware to handle basic auth in invisible mode\n\n```go\nfunc (files *FileServer) PrintEmbeddedFiles()\n```\n\n```go\nfunc (fs *FileServer) ServerHeaderMiddleware(next http.Handler) http.Handler\n```\nServerHeaderMiddleware sets a custom Server header for all responses\n\n```go\nfunc (fs *FileServer) SetupMux(mux *CustomMux, what string) string\n```\n\n```go\nfunc (fs *FileServer) ShareHandler(w http.ResponseWriter, r *http.Request)\n```\n\n```go\nfunc (fs *FileServer) Start(what string)\n```\nStart will start the file server\n\n```go\nfunc (fs *FileServer) StartListener(server *http.Server, what string, listener net.Listener)\n```\n\n```go\ntype Middleware func(http.Handler) http.Handler\n```\n\n```go\ntype SharedLink struct {\n\tFilePath        string\n\tIsDir           bool\n\tExpires         time.Time\n\tDownloadLimit   int\n\tDownloadEntries []DownloadEntry\n}\n```\n\n```go\ntype Whitelist struct {\n\tNetworks       []*net.IPNet\n\tTrustedProxies []*net.IPNet\n\tEnabled        bool\n}\n```\n\n```go\nfunc NewIPWhitelist(cidrs string, enabled bool, trustedProxies string) (*Whitelist, error)\n```\n\n```go\nfunc (w *Whitelist) IsAllowed(ipStr string) bool\n```\n\n```go\nfunc (w *Whitelist) IsTrustedProxy(ipStr string) bool\n```\n\n","path":"github.com/patrickhener/goshs/httpserver","name":"httpserver","synopsis":"Package httpserver will contain the main httpserver functionality of goshs","isRedistributable":true}
