Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetTraceID ¶
GetTraceID returns a trace ID from the context.
Types ¶
type Config ¶
type Config struct { Proxy Proxy `yaml:"proxy"` Upstreams []Upstream `yaml:"upstreams"` LogLevel int `yaml:"log_level"` // Debug:-4 Info:0 Warn:4 Error:8 }
Config is a struct that represents the configuration of the proxy.
type ConfigLoadError ¶
type ConfigLoadError struct {
Err error
}
ConfigLoadError is an error that occurs when loading the configuration.
func (*ConfigLoadError) Error ¶
func (e *ConfigLoadError) Error() string
Error implements the error interface.
func (*ConfigLoadError) Unwrap ¶
func (e *ConfigLoadError) Unwrap() error
Unwrap implements the errors.Wrapper interface.
type Gondola ¶
type Gondola struct {
// contains filtered or unexported fields
}
Gondola is a proxy server.
type LogRoundTripper ¶
type LogRoundTripper struct {
// contains filtered or unexported fields
}
LogRoundTripper is a RoundTripper that logs the request and response.
func NewLogRoundTripper ¶
func NewLogRoundTripper(transport http.RoundTripper) *LogRoundTripper
NewLogRoundTripper returns a new LogRoundTripper.
type Proxy ¶
type Proxy struct { Port string `yaml:"port"` ReadHeaderTimeout int `yaml:"read_header_timeout"` ShutdownTimeout int `yaml:"shutdown_timeout"` TLSCertPath string `yaml:"tls_cert_path"` TLSKeyPath string `yaml:"tls_key_path"` StaticFiles []StaticFile `yaml:"static_files"` }
Proxy is a struct that represents the proxy server. Port is the port that the proxy server will listen on. ShutdownTimeout is the timeout in milliseconds for the proxy server to shutdown.
func (*Proxy) IsEnableTLS ¶
IsEnableTLS returns true if the proxy server is configured to use TLS.
type ProxyHandler ¶
type ProxyHandler struct {
// contains filtered or unexported fields
}
ProxyHandler is a http.Handler that proxies the request.
func (*ProxyHandler) Handler ¶
func (h *ProxyHandler) Handler(w http.ResponseWriter, r *http.Request)
Handler implements the http.Handler interface. It proxies the request.
type ProxyServerError ¶
type ProxyServerError struct {
Err error
}
ProxyServerError is an error that occurs when creating the server.
func (*ProxyServerError) Error ¶
func (e *ProxyServerError) Error() string
Error implements the error interface.
func (*ProxyServerError) Unwrap ¶
func (e *ProxyServerError) Unwrap() error
Unwrap implements the errors.Wrapper interface.
type Runner ¶
type Runner interface {
Run() error
}
Runner is an interface that defines the Run method.
type StaticFile ¶
StaticFile is a struct that represents a static file configuration.
type TraceIDHandler ¶
TraceIDHandler is a handler for trace ID.