-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors.go
More file actions
69 lines (58 loc) · 2.18 KB
/
Copy patherrors.go
File metadata and controls
69 lines (58 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package openconnect
import E "github.com/sagernet/sing/common/exceptions"
var (
ErrMissingServer = E.New("missing openconnect server")
ErrUnsupportedFlavor = E.New("unsupported openconnect flavor")
ErrClientClosed = E.New("client is closed")
ErrDataChannelNotReady = E.New("data channel is not ready")
ErrNoPendingAuthChallenge = E.New("no pending openconnect authentication challenge")
ErrAuthChallengeNotAnswerable = E.New("authentication challenge does not accept a response")
ErrAuthChallengeCanceled = E.New("authentication challenge canceled")
ErrInvalidAuthResponse = E.New("invalid openconnect authentication response")
ErrAuthenticationFailed = E.New("authentication failed")
ErrSessionRejected = E.New("session rejected")
ErrInvalidBrowserAuthentication = E.New("invalid openconnect browser authentication result")
ErrMaterialSourceConflict = E.New("material path and content are both set")
ErrInvalidTLSMaterial = E.New("invalid openconnect TLS material")
ErrDeprecatedCryptoDisabled = E.New("deprecated cryptography is disabled")
ErrReconnectTimeout = E.New("reconnect timeout exceeded")
ErrProtocolNotSupported = E.New("protocol behavior is not supported")
errTunnelConfiguration = E.New("tunnel configuration callback failed")
)
type retryableAuthenticationError struct {
err error
cacheKeys []string
}
func (e *retryableAuthenticationError) Error() string {
return e.err.Error()
}
func (e *retryableAuthenticationError) Unwrap() error {
return ErrAuthenticationFailed
}
func newRetryableAuthenticationError(err error, cacheKeys ...string) error {
if err == nil {
err = ErrAuthenticationFailed
}
return &retryableAuthenticationError{
err: err,
cacheKeys: append([]string(nil), cacheKeys...),
}
}
type terminalError struct {
err error
}
func (e *terminalError) Error() string {
return e.err.Error()
}
func (e *terminalError) Unwrap() error {
return e.err
}
func (e *terminalError) Terminal() bool {
return true
}
func markTerminal(err error) error {
if err == nil {
return nil
}
return &terminalError{err: err}
}