pkg

package
v0.0.0-...-63502d8 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2023 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckIfModifiedSince

func CheckIfModifiedSince(r *http.Request, modtime time.Time) bool

func CheckIfNoneMatch

func CheckIfNoneMatch(w http.ResponseWriter, r *http.Request) bool

func RenderBuffer

func RenderBuffer(title string, buf *bytes.Buffer) *bytes.Buffer

func SetContentAsHTML

func SetContentAsHTML(w http.ResponseWriter, charset string)

func SetEtag

func SetEtag(w http.ResponseWriter, etag string)

func SetLastModified

func SetLastModified(w http.ResponseWriter, modtime time.Time)

func TextFileServer

func TextFileServer(root TextFileSystem) http.Handler

func WriteNotModified

func WriteNotModified(w http.ResponseWriter)

Types

type FileType

type FileType int
const (
	Raw FileType = iota
	Txt
	Markdown
)

type PageData

type PageData struct {
	File     http.File
	Content  string
	Title    string
	Type     FileType
	CheckSum string
	Charset  string
}

func NewPageData

func NewPageData(file http.File) *PageData

func (*PageData) DetectCharset

func (pd *PageData) DetectCharset()

func (*PageData) Pretty

func (pd *PageData) Pretty()

func (*PageData) RenderPage

func (pd *PageData) RenderPage() *bytes.Reader

func (*PageData) SumContent

func (pd *PageData) SumContent()

type TextFile

type TextFile struct {
	http.File
}

func (TextFile) Readdir

func (f TextFile) Readdir(n int) (fis []fs.FileInfo, err error)

type TextFileHandler

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

func (*TextFileHandler) ServeHTTP

func (f *TextFileHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type TextFileSystem

type TextFileSystem struct {
	http.FileSystem
}

func (TextFileSystem) Open

func (fsys TextFileSystem) Open(name string) (http.File, error)

Jump to

Keyboard shortcuts

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