Part of the accepted-design index.
The current consumer requirement is Netlink transport plus useful Linux ancillary operations. net already owns stream networking and Unix connection management. A bounded message API avoids duplicating its TCP stack or exposing a configurable syscall facade. Unix datagram endpoints and datagram/seqpacket pairs supply real local message and descriptor-passing use cases; Netlink uses SOCK_RAW because Linux gives it the same datagram semantics as SOCK_DGRAM.
io.Reader and net.PacketConn cannot expose all of payload truncation, ancillary truncation, and received-file ownership. Send and Receive therefore keep these results explicit. Output flags retain unknown kernel bits. Seqpacket zero-byte reads remain ambiguous between an empty record and shutdown, just as at the kernel boundary; the package does not invent a framing byte or silently translate empty messages to EOF. Stream dialing/listening and adoption are omitted until a concrete operation requires them.
Abstract names retain Go’s documented net.UnixAddr shorthand: @app means the kernel name "\x00app". This keeps ordinary Go callers familiar with the address syntax; requiring NUL-prefixed names exclusively would give the same spelling a different meaning from the standard library. LiteralPathname selects literal interpretation for the exceptional case of a native peer whose filesystem filename literally starts with @. Linux has no such boolean option; the package carries that distinction until encoding the native address bytes. Prefixing ./ instead would exceed the address-length limit for long valid names. A received address therefore preserves enough information to reply directly, even though its display string alone can be ambiguous.
The maintained x/sys/unix sockaddr decoder stops at the first NUL and does not preserve the returned Unix address length. Input validation alone cannot protect replies to binary abstract senders from another program. Internal recvmsg/getsockname wrappers therefore retain the kernel-reported length, using maintained unix.Msghdr/unix.Iovec ABI types and architecture syscall constants. The narrow unsafe boundary preserves binary names and distinguishes unnamed sockets from the abstract @ name without copied syscall tables. Explicit pathname bind/send operations also use maintained raw ABI types because x/sys always interprets leading @ as abstract. Empty receive buffers use a zero-length kernel iovec instead of the maintained helper’s synthetic payload byte, so copied-byte counts and truncation remain faithful in every mode. Other operations continue to use maintained bindings.
Sockets are created nonblocking and close-on-exec, then registered through os.NewFile and checked for deadline support before binding or returning. Internal public syscall.RawConn Read/Write methods pin descriptor lifetime and integrate receives and Unix-pair sends with Go’s poller. Sends with explicit Unix or Netlink destinations retain nonblocking EAGAIN instead of waiting on sender writability: destination-queue capacity does not provide the needed sender readiness notification. In Linux’s Netlink implementation, draining a destination wakes that receiver’s private wait queue rather than the sending descriptor’s poll waiters. Waiting can therefore spin on unrelated readiness or miss a wakeup. Returning the kernel error keeps retry policy with the caller, including when file references are borrowed. This avoids private runtime hooks, a second readiness loop, and goroutines that cannot cancel blocked syscalls. Control operations use lifetime protection without pretending they gain cancellation.
Passing raw ancillary bytes would force callers to interpret descriptor integers and handle leaks. The API accepts borrowed standard files and returns owned standard files instead. Sending duplicates each borrowed input under lifetime protection, which allows a sender to wait without using a descriptor that could be closed and reused. The extra descriptor cost is bounded by Linux’s 253-right limit and is preferable to nesting arbitrary numbers of RawConn callbacks or exposing caller-managed duplication. The send attempt closes its temporary references on every path. Received rights use MSG_CMSG_CLOEXEC; any receive failure closes all decoded rights. Rights that do not fit the kernel buffer are closed by Linux. This preserves the repository rule that callers never perform acquisition-error cleanup.
The ancillary buffer is sized for a caller-selected file limit plus credentials. Alignment and shared control space can allow Linux to deliver more rights than requested; an explicit count check enforces the public bound and closes that entire received set. Truncated payloads still return rights successfully, because payload loss does not invalidate the installed references. Unknown controls cannot be requested through this API and are ignored; adding another resource-bearing control requires explicit ownership work.
Netlink addresses preserve port IDs and the legacy group mask. Group membership methods accept group IDs and leave authorization to Linux. Extended acknowledgements, capped acknowledgements, and strict route checks are concrete operations, while protocol sequencing and decoding belong above transport. Receive never opts into NETLINK_NO_ENOBUFS, since hiding loss would undermine dump/notification correctness. No request multiplexer, receive goroutine, automatic retries after a consumed record, or socket-level transaction is implied.
The baseline choices are established by Linux 7.0 Netlink UAPI, socket UAPI, and Unix implementation. The usage guide owns operational contracts; runner evidence belongs to the verification guide, and missing execution evidence is recorded in verification limits.