mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-11-04 03:05:07 +03:00 
			
		
		
		
	Fix IfName 'auto' behaviour on Windows
This commit is contained in:
		
							parent
							
								
									f95ebeb821
								
							
						
					
					
						commit
						3a0870a448
					
				
					 1 changed files with 4 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -9,6 +9,7 @@ import (
 | 
			
		|||
	"strings"
 | 
			
		||||
	"unsafe"
 | 
			
		||||
 | 
			
		||||
	"github.com/yggdrasil-network/yggdrasil-go/src/defaults"
 | 
			
		||||
	"golang.org/x/sys/windows"
 | 
			
		||||
 | 
			
		||||
	wgtun "golang.zx2c4.com/wireguard/tun"
 | 
			
		||||
| 
						 | 
				
			
			@ -19,6 +20,9 @@ import (
 | 
			
		|||
 | 
			
		||||
// Configures the TUN adapter with the correct IPv6 address and MTU.
 | 
			
		||||
func (tun *TunAdapter) setup(ifname string, addr string, mtu int) error {
 | 
			
		||||
	if ifname == "auto" {
 | 
			
		||||
		ifname = defaults.GetDefaults().IfName
 | 
			
		||||
	}
 | 
			
		||||
	var err error
 | 
			
		||||
	err = doAsSystem(func() {
 | 
			
		||||
		iface, err := wgtun.CreateTUN(ifname, mtu)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue