Documentation ¶
Overview ¶
Package http provides an HTTP interface allowing HTTP clients to interact with otf.
Index ¶
- Variables
- func Absolute(r *http.Request, path string) string
- func ExternalHost(r *http.Request) string
- func GetClientIP(r *http.Request) (string, error)
- func HeadersFromContext(ctx context.Context) (http.Header, error)
- func ParseURL(address string) (*url.URL, error)
- func SanitizeHostname(hostname string) (string, error)
- type Server
- type ServerConfig
Constants ¶
This section is empty.
Variables ¶
var Encoder = schema.NewEncoder()
Encoder for encoding structs into queries: caches structs, and safe for sharing
var ErrParseURL = errors.New("url must begin with http:// or https:// and contain a hostname or ip address")
var InsecureTransport http.RoundTripper
Functions ¶
func Absolute ¶
Absolute returns an absolute URL for the given path. It uses the http request to determine the correct hostname and scheme to use. Handles situations where otf is sitting behind a reverse proxy, using the X-Forwarded-* headers the proxy sets.
func ExternalHost ¶
ExternalHost uses the incoming HTTP request to determine the host:port on which this server can be reached externally by clients and the internet.
func GetClientIP ¶
GetClientIP gets the client's IP address
func HeadersFromContext ¶ added in v0.2.0
func ParseURL ¶ added in v0.3.0
ParseURL parses address into a URL. The URL must be absolute with an http(s) scheme.
func SanitizeHostname ¶
SanitizeHostname ensures hostname is in the format <host>:<port>
Types ¶
type Server ¶
type Server struct { logr.Logger ServerConfig // contains filtered or unexported fields }
Server is the http server for OTF
type ServerConfig ¶
type ServerConfig struct { SSL bool CertFile, KeyFile string EnableRequestLogging bool DevMode bool Handlers []internal.Handlers // middleware to intercept requests, executed in the order given. Middleware []mux.MiddlewareFunc }
ServerConfig is the http server config
Directories ¶
Path | Synopsis |
---|---|
Package decode contains decoders for various HTTP artefacts
|
Package decode contains decoders for various HTTP artefacts |
Package html contains code relating specifically to the web UI.
|
Package html contains code relating specifically to the web UI. |
paths
Package paths provides rails-style path helpers for use with the web app.
|
Package paths provides rails-style path helpers for use with the web app. |