gowebserver

package
v2.7.0 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2024 License: Apache-2.0 Imports: 54 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run()

Types

type Certificate

type Certificate struct {
	RootPrivateKeyFilePath   string        `yaml:"rootPrivateKey"`
	RootCertificateFilePath  string        `yaml:"rootPath"`
	PrivateKeyFilePath       string        `yaml:"privateKey"`
	CertificateFilePath      string        `yaml:"path"`
	CertificateHosts         string        `yaml:"hosts"`
	CertificateValidDuration time.Duration `yaml:"duration"`
	ForceOverwrite           bool          `yaml:"-"`
}

Certificate holds the certificate/private key configuration for HTTPS.

type Config

type Config struct {
	Verbose           bool    `yaml:"verbose"`
	Serve             []Serve `yaml:"serve"`
	ConfigurationFile string  `yaml:"-"`
	EnhancedList      bool    `yaml:"enhancedList"`
	Debug             bool    `yaml:"debug"`

	HTTP       HTTP       `yaml:"http"`
	HTTPS      HTTPS      `yaml:"https"`
	Monitoring Monitoring `yaml:"monitoring"`
	Upload     Serve      `yaml:"upload"`
}

Config is the root of the server configuration.

func Load

func Load() (*Config, error)

Load loads the configuration for the server.

func (*Config) String

func (c *Config) String() string

String returns a string representation of the config.

type CustomIndexReport

type CustomIndexReport struct {
	Root         string
	RootName     string
	DirEntries   []*DirEntry
	Images       []*DirEntry
	SortBy       string
	UseTimestamp bool
}

type DirEntry

type DirEntry struct {
	Name      string
	FullPath  string
	Size      uint64
	ModTime   time.Time
	IsDir     bool
	IsArchive bool
}

func (*DirEntry) String added in v2.6.0

func (d *DirEntry) String() string

type EntryList added in v2.6.0

type EntryList struct {
	Entries    map[string]*DirEntry
	EntryOrder []string
	// contains filtered or unexported fields
}

func (*EntryList) Len added in v2.6.0

func (l *EntryList) Len() int

func (*EntryList) Less added in v2.6.0

func (l *EntryList) Less(i, j int) bool

func (*EntryList) Swap added in v2.6.0

func (l *EntryList) Swap(i, j int)

type FileSystem

type FileSystem interface {
	fs.FS
	fs.StatFS
	fs.ReadFileFS
	fs.ReadDirFS
	io.Closer
	// contains filtered or unexported methods
}

type HTTP

type HTTP struct {
	Port int `yaml:"port"`
}

HTTP holds the configuration for HTTP serving.

type HTTPS

type HTTPS struct {
	Port        int         `yaml:"port"`
	Certificate Certificate `yaml:"certificate"`
}

HTTPS holds the configuration for HTTPS serving.

type Metrics

type Metrics struct {
	Enabled bool   `yaml:"enabled"`
	Path    string `yaml:"path"`
}

Metrics holds the metrics configuration.

type Monitoring

type Monitoring struct {
	DebugEndpoint string  `yaml:"debugEndpoint"`
	Metrics       Metrics `yaml:"metrics"`
	Trace         Trace   `yaml:"trace"`
}

Monitoring holds the monitoring configuration.

type Serve

type Serve struct {
	// Source location to serve.
	Source string `yaml:"source"`
	// Endpoint on the HTTP server to serve the content.
	Endpoint string `yaml:"endpoint"`
}

Serve maps the source to endpoint serving of content.

type Trace

type Trace struct {
	Enabled bool   `yaml:"enabled"`
	URI     string `yaml:"uri"`
}

Trace holds the trace configuration.

type WebServer

type WebServer interface {
	// Serve starts serving the HTTP/HTTPS server synchronously.
	Serve(func()) error
}

WebServer is a convenience wrapper for Go's HTTP/HTTPS Web serving API.

func New

func New(conf *Config) (WebServer, error)

Jump to

Keyboard shortcuts

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