Skip to content

v0.4 - #44

Open
dimspell wants to merge 102 commits into
masterfrom
staging
Open

v0.4#44
dimspell wants to merge 102 commits into
masterfrom
staging

Conversation

@dimspell

Copy link
Copy Markdown
Owner

No description provided.

dimspell added 16 commits July 16, 2026 20:46
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.
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