chore(restrictednet): add internal/restrictednet package#3361
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Introduces a new internal/restrictednet package intended to perform DNS-over-HTTPS name resolution and HTTPS requests while temporarily opening highly-restrictive outbound firewall rules (scoped by source IP/port and destination IP/port), supporting the “restricted internet when VPN tunnel is down” workflow referenced in #3358.
Changes:
- Add
internal/restrictednetclient APIs for DoH-based name resolution and for opening temporary HTTPS egress rules. - Extend the firewall abstraction and iptables implementation with
AcceptOutputFromIPPortToIPPort. - Add unit tests and mock generation for the new package, plus update agent guidance in
AGENTS.md.
Reviewed changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/restrictednet/client.go | Adds Client constructor and OpenHTTPSByDomain helper wiring DoH resolution to HTTPS rule opening. |
| internal/restrictednet/https.go | Implements HTTPS client creation with bound dialing and temporary firewall rule add/remove. |
| internal/restrictednet/resolve.go | Implements DoH POST queries and parsing DNS answers into netip.Addr results. |
| internal/restrictednet/client_test.go | Adds unit test coverage for OpenHTTPS firewall rule add/remove behavior. |
| internal/restrictednet/resolve_test.go | Adds unit test coverage for parsing DNS answers into netip.Addr. |
| internal/restrictednet/interfaces.go | Defines the Firewall interface used by restrictednet. |
| internal/restrictednet/mocks_generate_test.go | Adds go:generate directive for GoMock generation. |
| internal/restrictednet/mocks_test.go | Adds generated GoMock for the restrictednet Firewall interface. |
| internal/firewall/wrappers.go | Exposes a new wrapper method on firewall.Config. |
| internal/firewall/interfaces.go | Extends the internal firewall implementation interface with the new accept rule method. |
| internal/firewall/iptables/iptables.go | Adds iptables/ip6tables rule generation for source+dest IP/port-specific output acceptance. |
| AGENTS.md | Updates repository agent/coding guidance with additional preferences. |
Files not reviewed (1)
- internal/restrictednet/mocks_test.go: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This was referenced Jul 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See #3358