mirror of
https://github.com/XTLS/Xray-core.git
synced 2024-11-05 04:29:19 +02:00
0ac7da2fc8
* feat: wireguard inbound * feat(command): generate wireguard compatible keypair * feat(wireguard): connection idle timeout * fix(wireguard): close endpoint after connection closed * fix(wireguard): resolve conflicts * feat(wireguard): set cubic as default cc algorithm in gVisor TUN * chore(wireguard): resolve conflict * chore(wireguard): remove redurant code * chore(wireguard): remove redurant code * feat: rework server for gvisor tun * feat: keep user-space tun as an option * fix: exclude android from native tun build * feat: auto kernel tun * fix: build * fix: regulate function name & fix test
33 lines
868 B
Go
33 lines
868 B
Go
package wireguard
|
|
|
|
func (c *DeviceConfig) preferIP4() bool {
|
|
return c.DomainStrategy == DeviceConfig_FORCE_IP ||
|
|
c.DomainStrategy == DeviceConfig_FORCE_IP4 ||
|
|
c.DomainStrategy == DeviceConfig_FORCE_IP46
|
|
}
|
|
|
|
func (c *DeviceConfig) preferIP6() bool {
|
|
return c.DomainStrategy == DeviceConfig_FORCE_IP ||
|
|
c.DomainStrategy == DeviceConfig_FORCE_IP6 ||
|
|
c.DomainStrategy == DeviceConfig_FORCE_IP64
|
|
}
|
|
|
|
func (c *DeviceConfig) hasFallback() bool {
|
|
return c.DomainStrategy == DeviceConfig_FORCE_IP46 || c.DomainStrategy == DeviceConfig_FORCE_IP64
|
|
}
|
|
|
|
func (c *DeviceConfig) fallbackIP4() bool {
|
|
return c.DomainStrategy == DeviceConfig_FORCE_IP64
|
|
}
|
|
|
|
func (c *DeviceConfig) fallbackIP6() bool {
|
|
return c.DomainStrategy == DeviceConfig_FORCE_IP46
|
|
}
|
|
|
|
func (c *DeviceConfig) createTun() tunCreator {
|
|
if c.KernelMode {
|
|
return createKernelTun
|
|
}
|
|
return createGVisorTun
|
|
}
|