* Added HV Socket tests
Added tests for core Hyper-V socket functionality, including testing
CloseRead and CloseWrite, as well as checking addresses are appropriate
and timeouts work.
Added fuzzing test to check for edge case read/write issues.
Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com>
* pr: asserts, naming, fatal in test
Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com>
Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com>
* Added HV Socket known IDs, Dial, bug fixes
Added:
* Well-know Hyper-V VMIDs for parents, children, and loopback.
* VSock interop service GUID.
* `Dial()` and `DialContext()` to dial a specific Hyper-V socket at a
known address (along with a corresponding `HvsockDialer` struct.
Bug fixes:
* Dial (and Listen) now properly initialize and set properties of their
sockets after ConnectEx (and AcceptEx).
* The `socketError` used by `bind` was incorrect, it should be `int32(-1)`,
not `uintptr(^0)`
* Return errors for `(*HvsockConn) SetDeadline`
Created a `sockets` package, currently only with syscalls to `Bind`,
`ConnectEx` and `GetSockName`, bypassing `syscall/windows` restrictions
on the types that can do so.
Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com>
* PR: error handling bug, rebase, unexport, naming
* comments and todos statements
* spelling
* removed dead code
* changed names to be more conventional
* unexported socket code
* made `(*HvsockDialer) Dial` take `Context`, removed `DialContext`
* added default `Dial` function
* rebased onto main
* cleaned up `Dial(` retry loop
Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com>
* PR: RawSockaddr validation, `.As(` style
Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com>
Language server complains about
`invalid operation: operator | not defined on windows.TOKEN_ADJUST_PRIVILEGES`
in `privilege.go`. Upgrading to new golang.org/x/sys fixes issue.
Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com>
* ETW name and options functionality
Added functionality to set the event (task) name and options (such as
event or associated event ID) for ETW events created by the hook based
on the logrus.Entry fields.
Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com>
* PR: export and comment
Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com>