Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CountWriter ¶
CountWriter is an io.Writer that wraps an underlying writer. It is not safe for concurrent writing.
It counts the the total number of bytes written. Furthermore, once a single write fails, all future writes are silently suppressed.
func (CountWriter) State ¶
func (w CountWriter) State() (int, error)
State returns the first error that occurred within the writer and the total number of bytes written up to that point.
type Handler ¶
type Handler struct { repo.KeyRepository Formatters map[string]format.Formatter SuffixHTMLPath string // if non-empty, path to append to every html response IndexHTMLPath string // if non-empty, path to serve index.html from RobotsTXTPath string // if non-empty, path to serve robots.txt from }
Handler is the main akhttpd Server Handler. It implements http.Handler, see the ServerHTTP method.
func (*Handler) RegisterFormatter ¶
RegisterFormatter registers formatter as the formatter for the provided extension. When extension is empty, registers it for the path without an extension.
func (*Handler) ServeHTTP ¶
func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServerHTTP serves the main akhttpd server. It only answers to GET requests, all other requests are answered with Method Not Allowed. Whenever something goes wrong, responds with "Internal Server Error" and logs the error.
This method only responds successfully to a few URLS. All other URLs result in a HTTP 404 Response.
GET / GET /index.html
When IndexHTMLPath is not the empty string, sends back the file with Status HTTP 200. When IndexHTMLPath is empty, it sends back a default index.html file.
GET /${username} GET /${username}.${formatter}, GET /${username}/${formatter}
Fetches SSH Keys for the provided user and formats them with formatter. When formatter is omitted, uses the default formatter. If the formatter or user do not exist, returns HTTP 404.
GET /robots.txt
When RobotsTXTPath is not the empty string, sends back the file with Status HTTP 200. When RobotsTXTPath is empty, it sends back a default robots.txt file.
func (Handler) ServeUnderscore ¶
ServeUnderscore returns an http.Handler that serves the provided filesystem path under the prefix '_'.
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
akhttpd
Command akhttpd is the authorized_keys http daemon.
|
Command akhttpd is the authorized_keys http daemon. |
Package legal contains legal notices of packages used by akhttpd.
|
Package legal contains legal notices of packages used by akhttpd. |
pkg
|
|
count
Package count provides Writer
|
Package count provides Writer |
repo
Package repo provides KeyRepository
|
Package repo provides KeyRepository |