Add L7/PROXY protocol data model, config, and architecture docs
Extend the config, database schema, and server internals to support per-route L4/L7 mode selection and PROXY protocol fields. This is the foundation for L7 HTTP/2 reverse proxying and multi-hop PROXY protocol support described in the updated ARCHITECTURE.md. Config: Listener gains ProxyProtocol; Route gains Mode, TLSCert, TLSKey, BackendTLS, SendProxyProtocol. L7 routes validated at load time (cert/key pair must exist and parse). Mode defaults to "l4". DB: Migration v2 adds columns to listeners and routes tables. CRUD and seeding updated to persist all new fields. Server: RouteInfo replaces bare backend string in route lookup. handleConn dispatches on route.Mode (L7 path stubbed with error). ListenerState and ListenerData carry ProxyProtocol flag. All existing L4 tests pass unchanged. New tests cover migration v2, L7 field persistence, config validation for mode/cert/key, and proxy_protocol flag round-tripping. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -88,10 +88,10 @@ func (a *AdminServer) ListRoutes(_ context.Context, req *pb.ListRoutesRequest) (
|
||||
resp := &pb.ListRoutesResponse{
|
||||
ListenerAddr: ls.Addr,
|
||||
}
|
||||
for hostname, backend := range routes {
|
||||
for hostname, route := range routes {
|
||||
resp.Routes = append(resp.Routes, &pb.Route{
|
||||
Hostname: hostname,
|
||||
Backend: backend,
|
||||
Backend: route.Backend,
|
||||
})
|
||||
}
|
||||
return resp, nil
|
||||
@@ -119,11 +119,11 @@ func (a *AdminServer) AddRoute(_ context.Context, req *pb.AddRouteRequest) (*pb.
|
||||
hostname := strings.ToLower(req.Route.Hostname)
|
||||
|
||||
// Write-through: DB first, then memory.
|
||||
if _, err := a.store.CreateRoute(ls.ID, hostname, req.Route.Backend); err != nil {
|
||||
if _, err := a.store.CreateRoute(ls.ID, hostname, req.Route.Backend, "l4", "", "", false, false); err != nil {
|
||||
return nil, status.Errorf(codes.AlreadyExists, "%v", err)
|
||||
}
|
||||
|
||||
if err := ls.AddRoute(hostname, req.Route.Backend); err != nil {
|
||||
if err := ls.AddRoute(hostname, server.RouteInfo{Backend: req.Route.Backend, Mode: "l4"}); err != nil {
|
||||
// DB succeeded but memory failed (should not happen since DB enforces uniqueness).
|
||||
a.logger.Error("inconsistency: DB write succeeded but memory update failed", "error", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user