serv

package
v0.0.0-...-adc3592 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2021 License: BSD-3-Clause Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const StaticUpdate time.Duration = time.Second * 10

The min duration between to check of static file

Variables

This section is empty.

Functions

func StaticLoad

func StaticLoad(p string, d []byte) func() []byte

Return a function never nil that return the content of the file p or the default content if error or p is empty.

func StaticLoadTempl

func StaticLoadTempl(p string, d *template.Template) func() *template.Template

Return a function never nil that return the content of the file p or the default content in error or if p is empty.

Types

type File

type File struct {
	IsDir   bool      `json:"isDir"`
	ModTime time.Time `json:"modTime"`
	Name    string    `json:"name"`
	Size    int64     `json:"size"`
	HSize   string    `json:"hSize"`
}

type S

type S struct {
	Config tls.Config
	// contains filtered or unexported fields
}

One serve.

func (*S) AddCert

func (s *S) AddCert(certFile, keyFile string) error

Add a new certificat to the Configuration.

func (*S) AddFile

func (s *S) AddFile(h, p, r string, static *Static) error

Add a file handler from file root r for the host h and the path p.

func (*S) AddHandler

func (s *S) AddHandler(h, p, t string, f http.Handler)

Add a hanlder for the host h, and with the path p. t is the name type of the handlern, it uses by the logger.

func (*S) AddRedirect

func (s *S) AddRedirect(h, p, to string, _ *Static) error

Add a retirect handler for the destination to.

func (*S) AddReverse

func (s *S) AddReverse(h, p, to string, static *Static) error

Add a reverso proxy to the host

func (*S) Serve

func (s *S) Serve(a, chalenge string)

Serve to redirect all hosts to https

func (*S) ServeTLS

func (s *S) ServeTLS(a string)

type Static

type Static struct {
	Index   func() *template.Template
	IndexJs func() []byte
	E404    func() []byte
	E502    func() []byte
}

All templates.

func NewStatic

func NewStatic() *Static

New Static with default value.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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