Documentation ¶
Index ¶
Constants ¶
View Source
const ( MimeTypeJS = mime.TypeApplicationJavascript MimeTypeCSS = mime.TypeTextCss MimeTypePNG = mime.TypeImagePng )
View Source
const ( FileExtJS = ".js" FileExtCSS = ".css" FileExtPNG = ".png" )
View Source
const ( ErrFileIsNotSet = "file is not set" ErrServerHostIsNotSet = "server host is not set" ErrServerPortIsNotSet = "server port is not set" ErrServerModeIsNotSet = "server mode is not set" ErrServerMode = "server mode error" ErrCertFileIsNotSet = "certificate file is not set" ErrKeyFileIsNotSet = "key file is not set" ErrHttpCacheControlMaxAge = "HTTP cache control max-age error" )
View Source
const ( ServerModeHttp = "HTTP" ServerModeIdHttp = 1 ServerModeHttps = "HTTPS" ServerModeIdHttps = 2 )
View Source
const (
ErrFileExtensionIsUnsupported = "unsupported file extension: %v"
)
View Source
const (
IndexHtmlPageFileName = "index.html"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CachedFile ¶
func NewCachedFile ¶
func NewCachedFile( fileName string, contents []byte, ) (cf *CachedFile, err error)
type Settings ¶
type Settings struct { // Path to the File with these Settings. File string // Server's Host Name. ServerHost string // Server's Listen Port. ServerPort uint16 // ServerMode is an HTTP mode selector. // Possible values are: HTTP and HTTPS. ServerModeStr string ServerModeId byte // Server's Certificate and Key. CertFile string KeyFile string // HttpCacheControlMaxAge is time in seconds for which this server's // response is fresh (valid). After this period clients will be refreshing // the stale content by re-requesting it from the server. HttpCacheControlMaxAge uint // Allowed Origin for cross-origin requests (CORS). AllowedOriginForCORS string // Names of files to be cached as pages. CachedPageFileNames []string }
Settings is Server's settings.
func NewSettingsFromFile ¶
Click to show internal directories.
Click to hide internal directories.