Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Auth ¶
type Auth struct {
Type string `config:"type"`
// type: basic
Username string `config:"username"`
Password string `config:"password"`
// type: bearer
Token string `config:"token"`
// type: jwt
Secret string `config:"secret"`
// type: oauth2
Provider string `config:"provider"`
ClientID string `config:"client_id"`
ClientSecret string `config:"client_secret"`
RedirectURL string `config:"redirect_url"`
Scopes []string `config:"scopes"`
}
type HealthCheck ¶
type HealthCheck struct {
Enable bool `config:"enable"`
//
Method string `config:"method,default=GET"`
Path string `config:"path,default=/health"`
Status []int64 `config:"status,default=[200]"`
// Interval is the health check interval in seconds
Interval int64 `config:"interval"`
// Timeout is the health check timeout in seconds
Timeout int64 `config:"timeout"`
// ok means health check is ok, ignore real check
Ok bool `config:"ok"`
}
type Request ¶
type Request struct {
Path RequestPath `config:"path"`
Headers map[string]string `config:"headers"`
Query map[string]string `config:"query"`
}
type RequestPath ¶
type Server ¶ added in v1.6.0
type Server struct {
// Required fields
Name string `config:"name"`
Port int64 `config:"port"`
// Optional fields
Protocol string `config:"protocol"`
Weight int64 `config:"weight,default=1"`
Disabled bool `config:"disabled,default=false"`
// Optional override configurations
Request *Request `config:"request"`
Response *Response `config:"response"`
Auth *Auth `config:"auth"`
HealthCheck *HealthCheck `config:"health_check"`
// contains filtered or unexported fields
}
Server represents a single backend server instance
func (*Server) GetEffectiveConfig ¶ added in v1.6.0
GetEffectiveConfig merges the server's override configurations with the base service configuration
func (*Server) SetHealthy ¶ added in v1.6.0
SetHealthy sets the health status of the server
type Service ¶
type Service struct {
// === 单服务模式字段(向后兼容)===
Name string `config:"name"`
Port int64 `config:"port"`
Protocol string `config:"protocol,default=http"`
// === 多服务模式字段 ===
Algorithm string `config:"algorithm,default=round-robin"`
Servers []Server `config:"servers"`
// === 共享配置 ===
Request Request `config:"request"`
Response Response `config:"response"`
Auth Auth `config:"auth"`
HealthCheck HealthCheck `config:"health_check"`
}
func (*Service) IsMultiServer ¶ added in v1.6.0
IsMultiServer checks if the service is configured for multi-server mode
Click to show internal directories.
Click to hide internal directories.