Mostly inspired by #16202 (comment), I believe this will also allow some simplifications in #18242.
If you're concerned about the net added line count, don't be: this PR also adds some documentation to net.{h,cpp}.
I'm happy for this to go in after #18242 and I'll rebase.