Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: add service package and start splitting HTTP handling #1595

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

ThinkChaos
Copy link
Collaborator

@ThinkChaos ThinkChaos commented Sep 5, 2024

Progress for #1206

Can't reopen 1427, so making a new PR.

EDIT: at least this way we get a codecov patch diff percentage back 😄

Allow helpertest to use util since only the tests need helpertests, we
can use util from there without creating a circular dependency.
Package service exposes types to abstract services from the networking.

The idea is that we build a set of services and a set of network
endpoints (Listener). The services are then assigned to endpoints based
on the address(es) they were configured for.

Actual service to endpoint binding is not handled by the abstractions in
this package as it is protocol specific.
The general pattern is to make a "server" that wraps a service, and can
then be started on an endpoint using a `Serve` method,
similar to `http.Server`.

To support exposing multiple compatible services on a single endpoint
(example: DoH + metrics on a single port),
services can implement `Merger`.
@ThinkChaos ThinkChaos changed the title Refactor/services refactor: add service package and start splitting HTTP handling Sep 5, 2024
Copy link

codecov bot commented Sep 5, 2024

Codecov Report

Attention: Patch coverage is 90.15385% with 32 lines in your changes missing coverage. Please review.

Project coverage is 91.74%. Comparing base (fe84ab8) to head (02da233).
Report is 137 commits behind head on main.

Files with missing lines Patch % Lines
server/server.go 80.00% 8 Missing and 4 partials ⚠️
config/config.go 0.00% 8 Missing ⚠️
server/doh.go 91.22% 3 Missing and 2 partials ⚠️
metrics/metrics.go 0.00% 4 Missing ⚠️
cmd/serve.go 0.00% 1 Missing and 1 partial ⚠️
metrics/metrics_event_publisher.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1595      +/-   ##
==========================================
- Coverage   93.88%   91.74%   -2.15%     
==========================================
  Files          78       91      +13     
  Lines        6361     5400     -961     
==========================================
- Hits         5972     4954    -1018     
- Misses        300      361      +61     
+ Partials       89       85       -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant