2023-11-12 20:52:09 +00:00
|
|
|
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
|
|
|
|
}
|
2023-11-18 03:27:17 +00:00
|
|
|
|
|
|
|
func (c *DeviceConfig) createTun() tunCreator {
|
|
|
|
if c.KernelMode {
|
|
|
|
return createKernelTun
|
|
|
|
}
|
|
|
|
return createGVisorTun
|
|
|
|
}
|