refactor(yipd): split peer_manager.rs into a module directory (keep the struct whole) #108
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
femboy/yip#108
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
peer_manager.rs is a god-STRUCT: PeerManager has 26 fields and one ~3300-line impl (plus ~6000 test lines) spanning 7 clean method clusters (handshake, rekey, relay, routing, obf, gossip/admission, Dispatch). Every change to any subsystem edits the same file. Do NOT extract collaborator structs — methods take &mut self and return DispatchOut<'_> borrowing from self (tun_scratch already documents a borrow-checker workaround), so splitting the struct turns every seam into a borrow conflict. Instead mechanically move method clusters into sibling files under peer_manager/, each with its own
impl PeerManager+mod tests, zero behavior change: mod.rs (struct+fields+new+Dispatch), handshake.rs, rekey.rs, relay.rs, routing.rs, obf.rs, gossip.rs. Phase 2 (optional): extract {obf_key,junk_rng,cover_traffic_ms}->ObfState and {last_register_ms,reg_refresh_ms,registered_once,reg_seq}->RegistrationState (neither participates in the DispatchOut borrow). Same treatment applies to yip-utls/src/stream.rs (~1770 lines, free functions -> cert.rs/record.rs/sig.rs/flight.rs/stream.rs).See docs/2026-07-25-project-review-and-roadmap.md for the full review synthesis.