| 1 |
package openvpn |
| 2 |
|
| 3 |
import ( |
| 4 |
"errors" |
| 5 |
"fmt" |
| 6 |
) |
| 7 |
|
| 8 |
var ( |
| 9 |
ErrTimeout = errors.New("timeout") |
| 10 |
ErrEmptyResponse = errors.New("empty response") |
| 11 |
ErrUnknownProtocol = errors.New("unknown protocol") |
| 12 |
ErrInvalidPassword = errors.New("invalid password") |
| 13 |
ErrErrorResponse = errors.New("error response") |
| 14 |
ErrConnectionTerminated = errors.New("openvpn management interface connection terminated") |
| 15 |
ErrUnknownClientReason = errors.New("unknown client reason") |
| 16 |
ErrUnexpectedResponseFromVersionCommand = errors.New("unexpected response from version command") |
| 17 |
ErrRequireManagementInterfaceVersion5 = errors.New("openvpn-auth-oauth2 requires OpenVPN management interface version 5 or higher") |
| 18 |
ErrEnforceUniqueUserUnsupported = errors.New( |
| 19 |
"openvpn.enforce-unique-user requires a direct OpenVPN management interface; the OpenVPN plugin shim is not supported", |
| 20 |
) |
| 21 |
ErrClientSessionStateInvalidOrExpired = errors.New(ReasonStateExpiredOrInvalid) |
| 22 |
) |
| 23 |
|
| 24 |
const ( |
| 25 |
ReasonStateExpiredOrInvalid = "client session state invalid or expired" |
| 26 |
) |
| 27 |
|
| 28 |
// ManagementCommandError reports a rejected OpenVPN management command. |
| 29 |
type ManagementCommandError struct { |
| 30 |
Command string |
| 31 |
Response string |
| 32 |
} |
| 33 |
|
| 34 |
func (e *ManagementCommandError) Error() string { |
| 35 |
return fmt.Sprintf("command error %q: %s", e.Command, e.Response) |
| 36 |
} |
| 37 |
|
| 38 |
func (e *ManagementCommandError) Unwrap() error { |
| 39 |
return ErrErrorResponse |
| 40 |
} |