Skip to content

fix: rewrite UDP forwarding and add CI tests#41

Open
Mohammed Naser (mnaser) wants to merge 1 commit intomainfrom
fix/udp-forwarding
Open

fix: rewrite UDP forwarding and add CI tests#41
Mohammed Naser (mnaser) wants to merge 1 commit intomainfrom
fix/udp-forwarding

Conversation

@mnaser
Copy link
Member

Changes

UDP forwarding fixes

  • Extract forwardUDP as a standalone testable function
  • Fix connection leak: single DialUDP per session instead of per-packet
  • Fix defer accumulation: defer at function scope, not inside loop
  • Fix stuck goroutines: sync.OnceFunc closes both connections when either direction fails
  • Use 65535-byte buffers (max UDP) instead of 1500 (MTU-limited)

Testing

  • Add TestForwardUDP with localhost UDP echo server validating bidirectional forwarding and clean shutdown

CI

  • Replace go build main.go with robherley/go-test-action (covers build + test with PR annotations)
  • Add concurrency control and workflow_dispatch trigger

- Extract forwardUDP as a standalone testable function
- Fix connection leak: single DialUDP per session instead of per-packet
- Fix defer accumulation: defer at function scope, not inside loop
- Fix stuck goroutines: sync.OnceFunc closes both connections when
  either direction fails
- Use 65535-byte buffers (max UDP) instead of 1500 (MTU-limited)
- Add TestForwardUDP with localhost UDP echo server
- Update CI to use robherley/go-test-action with concurrency control

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Mohammed Naser <mnaser@vexxhost.com>
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