Feature Request: Support a configurable Wintun adapter GUID on Windows

Aperta
#4,730 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
go
Ambito
networking

Direzione di ricerca

Start with the TUN inbound options in sing-box, then find where the Windows adapter GUID is derived via generateGUIDByDeviceName in the sing-tun Windows implementation. The change spans both repositories: add an optional GUID option to sing-tun, then pass a wintun_guid field from sing-box through to it. Done means a supplied GUID is used for both opening and creating the adapter, omitted values keep the current behavior, and other platforms ignore the field. Confirm the design with a maintainer before starting.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Currently, sing-box does not expose an option to configure the GUID of its Wintun adapter.

The adapter identity is managed internally by the underlying "sing-tun" implementation, which derives a deterministic GUID from the device name.

I propose adding an optional "wintun_guid" configuration field to the TUN inbound, allowing users to explicitly specify the Wintun adapter GUID on Windows.

This would provide greater control over adapter identity without changing the existing default behavior.

Proposed Configuration

{
"type": "tun",
"tag": "tun-in",
"interface_name": "sing-box",
"wintun_guid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"address": [
"172.19.0.1/30"
]
}

The "wintun_guid" field would be optional.

  • If specified, sing-box passes the GUID to the underlying "sing-tun" implementation.
  • If omitted, the existing GUID generation mechanism remains unchanged.
  • On non-Windows platforms, the field has no effect.

Motivation

There are use cases where applications need to coordinate TUN adapter identity across multiple network engines or configurations.

For example:

  • Multiple network engines sharing a consistent Wintun adapter identity.
  • Host applications managing TUN device lifecycle independently of the network engine.
  • Maintaining adapter identity independently of interface display names.
  • Integrations requiring predictable Windows adapter identification.

Windows interface names and adapter GUIDs represent different aspects of adapter identity. Exposing an optional GUID would allow applications to manage these independently.

Proposed Implementation

The implementation would involve two components:

  1. sing-tun

Add an optional "GUID" field to the TUN options.

The Windows implementation should:

  • Use the explicitly supplied GUID when present.
  • Preserve the existing "generateGUIDByDeviceName" behavior when omitted.
  • Leave other platform implementations unaffected.
  1. sing-box

Expose an optional "wintun_guid" field in the TUN inbound configuration.

Pass the configured value through the platform-specific TUN configuration into "sing-tun".

Backward Compatibility

This feature would be fully backward-compatible.

Existing configurations would continue using the current device-name-based GUID generation mechanism.

No changes would be required for users who do not need explicit adapter identity management.

Platform Support

This option would only apply to Windows and Wintun.

Other platforms should ignore the field or leave it unused.

Additional Considerations

  • Validate the supplied value as a canonical UUID.
  • Ensure the same GUID is used for both opening and creating the adapter.
  • Document that explicitly assigned GUIDs should not conflict with unrelated Wintun adapters.
  • Keep the current automatic GUID generation as the default.

Question

Would maintainers consider exposing an optional "wintun_guid" field for Windows TUN inbounds?

I would be happy to contribute the implementation, including the corresponding changes in "sing-tun" if needed.

Lingua principale
Go
Stelle
40.4k
Fork
5k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

  • Include un Dockerfile o un file Docker Compose
  • Nessun modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di SagerNet/sing-box

Tutte le issue di SagerNet/sing-box

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.