Documentation ¶
Overview ¶
Package http provides an HTTP interface allowing HTTP clients to interact with otf.
Index ¶
- Constants
- Variables
- func APIRouter(r *mux.Router) *mux.Router
- func Absolute(r *http.Request, path string) string
- func ExternalHost(r *http.Request) string
- func GetClientIP(r *http.Request) (string, error)
- func SanitizeAddress(address string) (string, error)
- func SanitizeHostname(hostname string) (string, error)
- type Server
- type ServerConfig
Constants ¶
const ( ModuleV1Prefix = "/v1/modules/" APIPrefixV2 = "/api/v2/" )
Variables ¶
var Encoder = schema.NewEncoder()
Encoder for encoding structs into queries: caches structs, and safe for sharing
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 SanitizeAddress ¶
SanitizeAddress ensures address is in format https://<host>:<port>
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 []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. |