diff --git a/errors.go b/errors.go deleted file mode 100644 index b4a5830aaffc95ef19c3702500c0ca3cd6ad75be..0000000000000000000000000000000000000000 --- a/errors.go +++ /dev/null @@ -1,55 +0,0 @@ -package main - -import "github.com/bolkedebruin/rdpgw/protocol" - -// RejectOption represents an option used to control the way connection is -// rejected. -type RejectOption func(*rejectConnectionError) - -// RejectionReason returns an option that makes connection to be rejected with -// given reason. -func RejectionReason(reason string) RejectOption { - return func(err *rejectConnectionError) { - err.reason = reason - } -} - -// RejectionStatus returns an option that makes connection to be rejected with -// given HTTP status code. -func RejectionStatus(code int) RejectOption { - return func(err *rejectConnectionError) { - err.code = code - } -} - -// RejectionHeader returns an option that makes connection to be rejected with -// given HTTP headers. -func RejectionHeader(h protocol.HandshakeHeader) RejectOption { - return func(err *rejectConnectionError) { - err.header = h - } -} -// 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) - for _, opt := range options { - opt(err) - } - return err -} - -// rejectConnectionError represents a rejection of upgrade error. -// -// It can be returned by Upgrader's On* hooks to control the way WebSocket -// handshake is rejected. -type rejectConnectionError struct { - reason string - code int - header protocol.HandshakeHeader -} - -// Error implements error interface. -func (r *rejectConnectionError) Error() string { - return r.reason -} diff --git a/protocol/rdpgw.go b/protocol/rdpgw.go index eb5d0e3aec3ef34e536f075b818bf4c59fd04f28..bc337b01b280cb447a91182a581f0342a4d3a364 100644 --- a/protocol/rdpgw.go +++ b/protocol/rdpgw.go @@ -5,7 +5,6 @@ import ( "github.com/gorilla/websocket" "github.com/patrickmn/go-cache" "github.com/prometheus/client_golang/prometheus" - "io" "log" "net/http" "time" @@ -40,12 +39,6 @@ var ( }) ) -// HandshakeHeader is the interface that writes both upgrade request or -// response headers into a given io.Writer. -type HandshakeHeader interface { - io.WriterTo -} - type SessionInfo struct { ConnId string CorrelationId string