Conversation
fortuna
force-pushed
the
refactor/packetrelay
branch
from
September 15, 2026 23:03
b0c0bca to
005ee95
Compare
fortuna
added this pull request to stack #632
September 15, 2026 23:03
fortuna
marked this pull request as draft
September 15, 2026 23:29
network.PacketProxy and NewPacketProxyFromPacketListener are deprecated in favor of the flow-based network/packetrelay API. This migrates Intra's UDP handling, mirroring OutlineFoundation/outline-apps#2777. - intraPacketProxy becomes intraPacketRelay, a packetrelay.PacketRelay whose associations share a dohAssociation between their sender and receiver halves. - lwip2transport.ConfigureDevice -> ConfigureDeviceWithRelay. - packetrelay.NewPacketRelayFromPacketListener replaces network.NewPacketProxyFromPacketListener, keeping the same 5 minute write-idle timeout (now a constructor argument). - Add unit tests for DNS interception, packet relaying, byte accounting and sender close semantics. Behavior is unchanged, except that SendPacket on a closed association now returns ErrClosed instead of issuing a DoH query whose response can no longer be delivered.
fortuna
force-pushed
the
refactor/packetrelay
branch
from
September 16, 2026 17:54
005ee95 to
8be9f37
Compare
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.
Note
Stacked on #631 (Go 1.27.1 + gomobile + Outline SDK v0.1.0-rc1). Review the diff against
build/upgrade-go; this PR contains no dependency changes.Why
network.PacketProxyandnetwork.NewPacketProxyFromPacketListenerare deprecated in the Outline SDK, in favor of the flow-basednetwork/packetrelayAPI. Outline did the same migration in outline-apps#2777.This is also preparation for proxyless QUIC circumvention: retrying a blocked QUIC handshake requires a new source port (residual censorship often blackholes the flagged 4-tuple), which the relay API supports naturally by opening another association, whereas
PacketProxygives one fixed socket per session.What changed
intraPacketProxy→intraPacketRelay, implementingpacketrelay.PacketRelay. Each association shares adohAssociationbetween its sender and receiver halves (the sender needs the stack'sPacketHandlerto deliver locally-resolved DNS responses).lwip2transport.ConfigureDevice→ConfigureDeviceWithRelay.packetrelay.NewPacketRelayFromPacketListener(pl, 5*time.Minute)replacesNewPacketProxyFromPacketListener(…, WithPacketListenerWriteIdleTimeout(…)), preserving the RFC 4787 REQ-5 timeout. In v0.1.0-rc1 the write-idle timeout is a constructor argument, so noTimeoutPacketRelaywrapper is needed.network/dnsinterceptrewrites the destination to a remote resolver address, while Intra answers in-process viadoh.Resolver.packet_relay_test.gocovering DNS interception (including that DNS bytes are not billed to the user), error propagation, relaying with byte accounting, association-summary reporting, and sender close semantics.Preserved semantics: DNS-only associations are still torn down right after the query is answered; DNS traffic is still excluded from
UDPSocketSummary; the summary is still reported exactly once when the association concludes.One intentional behavior change:
SendPacketon a closed association now returnspacketrelay.ErrClosedfor all destinations. Previously a post-close packet addressed to the fake DNS server would still issue a DoH query whose response could no longer be delivered.Out of scope:
UDPSocketSummary.Durationis documented as seconds but assignedint32(time.Since(...))(nanoseconds, overflowing after ~2.1 s). Pre-existing on both sides of this refactor; left untouched.Testing
gofmt -lclean for the touched files,go vet ./...go test -race ./...— all packages pass./gradlew :app:compileGoBackend— gomobile bind succeeds (the boundintraAPI surface is unchanged; only unexported types moved)