Commit graph

449 commits

Author SHA1 Message Date
世界
0443becf97
usbip: restore VBoxUSB INF assets corrupted by line-ending normalization
The catalog signature covers the INF bytes; git's CRLF-to-LF
normalization made SetupCopyOEMInfW reject the package with
ERROR_FILE_HASH_NOT_IN_CATALOG, so the drivers could never install.
Restore the pristine upstream bytes and mark both driver asset trees
-text so checkout cannot corrupt them again.
2026-06-10 09:23:04 +08:00
世界
bb60072e01
usbip: restart device nodes so VBoxUSB capture and release take effect
VBoxUSBMon only rewrites a device's IDs while PnP enumerates it, so
adding a filter for an already-plugged device captured nothing until a
physical replug, and releasing one left it dead under VBoxUSB.sys.
Capture and release now drive the cfgmgr32 restart sequence
(query-and-remove, hub port cycle, re-setup) around the filter change,
mirroring usbipd-win's RestartingDevice.

Capture also changes the devnode's identity to the VBox stub ID, which
broke everything keyed on it: enumeration now reads the true
vendor/product/class/speed from the parent hub's descriptor cache (the
registry hardware ID reads as 80EE:CAFE once captured), data sessions
locate the VBoxUSB interface by bus/address instead of the original
instance ID, and Reconcile keeps exports alive through the
re-enumeration window with a short absence grace.
2026-06-10 09:22:55 +08:00
世界
5da1096a91
usbip: use a dedicated overlapped event per VBoxUSB ioctl
Device and Monitor shared one manual-reset event across all in-flight
IOCTLs, while the session layer runs one goroutine per endpoint: the
first completion released every GetOverlappedResult waiter with the
first operation's byte count, returning before the driver finished
writing the other buffers. Each overlappedIoctl call now owns its
event, making concurrent URBs (and aborts) on one handle safe.
2026-06-10 09:22:41 +08:00
世界
5c96e9cb56
usbip: fix VBoxUSBMon capture filter type
USBFILTERTYPE has CAPTURE = 4; the encoded value 5 is END, the enum's
out-of-range sentinel, which USBFilterValidate rejects with a negative
rc — so ADD_FILTER never installed a filter and no device could be
captured.
2026-06-10 09:22:32 +08:00
世界
8e1ea856e8
usbip: fix VBoxUSB ioctl codes missing the FILE_WRITE_ACCESS bit
Every SUPUSB/SUPUSBFLT CTL_CODE was computed with Access = 0 instead of
FILE_WRITE_ACCESS (2 << 14), so the driver dispatch rejected each call
with STATUS_INVALID_DEVICE_REQUEST and the export host could not even
pass monitor GET_VERSION. Values now match usbipd-win's interop
definitions (VBoxUsb.cs / VBoxUsbMon.cs).
2026-06-10 09:22:12 +08:00
世界
9f570d7072
usbip: add windows client backend with bundled usbip-win2 VHCI driver
Implement the Windows importer over vadimgrn/usbip-win2's UDE (USB Device
Emulation) driver. The driver does the TCP connect and import handshake
in-kernel via WSK, so it cannot take sing-box's already-dialed (and
possibly proxied) socket. Instead each Attach runs a one-shot loopback
listener, points the driver at it with PLUGIN_HARDWARE_ONCE, answers the
driver's in-kernel OP_REQ_IMPORT from the cached device info, and splices
the loopback stream to the proxied server connection -- so all dialer and
proxy behavior stays in userspace.

The Microsoft-signed driver is bundled and auto-installed like
common/vboxusb: amd64 from usbip-win2 0.9.7.7, arm64 from 0.9.7.5 (the
newest release with an arm64 build; identical ABI). EnsureDriver extracts
the package, registers the upper-filter, and creates the root-enumerated
UDE devnode via SetupAPI.

Also fix the control-channel fallback to treat a standard server's
connection reset (ECONNRESET on Windows) the same as a clean EOF, so the
client falls back to standard usbip discovery instead of retrying forever.

Verified on Win11 x64: self-installs the driver on a clean machine and
imports a device; behaves byte-identically to the official usbip-win2
client.
2026-06-09 23:48:21 +08:00
世界
c3946c00a3
usbip: fix correctness findings from protocol audit
Windows export now reports the real USB link speed, probed from the
parent hub (IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX and _V2 for
SuperSpeedPlus), so SuperSpeed devices route to the correct root-hub
speed domain instead of advertising speed=0.

- protocol: pin DeviceInfoTruncated/DeviceInterface wire sizes with
  two-sided compile-time assertions so a struct change fails the build
  instead of silently mis-bounding the reader
- server: bound inbound connections with a handshake read deadline and a
  per-iteration idle deadline on the control loop, plus write deadlines
  on control writes; clear the deadline before the conn becomes a data
  session
- server: serialize import reservation under reconcileAccess so a reserve
  cannot interleave a reconcile pass that would release a busy device
- data: validate CMD_SUBMIT iso descriptor offset/length against the
  transfer buffer before forwarding to a platform engine
- darwin: make darwinUSBHostDevice.Close idempotent via sync.Once to
  avoid a double close/free under concurrent shutdown
- windows: guard windowsExport.device with a mutex and hand the claimed
  handle to a single closer
