diff options
Diffstat (limited to 'services/errors.go')
-rw-r--r-- | services/errors.go | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/services/errors.go b/services/errors.go index 7a441778..c0588494 100644 --- a/services/errors.go +++ b/services/errors.go @@ -1,13 +1,12 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2017-2019 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package services import ( "fmt" - "syscall" "golang.org/x/sys/windows" ) @@ -18,18 +17,19 @@ const ( ErrorSuccess Error = iota ErrorRingloggerOpen ErrorLoadConfiguration - ErrorCreateWintun - ErrorUAPIListen + ErrorCreateNetworkAdapter ErrorDNSLookup ErrorFirewall ErrorDeviceSetConfig + ErrorDeviceBringUp ErrorBindSocketsToDefaultRoutes + ErrorMonitorMTUChanges ErrorSetNetConfig ErrorDetermineExecutablePath - ErrorOpenNULFile ErrorTrackTunnels ErrorEnumerateSessions ErrorDropPrivileges + ErrorRunScript ErrorWin32 ) @@ -43,28 +43,30 @@ func (e Error) Error() string { return "Unable to determine path of running executable" case ErrorLoadConfiguration: return "Unable to load configuration from path" - case ErrorCreateWintun: - return "Unable to create Wintun interface" - case ErrorUAPIListen: - return "Unable to listen on named pipe" + case ErrorCreateNetworkAdapter: + return "Unable to create network adapter" case ErrorDNSLookup: return "Unable to resolve one or more DNS hostname endpoints" case ErrorFirewall: return "Unable to enable firewall rules" case ErrorDeviceSetConfig: return "Unable to set device configuration" + case ErrorDeviceBringUp: + return "Unable to bring up adapter" case ErrorBindSocketsToDefaultRoutes: return "Unable to bind sockets to default route" + case ErrorMonitorMTUChanges: + return "Unable to monitor default route MTU for changes" case ErrorSetNetConfig: - return "Unable to set interface addresses, routes, dns, and/or interface settings" - case ErrorOpenNULFile: - return "Unable to open NUL file" + return "Unable to configure adapter network settings" case ErrorTrackTunnels: return "Unable to track existing tunnels" case ErrorEnumerateSessions: return "Unable to enumerate current sessions" case ErrorDropPrivileges: return "Unable to drop privileges" + case ErrorRunScript: + return "An error occurred while running a configuration script command" case ErrorWin32: return "An internal Windows error has occurred" default: @@ -73,7 +75,7 @@ func (e Error) Error() string { } func DetermineErrorCode(err error, serviceError Error) (bool, uint32) { - if syserr, ok := err.(syscall.Errno); ok { + if syserr, ok := err.(windows.Errno); ok { return false, uint32(syserr) } else if serviceError != ErrorSuccess { return true, uint32(serviceError) @@ -85,7 +87,7 @@ func DetermineErrorCode(err error, serviceError Error) (bool, uint32) { func CombineErrors(err error, serviceError Error) error { if serviceError != ErrorSuccess { if err != nil { - return fmt.Errorf("%v: %v", serviceError, err) + return fmt.Errorf("%v: %w", serviceError, err) } return serviceError } |