Skip to content

draft DHCP allocator abstraction#132

Draft
soypat wants to merge 1 commit into
mainfrom
dhcp-allocator
Draft

draft DHCP allocator abstraction#132
soypat wants to merge 1 commit into
mainfrom
dhcp-allocator

Conversation

@soypat

@soypat soypat commented Jun 20, 2026

Copy link
Copy Markdown
Owner

Addressing tinygo-org/espradio#51 (comment)

type Allocator interface {
	// Offer tentatively reserves a binding for the requesting client and
	// returns it. It is called when the server receives a DISCOVER/SOLICIT.
	Offer(Request) (Binding, error)
	// Commit binds a previously offered reservation, finalizing the lease, and
	// returns the committed binding. It is called when the server receives a
	// REQUEST.
	Commit(Request) (Binding, error)
	// Release frees the binding held for the given client identity. It is
	// called when the server receives a RELEASE. Releasing an unknown client is
	// not an error.
	Release(clientID []byte) error
	// Decline marks the addresses in the request as unusable, typically because
	// the client detected an address conflict. It is called when the server
	// receives a DECLINE.
	Decline(Request) error

	// AppendOptions lets the allocator customize the option bytes the server is
	// about to send. dst already contains the options the server derived from
	// its own configuration (server identifier, router, subnet mask, DNS, lease
	// times, ...) for the given client and binding. The implementation may
	// append further options, or rewrite the existing ones, and must return the
	// resulting slice. The returned slice must not exceed dst's capacity.
	AppendOptions(dst []byte, clientID []byte, b Binding) ([]byte, error)
}

@soypat soypat marked this pull request as draft June 20, 2026 21:21
@codecov

codecov Bot commented Jun 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 67.88321% with 88 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.28%. Comparing base (8f9d765) to head (b46b4c7).

Files with missing lines Patch % Lines
dhcp/dhcpv4/server.go 66.88% 36 Missing and 15 partials ⚠️
dhcp/dhcpv4/allocator.go 68.75% 24 Missing and 11 partials ⚠️
dhcp/lease.go 66.66% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #132      +/-   ##
==========================================
+ Coverage   59.17%   59.28%   +0.10%     
==========================================
  Files         104      106       +2     
  Lines       11664    11813     +149     
==========================================
+ Hits         6902     7003     +101     
- Misses       4041     4074      +33     
- Partials      721      736      +15     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@MDr164

MDr164 commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Quickly glanced over it and already found a couple questionable items in this PR. Want me to review or rather wait until you moved it out of draft?

@soypat

soypat commented Jun 23, 2026

Copy link
Copy Markdown
Owner Author

As you wish, this PR is pure clankerspeak. I'll eventually take a more in depth look, just wanted to get it out there so I could see diff comfortably

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.

2 participants