ws

package
v0.18.23 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2025 License: GPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrRemoteAddrParts       = "remote address error"
	ErrContentLengthMismatch = "content length mismatch"
)
View Source
const (
	HostPortDelimiter  = ":"
	GolangNetNetworkIP = "ip" // These constants should be exported by Golang ! Source: net/iprawsock.go.
)
View Source
const (
	ExtraPathSingleSlash     = `/`
	ExtraPathInstallerStatus = `/installer/status`
)
View Source
const (
	MimeTypeDefault = "application/octet-stream"
)
View Source
const (
	SymbolDot = '.'
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

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

func NewServer

func NewServer(settings *Settings) (srv *Server, err error)

func (*Server) Run

func (srv *Server) Run()

func (*Server) Stop

func (srv *Server) Stop() (err error)

type Settings

type Settings struct {
	DocumentRootPath   string   `json:"documentRootPath"`   // Path to the 'www' folder.
	FolderDefaultFiles []string `json:"folderDefaultFiles"` // List of default file names for a folder.

	ServerProtocol   string `json:"serverProtocol"`   // HTTP.
	GatewayInterface string `json:"gatewayInterface"` // CGI/1.1.
	ServerSoftware   string `json:"serverSoftware"`   // DemoGoServer/0.0.0.
	ServerName       string `json:"serverName"`       // Domain name: localhost.
	ServerHost       string `json:"serverHost"`       // IP address or domain name: localhost.
	ServerPort       string `json:"serverPort"`       // 8000.

	PhpServerNetwork  string   `json:"phpServerNetwork"`  // tcp.
	PhpServerHost     string   `json:"phpServerHost"`     // 127.0.0.1.
	PhpServerPort     string   `json:"phpServerPort"`     // 9000.
	PhpFileExtensions []string `json:"phpFileExtensions"` // "php", "phtml", ...

	// PHP is known to use an old-school variant of the 'Location' HTTP header.
	// FixRelativeRedirects, when enabled, fixed outdated URLs.
	// This feature is experimental and not safe.
	FixRelativeRedirects bool `json:"fixRelativeRedirects"`

	// IsCgiExtraPathEnabled flag enables support for CGI feature called "Extra
	// Path". This feature allows to make crazy-looking URLs which are
	// impossible to be parsed, something like the following:
	// http://some.machine/cgi-bin/display.pl/cgi/cgi_doc.txt
	IsCgiExtraPathEnabled bool `json:"isCgiExtraPathEnabled"`

	IsCachingEnabled           bool `json:"isCachingEnabled"`
	FileServerCacheSizeLimit   int  `json:"fileServerCacheSizeLimit"`
	FileServerCacheVolumeLimit int  `json:"fileServerCacheVolumeLimit"`
	FileServerCacheRecordTtl   uint `json:"fileServerCacheRecordTtl"`

	// This setting forbids redirecting phpBB requests using `/installer/status`
	// CGI extra path. Such requests are done directly.
	PhpbbDoNotRedirectExtraPathInstallerStatus bool `json:"phpbbDoNotRedirectExtraPathInstallerStatus"`
}

func NewSettings

func NewSettings(settingsFilePath string) (set *Settings, err error)

Jump to

Keyboard shortcuts

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