Documentation
¶
Overview ¶
Code in this file is adapted directly from the Gin library (https://github.com/gin-gonic/gin) to overcome its limitations in resolving source IP addresses from headers
Index ¶
- Variables
- func AccessLogSkipPath(paths []string) serverOpt
- func Address(address string) serverOpt
- func AppName(appName string) debugAPIOpt
- func AppVersion(appVersion string) debugAPIOpt
- func ApplyDebugAPIProperties(properties *DebugAPIProperties) debugAPIOpt
- func ApplyProperties(properties *Properties) serverOpt
- func GetRealClientIP(c *gin.Context) string
- func GetSkipAccessLog(c *gin.Context) bool
- func HealthCheckHandler(handler HealthCheckHandlerFunc) debugAPIOpt
- func HealthCheckPath(path string) debugAPIOpt
- func MetricsPath(path string) debugAPIOpt
- func OnShutdown(callback func()) serverOpt
- func OnSignal(callback func(os.Signal), signals ...os.Signal) serverOpt
- func PprofPath(path string) debugAPIOpt
- func SetSkipAccessLog(c *gin.Context, b bool)
- func ShutdownSignals(signals ...os.Signal) serverOpt
- func ShutdownTimeout(timeout time.Duration) serverOpt
- func TrustedProxies(cidr ...string) serverOpt
- type AccessLogProperties
- type DebugAPI
- type DebugAPIHealthcheckProperties
- type DebugAPIMetricsProperties
- type DebugAPIPprofProperties
- type DebugAPIProperties
- type Endpoint
- type HealthCheckHandlerFunc
- type Properties
- type Server
Constants ¶
This section is empty.
Variables ¶
View Source
var DisableAccessLog = func(config *serverConfig) { config.disableAccessLog = true }
View Source
var DisableHealthCheck = func(debugAPI *DebugAPI) { debugAPI.enableHealthCheck = false }
View Source
var DisableMethodNotAllowedHandler = func(config *serverConfig) { config.disableMethodNotAllowedHandler = true }
View Source
var DisableMetrics = func(debugAPI *DebugAPI) { debugAPI.enableMetrics = false }
View Source
var DisableNotFoundHandler = func(config *serverConfig) { config.disableNotFoundHandler = true }
View Source
var DisablePprof = func(debugAPI *DebugAPI) { debugAPI.enablePprof = false }
View Source
var DisableRecovery = func(config *serverConfig) { config.disableRecovery = true }
Functions ¶
func AccessLogSkipPath ¶
func AccessLogSkipPath(paths []string) serverOpt
func AppVersion ¶
func AppVersion(appVersion string) debugAPIOpt
func ApplyDebugAPIProperties ¶
func ApplyDebugAPIProperties(properties *DebugAPIProperties) debugAPIOpt
func ApplyProperties ¶
func ApplyProperties(properties *Properties) serverOpt
func GetRealClientIP ¶ added in v1.0.3
func GetSkipAccessLog ¶ added in v1.0.4
func HealthCheckHandler ¶
func HealthCheckHandler(handler HealthCheckHandlerFunc) debugAPIOpt
func HealthCheckPath ¶ added in v1.0.3
func HealthCheckPath(path string) debugAPIOpt
func MetricsPath ¶ added in v1.0.3
func MetricsPath(path string) debugAPIOpt
func OnShutdown ¶
func OnShutdown(callback func()) serverOpt
func SetSkipAccessLog ¶ added in v1.0.4
func ShutdownSignals ¶ added in v1.0.3
func ShutdownTimeout ¶
func TrustedProxies ¶ added in v1.0.3
func TrustedProxies(cidr ...string) serverOpt
Types ¶
type AccessLogProperties ¶ added in v1.0.3
type AccessLogProperties struct {
Disable bool `json:"disable" yaml:"disable"`
SkipPaths []string `json:"skipPaths" yaml:"skipPaths"`
SuccessLevel string `json:"successLevel" yaml:"successLevel"`
UserErrorLevel string `json:"userErrorLevel" yaml:"userErrorLevel"`
ServerErrorLevel string `json:"serverErrorLevel" yaml:"serverErrorLevel"`
}
type DebugAPI ¶
type DebugAPI struct {
// contains filtered or unexported fields
}
func NewDebugAPI ¶
func NewDebugAPI(opts ...debugAPIOpt) *DebugAPI
type DebugAPIHealthcheckProperties ¶ added in v1.0.3
type DebugAPIMetricsProperties ¶ added in v1.0.3
type DebugAPIPprofProperties ¶ added in v1.0.3
type DebugAPIProperties ¶
type DebugAPIProperties struct {
Metrics *DebugAPIMetricsProperties `json:"metrics" yaml:"metrics"`
Pprof *DebugAPIPprofProperties `json:"pprof" yaml:"pprof"`
Healthcheck *DebugAPIHealthcheckProperties `json:"healthcheck" yaml:"healthcheck"`
AppName string `json:"appName" yaml:"appName"`
AppVersion string `json:"appVersion" yaml:"appVersion"`
}
type Endpoint ¶
func CreateEndpoint ¶
func CreateEndpoint(method, path string, handlers ...gin.HandlerFunc) Endpoint
type HealthCheckHandlerFunc ¶
type HealthCheckHandlerFunc = func() bool
type Properties ¶
type Properties struct {
Address string `json:"address" yaml:"address"`
ShutdownTimeout int64 `json:"shutdownTimeout" yaml:"shutdownTimeout"`
ShutdownSignals []string `json:"shutdownSignals" yaml:"shutdownSignals"`
DisableRecovery bool `json:"disableRecovery" yaml:"disableRecovery"`
DisableMethodNotAllowedHandler bool `json:"disableMethodNotAllowedHandler" yaml:"disableMethodNotAllowedHandler"`
DisableNotFoundHandler bool `json:"disableNotFoundHandler" yaml:"disableNotFoundHandler"`
TrustedProxies []string `json:"trustedProxies" yaml:"trustedProxies"`
AccessLog *AccessLogProperties `json:"accessLog" yaml:"accessLog"`
}
Click to show internal directories.
Click to hide internal directories.