mirror of
https://github.com/cloudflare/cloudflared.git
synced 2025-07-28 12:59:57 +00:00
TUN-8685: Bump coredns dependency
Closes TUN-8685
This commit is contained in:
29
vendor/github.com/gobwas/ws/errors.go
generated
vendored
29
vendor/github.com/gobwas/ws/errors.go
generated
vendored
@@ -2,12 +2,12 @@ package ws
|
||||
|
||||
// RejectOption represents an option used to control the way connection is
|
||||
// rejected.
|
||||
type RejectOption func(*rejectConnectionError)
|
||||
type RejectOption func(*ConnectionRejectedError)
|
||||
|
||||
// RejectionReason returns an option that makes connection to be rejected with
|
||||
// given reason.
|
||||
func RejectionReason(reason string) RejectOption {
|
||||
return func(err *rejectConnectionError) {
|
||||
return func(err *ConnectionRejectedError) {
|
||||
err.reason = reason
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@ func RejectionReason(reason string) RejectOption {
|
||||
// RejectionStatus returns an option that makes connection to be rejected with
|
||||
// given HTTP status code.
|
||||
func RejectionStatus(code int) RejectOption {
|
||||
return func(err *rejectConnectionError) {
|
||||
return func(err *ConnectionRejectedError) {
|
||||
err.code = code
|
||||
}
|
||||
}
|
||||
@@ -23,32 +23,37 @@ func RejectionStatus(code int) RejectOption {
|
||||
// RejectionHeader returns an option that makes connection to be rejected with
|
||||
// given HTTP headers.
|
||||
func RejectionHeader(h HandshakeHeader) RejectOption {
|
||||
return func(err *rejectConnectionError) {
|
||||
return func(err *ConnectionRejectedError) {
|
||||
err.header = h
|
||||
}
|
||||
}
|
||||
|
||||
// RejectConnectionError constructs an error that could be used to control the way
|
||||
// handshake is rejected by Upgrader.
|
||||
// RejectConnectionError constructs an error that could be used to control the
|
||||
// way handshake is rejected by Upgrader.
|
||||
func RejectConnectionError(options ...RejectOption) error {
|
||||
err := new(rejectConnectionError)
|
||||
err := new(ConnectionRejectedError)
|
||||
for _, opt := range options {
|
||||
opt(err)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// rejectConnectionError represents a rejection of upgrade error.
|
||||
// ConnectionRejectedError represents a rejection of connection during
|
||||
// WebSocket handshake error.
|
||||
//
|
||||
// It can be returned by Upgrader's On* hooks to control the way WebSocket
|
||||
// handshake is rejected.
|
||||
type rejectConnectionError struct {
|
||||
// It can be returned by Upgrader's On* hooks to indicate that WebSocket
|
||||
// handshake should be rejected.
|
||||
type ConnectionRejectedError struct {
|
||||
reason string
|
||||
code int
|
||||
header HandshakeHeader
|
||||
}
|
||||
|
||||
// Error implements error interface.
|
||||
func (r *rejectConnectionError) Error() string {
|
||||
func (r *ConnectionRejectedError) Error() string {
|
||||
return r.reason
|
||||
}
|
||||
|
||||
func (r *ConnectionRejectedError) StatusCode() int {
|
||||
return r.code
|
||||
}
|
||||
|
Reference in New Issue
Block a user