Documentation ¶
Overview ¶
Package http provides a static file server using embedded files in Go. This code is inspired by a pull request in the gin-contrib/static library. Reference: https://github.com/gin-contrib/static/pull/20/files
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Embed ¶
func Embed(targetPath string, placeholderValues map[string]string, regex bool) static.ServeFileSystem
Embed is a function that takes a target path as an argument and returns an implementation of the static.ServeFileSystem interface, which can be used with a Gin router to serve static files from the embedded file system. The embedded file system is defined by the "static" directory in the embedded files (using the `//go:embed` directive).
func Serv ¶
func Serv( addr string, cache *db.Cache, placeHolderValues map[string]string, chHandler NewChannelHandler, ) error
Serv starts an HTTP server at the specified address and handles incoming requests. It takes a callback function handleNewChannel which is called when a new WebSocket channel is established.
Types ¶
type Channel ¶
type Channel struct { Addr string // email address for this channel Conn net.Conn // ws connection Alive bool }
Channel represents a websocket channel for a specific email address.
type NewChannelHandler ¶
type NewChannelHandler func(channel *Channel)
Directories ¶
Path | Synopsis |
---|---|
Package rfs provides a custom http.FileSystem implementation for serving files with placeholders replaced by their corresponding values.
|
Package rfs provides a custom http.FileSystem implementation for serving files with placeholders replaced by their corresponding values. |