mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-11-04 11:15:07 +03:00 
			
		
		
		
	Per-platform TUN defaults
This commit is contained in:
		
							parent
							
								
									bec898a326
								
							
						
					
					
						commit
						4917ea3dd2
					
				
					 8 changed files with 56 additions and 26 deletions
				
			
		| 
						 | 
				
			
			@ -7,9 +7,12 @@ import water "github.com/neilalexander/water"
 | 
			
		|||
// This is to catch unsupported platforms
 | 
			
		||||
// If your platform supports tun devices, you could try configuring it manually
 | 
			
		||||
 | 
			
		||||
func defaultTUNParameters() tunDefaultParameters {
 | 
			
		||||
func getDefaults() tunDefaultParameters {
 | 
			
		||||
	return tunDefaultParameters{
 | 
			
		||||
		maxMTU: 65535,
 | 
			
		||||
		maximumIfMTU:     65535,
 | 
			
		||||
		defaultIfMTU:     DEFAULT_MTU,
 | 
			
		||||
		defaultIfName:    "none",
 | 
			
		||||
		defaultIfTAPMode: false,
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -25,7 +28,7 @@ func (tun *tunDevice) setup(ifname string, iftapmode bool, addr string, mtu int)
 | 
			
		|||
		panic(err)
 | 
			
		||||
	}
 | 
			
		||||
	tun.iface = iface
 | 
			
		||||
	tun.mtu = getMTUFromMax(mtu)
 | 
			
		||||
	tun.mtu = getSupportedMTU(mtu)
 | 
			
		||||
	return tun.setupAddress(addr)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue