github.com/xmplusdev/xray-core@v1.8.10/proxy/wireguard/config.go (about) 1 package wireguard 2 3 func (c *DeviceConfig) preferIP4() bool { 4 return c.DomainStrategy == DeviceConfig_FORCE_IP || 5 c.DomainStrategy == DeviceConfig_FORCE_IP4 || 6 c.DomainStrategy == DeviceConfig_FORCE_IP46 7 } 8 9 func (c *DeviceConfig) preferIP6() bool { 10 return c.DomainStrategy == DeviceConfig_FORCE_IP || 11 c.DomainStrategy == DeviceConfig_FORCE_IP6 || 12 c.DomainStrategy == DeviceConfig_FORCE_IP64 13 } 14 15 func (c *DeviceConfig) hasFallback() bool { 16 return c.DomainStrategy == DeviceConfig_FORCE_IP46 || c.DomainStrategy == DeviceConfig_FORCE_IP64 17 } 18 19 func (c *DeviceConfig) fallbackIP4() bool { 20 return c.DomainStrategy == DeviceConfig_FORCE_IP64 21 } 22 23 func (c *DeviceConfig) fallbackIP6() bool { 24 return c.DomainStrategy == DeviceConfig_FORCE_IP46 25 } 26 27 func (c *DeviceConfig) createTun() tunCreator { 28 if c.KernelMode { 29 return createKernelTun 30 } 31 return createGVisorTun 32 }