2026-06-09 14:38:23 +08:00
世界
b3fb32abc0
usbip: remove dead code, ceremonial guards, and WHAT comments 2026-06-09 10:42:36 +08:00
世界
d9704cc220
vboxusb: include upstream SPDX license stubs for embedded driver assets
The VBoxUSB.sys / VBoxUSBMon.sys / .inf / .cat binaries copied from
dorssel/usbipd-win Drivers/{x64,arm64}/ ship paired SPDX
*.license files that record Oracle's GPL-3.0-only copyright. Carrying
them next to the assets keeps the provenance discoverable.
2026-06-09 10:42:35 +08:00
世界
6a4ae5263e
usbip: extract URBEngine + userspaceURBSession from darwin backend
Both the existing darwin backend and the upcoming windows backend
drive USB devices from user space (IOUSBHost CGO calls vs. VBoxUSB
IOCTLs). Refactor the per-attachment URB loop out of host_darwin.go
into a platform-agnostic userspaceURBSession that talks to a URBEngine
interface; the darwin-specific dispatch becomes a 30-line
darwinIOUSBHostEngine. Linux's kernelHandoffSession is untouched.

Move hex8 into shared.go and add usbipStatusEIO so the shared session
does not depend on golang.org/x/sys/unix (Windows has no equivalent).
2026-06-09 10:42:35 +08:00
世界
07c36152c2
process: Fix panic when package manager is unavailable on Android 2026-06-08 08:51:49 +08:00
世界
b19d4a92e2
Fix lint errors 2026-06-08 08:51:48 +08:00
世界
3eac9fb21a
Fix TLS server close 2026-06-08 08:51:48 +08:00
macronut
a130000741
Add more spoof method
Signed-off-by: macronut <4027187+macronut@users.noreply.github.com>
2026-06-08 08:51:47 +08:00
世界
c8792e7fe6
dns: Add timeout configuration 2026-06-08 08:51:46 +08:00
nekohasekai
0807b71b14
Add Windows TLS engine 2026-06-08 08:51:45 +08:00
世界
b40e8c5f19
Improve UDP batch support 2026-06-08 08:51:45 +08:00
世界
12a462142a
Add ACME profile support for IP address certificates 2026-06-08 08:51:44 +08:00
世界
2aa9c54fc9
Fix goroutine leak in networkquality tool
Serialize probe rounds in startProber to eliminate unbounded fan-out of
fire-and-forget probe goroutines (up to 100/sec per direction), and close
HTTP/3 transports via transport.Close() in addition to CloseIdleConnections.
2026-06-08 08:51:43 +08:00
世界
4ab34c837d
Fix tls-spoof 2026-06-08 08:51:43 +08:00
世界
76fd6a50df
Fix Apple TLS metadata capture 2026-06-08 08:51:42 +08:00
世界
79bd8962a5
Defer implicit default HTTP client fallback to first use 2026-06-08 08:51:42 +08:00
世界
7f690c3909
Scope HTTP/2 fallback and HTTP/3 broken state per authority 2026-06-08 08:51:42 +08:00
世界
45f122b7bb
Fix macOS tlsspoof 2026-06-08 08:51:41 +08:00
世界
9dc8d445f2
Reject IP literal server name with TLS spoof 2026-06-08 08:51:41 +08:00
世界
2581c6c99c
Fix legacy rule-set download_detour blocked by empty direct check 2026-06-08 08:51:41 +08:00
世界
44ee81ccb4
Add TLS spoof support 2026-06-08 08:51:41 +08:00
世界
ab2a90d5e7
Refactor: HTTP clients, unified HTTP2/QUIC options, Apple engines 2026-06-08 08:51:40 +08:00
世界
0525f6cb1c
Add optimistic DNS cache 2026-06-08 08:51:40 +08:00
世界
6bb84ab3a6
Fix stun test 2026-06-08 08:51:39 +08:00
世界
99a28b9ad0
Fix lint errors 2026-06-08 08:51:38 +08:00
世界
d70d15f913
Add package_name_regex route, DNS and headless rule item 2026-06-08 08:51:38 +08:00
世界
fe83054f6d
tools: Network Quality & STUN 2026-06-08 08:51:35 +08:00
nekohasekai
2c01a637a6
Refactor ACME support to certificate provider 2026-06-08 08:51:34 +08:00
世界
761b7f4e12
Handle TUN loopback in direct outbound 2026-06-03 12:56:36 +08:00
世界
5e7fd7ad78
Fix lint errors 2026-05-13 23:39:27 +08:00
世界
ddb757a25c
Reduce built-in certificate store memory 2026-04-28 07:44:20 +08:00
世界
71f6a2ab4e
Fix process search skipped for TUN 2026-04-21 15:45:05 +08:00
TargetLocked
7c3d8cf8db
Fix disable tcp keep alive 2026-04-10 13:29:15 +08:00
世界
0045103d14
Fix package_name shared uid matching 2026-03-23 18:57:35 +08:00
世界
d2a933784c
Optimize Darwin process finder 2026-03-23 18:57:35 +08:00
世界
3f05a37f65
Optimize Linux process finder 2026-03-23 18:57:35 +08:00
世界
7623bcd19e
Fix DialerForICMPDestination 2026-03-23 13:58:55 +08:00
世界
d2fa21d07b
Deprecate Socksaddr.IsFqdn: do not reject potentially valid domain names 2026-03-16 09:37:59 +08:00
世界
041646b728
Fix kTLS crash 2026-03-14 21:38:38 +08:00
Heng lu
2ba896c5ac
Fix netns fd leak in ListenNetworkNamespace 2026-03-09 20:06:34 +08:00
世界
1803471e02
endpoint: Fix UDP resolved destination 2026-03-02 13:55:26 +08:00
世界
8ae93a98e5
Remove overdue deprecated features 2026-03-01 12:30:43 +08:00
世界
9bd9e9a58b
dialer: use KeepAliveConfig for TCP keepalive 2026-02-27 14:58:06 +08:00
世界
9c2cdc7203
Fix per-outbound bind_interface 2026-02-27 14:58:06 +08:00