MCPcopy
hub / github.com/yusing/godoxy / Entrypoint

Interface Entrypoint

internal/entrypoint/types/entrypoint.go:11–46  ·  view source on GitHub ↗

Entrypoint is the main HTTP entry point for the proxy: it performs domain-based route lookup, applies middleware, manages HTTP/HTTPS server lifecycle, and exposes route pools and health info. Route providers register routes via StartAddRoute; request handling uses the route pools to resolve targets.

Source from the content-addressed store, hash-verified

9// exposes route pools and health info. Route providers register routes via
10// StartAddRoute; request handling uses the route pools to resolve targets.
11type Entrypoint interface {
12 // SupportProxyProtocol reports whether the entrypoint is configured to accept
13 // PROXY protocol (v1/v2) on incoming connections. When true, servers expect
14 // the PROXY header before reading HTTP.
15 SupportProxyProtocol() bool
16
17 // DisablePoolsLog sets whether add/del logging for route pools is disabled.
18 // When v is true, logging for HTTP, stream, and excluded route pools is
19 // turned off; when false, it is turned on. Affects all existing and future
20 // pool operations until called again.
21 DisablePoolsLog(v bool)
22
23 GetRoute(alias string) (types.Route, bool)
24 // StartAddRoute registers the route with the entrypoint. It is synchronous:
25 // it does not return until the route is registered or an error occurs. For
26 // HTTP routes, a server for the route's listen address is created and
27 // started if needed. For stream routes, ListenAndServe is invoked and the
28 // route is added to the pool only on success. Excluded routes are added to
29 // the excluded pool only. Returns an error on listen/bind failure, stream
30 // listen failure, or unsupported route type.
31 StartAddRoute(r types.Route) error
32 IterRoutes(yield func(r types.Route) bool)
33 NumRoutes() int
34 RoutesByProvider() map[string][]types.Route
35
36 // HTTPRoutes returns a read-only view of all HTTP routes (across listen addrs).
37 HTTPRoutes() PoolLike[types.HTTPRoute]
38 // StreamRoutes returns a read-only view of all stream (e.g. TCP/UDP) routes.
39 StreamRoutes() PoolLike[types.StreamRoute]
40 // ExcludedRoutes returns the read-write pool of excluded routes (e.g. disabled).
41 ExcludedRoutes() RWPoolLike[types.Route]
42
43 GetHealthInfo() map[string]types.HealthInfo
44 GetHealthInfoWithoutDetail() map[string]types.HealthInfoWithoutDetail
45 GetHealthInfoSimple() map[string]types.HealthStatus
46}
47
48type PoolLike[Route types.Route] interface {
49 Get(alias string) (Route, bool)

Callers 28

ListenAndServeMethod · 0.65
LoadFunction · 0.65
TestGetRouteFunction · 0.65
StartMethod · 0.65
addToLoadBalancerMethod · 0.65
StartMethod · 0.65
StartMethod · 0.65
addHTTPRouteAtFunction · 0.65
TestNumRoutesFunction · 0.65
ByProviderFunction · 0.65
TestRoutesByProviderFunction · 0.65
addToLoadBalancerMethod · 0.65

Implementers 2

testEntrypointinternal/route/reverse_proxy_test.go
Entrypointinternal/entrypoint/entrypoint.go

Calls

no outgoing calls

Tested by

no test coverage detected