mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-27 03:09:33 +02:00
* **New Features** * Routes can promote route-local bypass rules into matching entrypoint middleware, layering route-specific bypasses onto existing entrypoint rules and avoiding duplicate evaluation. * **Behavior Changes** * Entrypoint middleware updates now refresh per-route overlays at runtime; overlay compilation failures result in HTTP 500 (errors are not exposed verbatim). * Route middleware accessors now return safe clones. * **Documentation** * Clarified promotion, consumption, merging and qualification semantics with examples. * **Tests** * Added tests covering promotion, cache invalidation, consumption semantics, and error handling. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
84 lines
2.0 KiB
Go
84 lines
2.0 KiB
Go
package types
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/rs/zerolog"
|
|
"github.com/yusing/godoxy/internal/agentpool"
|
|
"github.com/yusing/godoxy/internal/homepage"
|
|
nettypes "github.com/yusing/godoxy/internal/net/types"
|
|
provider "github.com/yusing/godoxy/internal/route/provider/types"
|
|
"github.com/yusing/goutils/http/reverseproxy"
|
|
"github.com/yusing/goutils/pool"
|
|
"github.com/yusing/goutils/task"
|
|
)
|
|
|
|
type (
|
|
Route interface {
|
|
task.TaskStarter
|
|
task.TaskFinisher
|
|
pool.Object
|
|
zerolog.LogObjectMarshaler
|
|
|
|
ProviderName() string
|
|
GetProvider() RouteProvider
|
|
ListenURL() *nettypes.URL
|
|
TargetURL() *nettypes.URL
|
|
HealthMonitor() HealthMonitor
|
|
SetHealthMonitor(m HealthMonitor)
|
|
References() []string
|
|
ShouldExclude() bool
|
|
|
|
Started() <-chan struct{}
|
|
|
|
IdlewatcherConfig() *IdlewatcherConfig
|
|
HealthCheckConfig() HealthCheckConfig
|
|
LoadBalanceConfig() *LoadBalancerConfig
|
|
HomepageItem() homepage.Item
|
|
DisplayName() string
|
|
ContainerInfo() *Container
|
|
InboundMTLSProfileRef() string
|
|
// RouteMiddlewares returns a copy of the route middlewares
|
|
RouteMiddlewares() map[string]LabelMap
|
|
|
|
GetAgent() *agentpool.Agent
|
|
|
|
IsDocker() bool
|
|
IsAgent() bool
|
|
UseLoadBalance() bool
|
|
UseIdleWatcher() bool
|
|
UseHealthCheck() bool
|
|
UseAccessLog() bool
|
|
}
|
|
HTTPRoute interface {
|
|
Route
|
|
http.Handler
|
|
}
|
|
ReverseProxyRoute interface {
|
|
HTTPRoute
|
|
ReverseProxy() *reverseproxy.ReverseProxy
|
|
}
|
|
FileServerRoute interface {
|
|
HTTPRoute
|
|
RootPath() string
|
|
}
|
|
StreamRoute interface {
|
|
Route
|
|
nettypes.Stream
|
|
Stream() nettypes.Stream
|
|
}
|
|
RouteProvider interface {
|
|
Start(parent task.Parent) error
|
|
LoadRoutes() error
|
|
GetRoute(alias string) (r Route, ok bool)
|
|
// should be used like `for _, r := range p.IterRoutes` (no braces), not calling it directly
|
|
IterRoutes(yield func(alias string, r Route) bool)
|
|
NumRoutes() int
|
|
FindService(project, service string) (r Route, ok bool)
|
|
Statistics() ProviderStats
|
|
GetType() provider.Type
|
|
ShortName() string
|
|
String() string
|
|
}
|
|
)
|