mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-11-04 03:05:07 +03:00 
			
		
		
		
	Reuse GUID so Windows no longer keeps creating new networks each time Yggdrasil starts
This commit is contained in:
		
							parent
							
								
									baebaabc43
								
							
						
					
					
						commit
						0529910b01
					
				
					 1 changed files with 6 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -24,8 +24,13 @@ func (tun *TunAdapter) setup(ifname string, addr string, mtu int) error {
 | 
			
		|||
		ifname = defaults.GetDefaults().DefaultIfName
 | 
			
		||||
	}
 | 
			
		||||
	var err error
 | 
			
		||||
	var iface wgtun.Device
 | 
			
		||||
	err = doAsSystem(func() {
 | 
			
		||||
		iface, err := wgtun.CreateTUN(ifname, mtu)
 | 
			
		||||
		if guid, gerr := windows.GUIDFromString("{8f59971a-7872-4aa6-b2eb-061fc4e9d0a7}"); gerr == nil {
 | 
			
		||||
			iface, err = wgtun.CreateTUNWithRequestedGUID(ifname, &guid, mtu)
 | 
			
		||||
		} else {
 | 
			
		||||
			panic(gerr)
 | 
			
		||||
		}
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			panic(err)
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue