server

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2025 License: MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StaticFS embed.FS
View Source
var TemplatesFS embed.FS

Functions

func BuildURL added in v0.5.0

func BuildURL(r *http.Request, fragments ...string) *url.URL

func CalculateExpirationTime added in v0.10.0

func CalculateExpirationTime(hours int) string

CalculateExpirationTime calculates expiration time from current time plus hours

func CleanTempFile

func CleanTempFile(file *os.File)

func HashPassword added in v0.10.0

func HashPassword(password string) (string, error)

HashPassword creates an Argon2id hash of the password

func ParseExpirationHours added in v0.10.0

func ParseExpirationHours(expirationStr string) int

ParseExpirationHours parses expiration from form value and returns hours as int Returns default of 24 hours (1 day) if invalid or not provided

func SanitizeFilename

func SanitizeFilename(filename string) string

func ShowInline

func ShowInline(contentType string) bool

func SitePasswordMiddleware added in v0.7.0

func SitePasswordMiddleware(sitePasswordHash string) func(http.Handler) http.Handler

func ValidateContentType

func ValidateContentType(h http.Header) bool

func VerifyPassword added in v0.10.0

func VerifyPassword(password, hashedPassword string) (bool, error)

VerifyPassword verifies a password against its Argon2id hash

Types

type FileUploadResponse added in v0.10.0

type FileUploadResponse struct {
	FileId  string `json:"fileId"`
	FileUrl string `json:"fileUrl"`
}

type OptionFn

type OptionFn func(*Server)

func MaxRequests added in v0.5.0

func MaxRequests(requests int) OptionFn

func MaxUploadSize

func MaxUploadSize(megabytes int64) OptionFn

func Port

func Port(port int) OptionFn

func Sentry added in v0.7.0

func Sentry(sentryDSN, sentryEnvironment string, sentryTracesSampleRate float64) OptionFn

func SitePassword added in v0.7.0

func SitePassword(password string) OptionFn

func UseStorage

func UseStorage(storage storage.Storage) OptionFn

type Server

type Server struct {
	// contains filtered or unexported fields
}

func New

func New(options ...OptionFn) *Server

func (*Server) Run

func (s *Server) Run()

Jump to

Keyboard shortcuts

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