mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-04-30 17:38:41 +00:00
WireGuard config: Replace kernelMode
with noKernelTun
https://github.com/XTLS/Xray-core/pull/3871#issuecomment-2420770309
This commit is contained in:
parent
b0272c172a
commit
9bdf72d658
6 changed files with 58 additions and 65 deletions
|
@ -1,5 +1,11 @@
|
|||
package wireguard
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/xtls/xray-core/common/errors"
|
||||
)
|
||||
|
||||
func (c *DeviceConfig) preferIP4() bool {
|
||||
return c.DomainStrategy == DeviceConfig_FORCE_IP ||
|
||||
c.DomainStrategy == DeviceConfig_FORCE_IP4 ||
|
||||
|
@ -25,8 +31,17 @@ func (c *DeviceConfig) fallbackIP6() bool {
|
|||
}
|
||||
|
||||
func (c *DeviceConfig) createTun() tunCreator {
|
||||
if c.KernelMode {
|
||||
return createKernelTun
|
||||
if c.NoKernelTun {
|
||||
return createGVisorTun
|
||||
}
|
||||
return createGVisorTun
|
||||
kernelTunSupported, err := KernelTunSupported()
|
||||
if err != nil {
|
||||
errors.LogWarning(context.Background(), "Using gVisor TUN. Failed to check kernel TUN support:", err)
|
||||
return createGVisorTun
|
||||
}
|
||||
if !kernelTunSupported {
|
||||
errors.LogWarning(context.Background(), "Using gVisor TUN. Kernel TUN is not supported on your OS, or your permission is insufficient.)")
|
||||
return createGVisorTun
|
||||
}
|
||||
return createKernelTun
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue