Documentation
¶
Index ¶
Constants ¶
const ( CspReportToPath = "/api/report/csp-report-to" CspReportUriPath = "/api/report/csp-report-uri" IntegrityPath = "/api/report/integrity-endpoint" JsErrorPath = "/api/report/error" JsUnhandledRejectionPath = "/api/report/unhandled-rejection" )
The paths the browser, and a page's own JavaScript, post their reports to. They are under the API prefix a robots.txt keeps crawlers out of, none of them being a document.
const ApiContentSecurityPolicy = "default-src 'none'; base-uri 'none'; form-action 'none'; " +
"frame-ancestors 'none'; sandbox"
ApiContentSecurityPolicy is what a service that serves no documents answers with. A policy is worth as much to it as to one that does -- what differs is which policy.
- default-src 'none' permits no subresource of any kind, there being no document to load one.
- base-uri and form-action do not fall back to default-src, so they are said in full.
- frame-ancestors 'none' keeps the response out of a frame.
- sandbox, with no value, applies every restriction there is: a response a browser is made to render as a document -- by a content type it sniffed past, or by being navigated to directly -- gets an opaque origin and runs no script.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Service ¶
type Service struct {
Server *http.Server
Mux *motmedelMux.Mux
// contains filtered or unexported fields
}
Service is a mux and the server that serves it. The server is made for being stopped: asking it to stop lets the requests it is handling finish rather than ending them where they are.
func (*Service) Serve ¶
Serve serves until the process is asked to stop, and then lets the requests it is handling finish. A process is asked to stop whenever the instance it runs on is replaced or scaled in, and a request killed midway leaves whatever it was doing half done, so the signal is handled rather than left to end the process.
func (*Service) ServeContext ¶
ServeContext serves on the configured address until ctx is cancelled, and then lets the requests it is handling finish. Unlike Serve, it leaves what makes the service stop to the caller.
func (*Service) ServeListener ¶
ServeListener serves on listener until ctx is cancelled, and then lets the requests it is handling finish. It serves where the listener was obtained by other means than the service making it itself: a port picked by the operating system, a socket passed in by a supervisor.