Documentation
¶
Index ¶
- Constants
- Variables
- func CompactHeadersMiddleware(next http.Handler, keys []string) http.Handler
- func EnvAltSvc(fallback string) string
- func EnvCert(fallback string) string
- func EnvHost(fallback string) string
- func EnvKey(fallback string) string
- func EnvPort(fallback string) string
- func EnvTCPPort(fallback string) string
- func EnvUDPPort(fallback string) string
- func EnvUI(fallback string) string
- func ExtractAltSvcEndpoints(h http.Header, protocolId string) []string
- func ExtractURLPort(u *url.URL) string
- func Formatter(writer io.Writer, params handlers.LogFormatterParams)
- func GinLoggerMiddleware(next http.Handler) http.Handler
- func Graft(base, alt string) string
- func HostNotFoundHandler() http.Handler
- func Hyperlink(name, url string) string
- func Jupyter(next http.Handler) http.Handler
- func LoggingMiddleware(next http.Handler) http.Handler
- func LookupEnv(key string) *string
- func LookupEnvPort(key string) *string
- func MaybeHyperlink(l string) string
- func ParseDomainCandidates(p string) []string
- func ReverseProxy(addr string) http.Handler
- func ToIdna(s string) string
- func WellKnownHealthMiddleware(next http.Handler) http.Handler
- type AugmentedHandler
- type GinLogger
- type LogFormatter
- type LogFormatterParams
- type LogWriter
- type NotFoundData
Constants ¶
const NOT_FOUND_TEMPLATE = `` /* 395-byte string literal not displayed */
const WellKnownHealthPath = "/.well-known/health"
Variables ¶
var GzipMiddleware = handlers.CompressHandler
Functions ¶
func CompactHeadersMiddleware ¶ added in v0.0.5
func EnvTCPPort ¶ added in v0.0.6
func EnvUDPPort ¶ added in v0.0.6
func ExtractAltSvcEndpoints ¶
ExtractAltSvcH3Endpoints reads Alt-Svc header returns a list of [host]:port endpoints
func ExtractURLPort ¶
ExtractURLPort returns the :port part from URL.Host (host[:port])
An empty string is returned if no port is found
func Formatter ¶ added in v0.0.7
func Formatter(writer io.Writer, params handlers.LogFormatterParams)
func HostNotFoundHandler ¶ added in v0.0.7
func Hyperlink ¶
Print Hyperlink via OSC 8 ansi sequence. The syntax is: 'OSC 8 ; params ; url ST text OSC 8 ; ; ST' for more info see https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda
func Jupyter ¶ added in v0.0.7
VSCode web edition makes cors request to /hub/api endpoint in order to determine if the backend api is a JupyterHub or JupyterLab/JupyterServer
If the Access-Control-Allow-Origin header is absent, the request will not make through. Here we add this header to make VSCode web happy
Tested on: - github.dev - vscode.dev - insider.vscode.dev
Needs to have Jupyter extension installed ¶
- /login is used to check if server has authentication enabled - /hub/api is used to check if server is JupyterHub
with authentication disabled, the /login endpoint won't respond with cors header so we need to manually add it to make vscode-web happy
jupyter server doesn't have the /hub/api endpoint, so the same hack needs to be applied
func LookupEnvPort ¶ added in v0.0.7
func MaybeHyperlink ¶
MaybeHyperlink turns input into ANSI hyperlink when stdin is a tty
func ParseDomainCandidates ¶ added in v0.0.8
ParseDomainCandidates splits a path string like /a/b/cd/😏 into a list of subdomains: [a, b, cd, 😏]
when result is empty, a random subdomain will be assigned by the server
func ReverseProxy ¶ added in v0.0.7
Types ¶
type AugmentedHandler ¶ added in v0.0.7
type GinLogger ¶ added in v0.1.0
type GinLogger struct {
// contains filtered or unexported fields
}
type LogFormatter ¶ added in v0.1.0
type LogFormatter func(params LogFormatterParams) string
type LogFormatterParams ¶ added in v0.1.0
type LogFormatterParams struct {
Request *http.Request
TimeStamp time.Time
StatusCode int
Latency time.Duration
ClientIP string
Host string
Method string
Proto string
Path string
ErrorMessage string
BodySize int
Keys map[string]interface{}
}
func (*LogFormatterParams) IsOutputColor ¶ added in v0.1.0
func (p *LogFormatterParams) IsOutputColor() bool
func (*LogFormatterParams) MethodColor ¶ added in v0.1.0
func (p *LogFormatterParams) MethodColor() string
func (*LogFormatterParams) ResetColor ¶ added in v0.1.0
func (p *LogFormatterParams) ResetColor() string
func (*LogFormatterParams) StatusCodeColor ¶ added in v0.1.0
func (p *LogFormatterParams) StatusCodeColor() string