mirror of
				https://github.com/yggdrasil-network/water.git
				synced 2025-11-04 03:05:10 +03:00 
			
		
		
		
	linux: Re-adds NewTAP/NewTUN Functions
This commit is contained in:
		
							parent
							
								
									771a72e2ea
								
							
						
					
					
						commit
						15d1b3ddbb
					
				
					 1 changed files with 32 additions and 0 deletions
				
			
		
							
								
								
									
										32
									
								
								if_linux.go
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								if_linux.go
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,32 @@
 | 
			
		|||
// +build linux
 | 
			
		||||
 | 
			
		||||
package water
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// NewTAP creates a new TAP interface whose name is ifName. If ifName is empty, a
 | 
			
		||||
// default name (tap0, tap1, ... ) will be assigned. ifName should not exceed
 | 
			
		||||
// 16 bytes. TAP interfaces are not supported on darwin.
 | 
			
		||||
// ifName cannot be specified on windows, you will need ifce.Name() to use some cmds.
 | 
			
		||||
//
 | 
			
		||||
// Deprecated: This function may be removed in the future. Please use New() instead.
 | 
			
		||||
func NewTAP(ifName string) (ifce *Interface, err error) {
 | 
			
		||||
	fmt.Println("Deprecated: NewTAP(..) may be removed in the future. Please use New() instead.")
 | 
			
		||||
	config := Config{DeviceType: TAP}
 | 
			
		||||
	config.Name = ifName
 | 
			
		||||
	return newTAP(config)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewTUN creates a new TUN interface whose name is ifName. If ifName is empty, a
 | 
			
		||||
// default name (tap0, tap1, ... ) will be assigned. ifName should not exceed
 | 
			
		||||
// ifName cannot be specified on windows, you will need ifce.Name() to use some cmds.
 | 
			
		||||
//
 | 
			
		||||
// Deprecated: This function will be removed in the future. Please use New() instead.
 | 
			
		||||
func NewTUN(ifName string) (ifce *Interface, err error) {
 | 
			
		||||
	fmt.Println("Deprecated: NewTUN(..) may be removed in the future. Please use New() instead.")
 | 
			
		||||
	config := Config{DeviceType: TUN}
 | 
			
		||||
	config.Name = ifName
 | 
			
		||||
	return newTUN(config)
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue