Documentation
¶
Index ¶
- Variables
- func CheckDir(path string) error
- func CheckFile(path, name string) error
- func FindAndReplace(buf []byte, w io.Writer, fn func(string) string)
- func FindTemplates(buf []byte) (locs []int)
- func IsCached(f http.File) bool
- func NewTLSConfig(c TLSConfig) (*tls.Config, error)
- func ReplaceTemplates(src []byte, w io.Writer, locs []int, fn func(string) string)
- func SetDelims(start, end string)
- func SetMaxReplace(size int)
- func TLSVersion(v int) uint16
- func TLSVersionString(v uint16) string
- type AccessLog
- type CacheConfig
- type CacheRule
- type CachedFile
- func (f *CachedFile) Close() error
- func (f *CachedFile) Read(p []byte) (n int, err error)
- func (f *CachedFile) Readdir(count int) ([]os.FileInfo, error)
- func (f *CachedFile) ReplaceTemplates()
- func (f *CachedFile) Seek(offset int64, whence int) (int64, error)
- func (f *CachedFile) Stat() (os.FileInfo, error)
- type CachedFileInfo
- type SPAServer
- func (s *SPAServer) Address() string
- func (s *SPAServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (s *SPAServer) TLS() *tls.Config
- func (s *SPAServer) TryFile(r *http.Request, name string) (http.File, string, error)
- func (s *SPAServer) WriteHeaders(w http.ResponseWriter, r *http.Request, f http.File, start time.Time)
- type ServerConfig
- type TLSConfig
- type TemplateConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ERootCAFailed = errors.New("failed to add Root CAs to certificate pool")
)
View Source
var MaxFileSize int64 = 1 << 24 // 16 MB
Du to the use of bytes.Reader max file size will be limited to 2^32 and practically to a much lower user defined value. This helps prevent heap memory exhaustion.
Functions ¶
func FindTemplates ¶
func ReplaceTemplates ¶
func SetMaxReplace ¶
func SetMaxReplace(size int)
func TLSVersion ¶
func TLSVersionString ¶
Types ¶
type AccessLog ¶
type AccessLog struct { Time time.Time `json:"time"` RemoteAddr string `json:"remote_addr"` Host string `json:"host"` Request string `json:"request"` RequestMethod string `json:"request_method"` Referrer string `json:"referrer"` UserAgent string `json:"user_agent"` SslProtocol string `json:"ssl_protocol"` SslCipher string `json:"ssl_cipher"` Status int `json:"status"` BodyBytesSent int `json:"body_bytes_sent"` ContentType string `json:"content_type"` RequestId string `json:"request_id"` RequestTime float64 `json:"request_time"` }
type CacheConfig ¶
type CachedFile ¶
type CachedFile struct {
// contains filtered or unexported fields
}
func NewCachedBuffer ¶ added in v1.2.4
func NewCachedBuffer(name string, buf []byte) (*CachedFile, error)
func NewCachedFile ¶
func NewCachedFile(f http.File) (*CachedFile, error)
func (*CachedFile) Close ¶
func (f *CachedFile) Close() error
func (*CachedFile) ReplaceTemplates ¶
func (f *CachedFile) ReplaceTemplates()
type CachedFileInfo ¶
type CachedFileInfo struct {
// contains filtered or unexported fields
}
func NewCachedFileInfo ¶
func NewCachedFileInfo(fi os.FileInfo) *CachedFileInfo
func (*CachedFileInfo) IsDir ¶
func (i *CachedFileInfo) IsDir() bool
func (*CachedFileInfo) ModTime ¶
func (i *CachedFileInfo) ModTime() time.Time
func (*CachedFileInfo) Mode ¶
func (i *CachedFileInfo) Mode() os.FileMode
func (*CachedFileInfo) Name ¶
func (i *CachedFileInfo) Name() string
func (*CachedFileInfo) Size ¶
func (i *CachedFileInfo) Size() int64
func (*CachedFileInfo) Sys ¶
func (i *CachedFileInfo) Sys() interface{}
type SPAServer ¶
type SPAServer struct {
// contains filtered or unexported fields
}
func NewSPAServer ¶
type ServerConfig ¶
type ServerConfig struct { Addr string Port int Scheme string Host string Root string Base string Index string CspLog string Cache CacheConfig Tpl TemplateConfig }
type TLSConfig ¶
type TLSConfig struct { ServerName string `json:"server_name"` AllowInsecureCerts bool `json:"disable_tls"` TLSMinVersion int `json:"tls_min_version"` TLSMaxVersion int `json:"tls_max_version"` RootCaCerts []string `json:"tls_ca"` RootCaCertsFile string `json:"tls_ca_file"` Cert []string `json:"tls_cert"` CertFile string `json:"tls_cert_file"` Key []string `json:"tls_key"` KeyFile string `json:"tls_key_file"` }
Click to show internal directories.
Click to hide internal directories.