mirror of
				https://github.com/yggdrasil-network/water.git
				synced 2025-10-31 01:05:10 +03:00 
			
		
		
		
	Unexported the error.
This commit is contained in:
		
							parent
							
								
									b78551478a
								
							
						
					
					
						commit
						c3b4ba2cd8
					
				
					 1 changed files with 5 additions and 6 deletions
				
			
		|  | @ -9,6 +9,7 @@ package water | ||||||
| import ( | import ( | ||||||
| 	"bytes" | 	"bytes" | ||||||
| 	"errors" | 	"errors" | ||||||
|  | 	"fmt" | ||||||
| 	"net" | 	"net" | ||||||
| 	"os" | 	"os" | ||||||
| 	"syscall" | 	"syscall" | ||||||
|  | @ -17,9 +18,7 @@ import ( | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| var ( | var ( | ||||||
| 	IfceNameNotFound  = errors.New("Failed to find the name of interface.") | 	ifceNameNotFound = errors.New("Failed to find the name of interface.") | ||||||
| 	TapDeviceNotFound = errors.New("Failed to find the tap device in registry with specified ComponentId, TAP driver may be not installed.") |  | ||||||
| 	RegistryOpenErr   = errors.New("Failed to open the adapter registry, TAP driver may be not installed.") |  | ||||||
| 	// Device Control Codes | 	// Device Control Codes | ||||||
| 	tap_win_ioctl_get_mac             = tap_control_code(1, 0) | 	tap_win_ioctl_get_mac             = tap_control_code(1, 0) | ||||||
| 	tap_win_ioctl_get_version         = tap_control_code(2, 0) | 	tap_win_ioctl_get_version         = tap_control_code(2, 0) | ||||||
|  | @ -52,7 +51,7 @@ func getdeviceid() (string, error) { | ||||||
| 	regkey := `SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}` | 	regkey := `SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}` | ||||||
| 	k, err := registry.OpenKey(registry.LOCAL_MACHINE, regkey, registry.READ) | 	k, err := registry.OpenKey(registry.LOCAL_MACHINE, regkey, registry.READ) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return "", RegistryOpenErr | 		return "", fmt.Errorf("Failed to open the adapter registry, TAP driver may be not installed, %v", err) | ||||||
| 	} | 	} | ||||||
| 	defer k.Close() | 	defer k.Close() | ||||||
| 	// read all subkeys, it should not return an err here | 	// read all subkeys, it should not return an err here | ||||||
|  | @ -82,7 +81,7 @@ func getdeviceid() (string, error) { | ||||||
| 		} | 		} | ||||||
| 		key.Close() | 		key.Close() | ||||||
| 	} | 	} | ||||||
| 	return "", TapDeviceNotFound | 	return "", fmt.Errorf("Failed to find the tap device in registry with specified ComponentId(%s), TAP driver may be not installed.", componentId) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // openDev find and open an interface. | // openDev find and open an interface. | ||||||
|  | @ -154,7 +153,7 @@ func openDev(isTAP bool) (ifce *Interface, err error) { | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	err = IfceNameNotFound | 	err = ifceNameNotFound | ||||||
| 	return | 	return | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 lucus
						lucus