|
| 1 | +--- |
| 2 | +icon: material/new-box |
| 3 | +--- |
| 4 | + |
| 5 | +!!! question "Since sing-box 1.14.0" |
| 6 | + |
| 7 | +# USB/IP Server |
| 8 | + |
| 9 | +USB/IP Server service exports local USB devices over [USB/IP](https://usbip.sourceforge.net/), |
| 10 | +to be imported by the [USB/IP Client](/configuration/service/usbip-client/) or a standard USB/IP |
| 11 | +client. |
| 12 | + |
| 13 | +Available on Linux, Windows, and macOS (macOS requires a build with CGO, and exporting devices |
| 14 | +requires disabling System Integrity Protection). Not available on iOS. |
| 15 | + |
| 16 | +### Structure |
| 17 | + |
| 18 | +```json |
| 19 | +{ |
| 20 | + "type": "usbip-server", |
| 21 | + |
| 22 | + ... // Listen Fields |
| 23 | + |
| 24 | + "provider": "", |
| 25 | + "devices": [] |
| 26 | +} |
| 27 | +``` |
| 28 | + |
| 29 | +!!! info "Difference from the official USB/IP protocol" |
| 30 | + |
| 31 | + sing-box uses [sing-usbip](https://github.com/SagerNet/sing-usbip), which uses an additional |
| 32 | + set of protocols to support enhancements such as hotplug, while remaining interoperable with |
| 33 | + the standard USB/IP protocol. |
| 34 | + |
| 35 | +### Listen Fields |
| 36 | + |
| 37 | +See [Listen Fields](/configuration/shared/listen/) for details. |
| 38 | + |
| 39 | +`listen_port` defaults to `3240`. |
| 40 | + |
| 41 | +### Fields |
| 42 | + |
| 43 | +#### provider |
| 44 | + |
| 45 | +The device source provider. |
| 46 | + |
| 47 | +- `default`: Exports the local devices matched by `devices`. The default value. |
| 48 | +- `dynamic`: Devices are provided at runtime through a [sing-box API](/configuration/service/api/) |
| 49 | + client instead of from configuration, on supported platforms: the sing-box graphical clients on |
| 50 | + [macOS](/clients/apple/) and [Android](/clients/android/), and Chromium-based browsers with |
| 51 | + [sing-box Dashboard](https://github.com/SagerNet/sing-box-dashboard). |
| 52 | + |
| 53 | +!!! quote "" |
| 54 | + |
| 55 | + The `default` provider is only supported when running directly via the CLI on Linux, Windows, |
| 56 | + and macOS, and requires elevated privileges. |
| 57 | + |
| 58 | +#### devices |
| 59 | + |
| 60 | +==Required== with the `default` provider. |
| 61 | + |
| 62 | +List of device matches selecting which local USB devices to export. |
| 63 | + |
| 64 | +Object format: |
| 65 | + |
| 66 | +```json |
| 67 | +{ |
| 68 | + "bus_id": "", |
| 69 | + "vendor_id": 0, |
| 70 | + "product_id": 0, |
| 71 | + "serial": "" |
| 72 | +} |
| 73 | +``` |
| 74 | + |
| 75 | +Object fields: |
| 76 | + |
| 77 | +- `bus_id`: USB bus ID, e.g. `1-2`. |
| 78 | +- `vendor_id`: USB vendor ID, as a number. |
| 79 | +- `product_id`: USB product ID, as a number. |
| 80 | +- `serial`: Device serial number. |
| 81 | + |
| 82 | +Within one object, all specified fields must match; multiple objects are combined as a union. At |
| 83 | +least one field is required. |
0 commit comments