Conversation
Restructure Close so the success log is reachable; the previous 'if p.conn != nil' block was always true after the nil early-return, leaving the 'UDP listener closed' log unreachable.
…direct
NewTCPRedirect previously returned a UDP listener (misplaced) for
OtherUserHasJoined and fell through to &Noop{} for that mode, silently
dropping TCP. Now it returns a TCP listener mirroring OtherUserIsHost,
consistent with NewUDPRedirect for the same mode.
Adds redirect_test.go asserting the returned redirect types per Mode.
AssignIP previously hardcoded the first two octets to 127,0, ignoring IPPrefix[0]/IPPrefix[1] and making WithIPPrefix a no-op for the 3rd octet. Now the assigned IP derives from the full IPPrefix (varying only the last octet), so WithIPPrefix is honored. Default 127.0.0.1 prefix still yields 127.0.0.2+. Adds TestHostManager_IPAssignment_HonorsIPPrefix.
Each Run loop reused a single buf and passed buf[:n] to OnReceive. If a callback retained the slice (e.g. sent over a channel or to another goroutine) it would observe corrupted/overwritten data on the next read. Now the package copies the received bytes before invoking the callback in DialerUDP, DialerTCP, and ListenerTCP. Adds TestDialerUDP_Run_SliceNotAliased asserting retained slices stay intact across multiple reads.
RemoveByIP used strings.HasPrefix, so removing '127.0.0.1' also wiped '127.0.0.10', '127.0.0.11', etc. Now it matches the exact IP. No production caller relied on prefix matching. Updates existing tests to use exact IPs and adds TestHostManager_RemoveByIP_ExactMatchPreservesNeighbors.
handleHandshake read exactly 4 bytes; an oversized handshake packet had its tail dropped. Now it reads in a loop until at least the 4-byte magic is available, validates buf[:4], and forwards the whole packet. Adds TestListenerUDP_handleHandshake_Oversized.
- Add testcontainers-go (v0.43.0) via tools/tools.go build tag - Dockerfile.integration + cmd/integration-client mock client stub - internal/integration/spike_test.go proves console+backend+mockclient topology (mock client run via Exec inside backend container) - Add --run-mode flag to console/serve with WithRunMode option and validation; unit test for well-known run-mode override
- Add cmd/integration-client mock client speaking the real wire protocol: handshake, auth, character select, opcode 68 to register the lobby session, create/list/select/join room, and a real UDP :6113 / TCP :6114 game-packet exchange. - Add internal/integration harness (helpers_test.go) and TestLANGameExchange: 1 console + 2 backend containers on a fixed-subnet network with static IPs; host listens on its own IP, guest sends to PEER_IP, full bidirectional exchange verified. - Fix backend handshake (dispatcher.go) to use io.ReadFull instead of non-looping conn.Read; short TCP reads under load misaligned the frame stream and dropped real clients on lossy networks. - Wire the suite into `make test-integration` and a Docker-enabled `integration` GitHub Actions job. Relay/p2p end-to-end delivery remains broken (creator never learns the guest's fake-host IP; handleJoinRoom is a no-op) and is documented as a deferred finding.
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.
No description provided.