#743

api: centralize handler registration and move handlers to a separate file

Openredbeamwants to merge intofrom

Move all REST API endpoint registrations into a single file (pkg/virtualnetwork/mux.go) to make the full API surface visible more clearly. Previously, handlers were scattered across multiple files with a mux composition chain using StripPrefix.

The three API surfaces are now defined as explicit mux constructors:

  • GatewayMux(): only forwarder endpoints (for gateway 192.168.127.1)
  • ServicesMux(): everything except /connect (for -services)
  • Mux(): full API including /connect (for -listen endpoints)

Service packages (forwarder, DNS, DHCP) no longer define HTTP handlers. Instead, they export business logic methods (List, Expose, Unexpose, Zones, AddZone, Leases) that mux.go calls from its handlers. This removes their dependency on net/http.

The VirtualNetwork struct now holds references to the DNS and DHCP servers, allowing direct access to their methods from the centralized mux handlers.

Move all HTTP handler implementations from mux.go to a new handlers.go file to improve code organization and readability.

Activity

5
openshift-ci[bot]24d ago

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: redbeam Once this PR has been reviewed and has the lgtm label, please assign lstocchi for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment