mirror of
https://github.com/XTLS/Xray-core.git
synced 2026-11-05 18:07:00 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
23f37b571c |
+1
-1
@@ -223,7 +223,7 @@ To make it start, wintun.dll specific for your Windows/arch must be present next
|
||||
|
||||
After the start network adapter with the name you chose in the config will be created in the system, and exist while Xray is running. A Wintun adapter that already has that name is reused.
|
||||
|
||||
With IPv6 disabled system-wide (the `DisabledComponents` registry value), the adapter has no IPv6, and the TUN starts with IPv4 only, unless `gateway` or `autoSystemRoutingTable` has IPv6 entries, which then keep it from starting.
|
||||
With IPv6 disabled system-wide (the `DisabledComponents` registry value), the adapter has no IPv6, and the TUN starts with IPv4 only, unless `gateway`, `dns` or `autoSystemRoutingTable` has IPv6 entries, which then keep it from starting.
|
||||
|
||||
When `dns` is set, those servers are applied to the adapter. Windows is kept from registering the TUN's addresses in DNS, and its DNS cache is flushed when the TUN starts and stops. Xray's own lookups through the system's DNS servers, like those of the `localhost` DNS server with `autoOutboundsInterface`, skip them, unless another interface uses them as well, as they would lead back into the TUN.
|
||||
|
||||
|
||||
@@ -115,6 +115,7 @@ func (t *WindowsTun) Start() (err error) {
|
||||
for _, ip := range t.options.DNS {
|
||||
dns = append(dns, netip.MustParseAddr(ip))
|
||||
}
|
||||
dns6 := slices.ContainsFunc(dns, netip.Addr.Is6)
|
||||
|
||||
var route4, route6 bool
|
||||
routesMap := make(map[winipcfg.RouteData]struct{})
|
||||
@@ -175,7 +176,7 @@ startOver:
|
||||
if err != nil {
|
||||
// With IPv6 disabled system-wide (DisabledComponents), the adapter has no
|
||||
// IPv6 interface at all. Skip the family unless the config asks for it.
|
||||
if err == windows.ERROR_NOT_FOUND && family == windows.AF_INET6 && !address6 && !route6 {
|
||||
if err == windows.ERROR_NOT_FOUND && family == windows.AF_INET6 && !address6 && !route6 && !dns6 {
|
||||
continue
|
||||
}
|
||||
return err
|
||||
@@ -204,7 +205,7 @@ startOver:
|
||||
// Skip IPv6 the config does not ask for also when setting its DNS
|
||||
// servers fails, as reported on Windows 11 24H2 with IPv6 disabled
|
||||
// (Access is denied).
|
||||
if family == windows.AF_INET6 && !address6 && !route6 {
|
||||
if family == windows.AF_INET6 && !address6 && !route6 && !dns6 {
|
||||
continue
|
||||
}
|
||||
firstErr = errors.New("unable to set DNS").Base(err)
|
||||
|
||||
Reference in New Issue
Block a user