More refactor

This commit is contained in:
Bolke de Bruin 2020-07-20 15:51:23 +02:00
parent 33290f59e6
commit e9b7b352cf
5 changed files with 180 additions and 570 deletions

View file

@ -1,5 +1,7 @@
package main
import "github.com/bolkedebruin/rdpgw/protocol"
// RejectOption represents an option used to control the way connection is
// rejected.
type RejectOption func(*rejectConnectionError)
@ -22,7 +24,7 @@ func RejectionStatus(code int) RejectOption {
// RejectionHeader returns an option that makes connection to be rejected with
// given HTTP headers.
func RejectionHeader(h HandshakeHeader) RejectOption {
func RejectionHeader(h protocol.HandshakeHeader) RejectOption {
return func(err *rejectConnectionError) {
err.header = h
}
@ -44,7 +46,7 @@ func RejectConnectionError(options ...RejectOption) error {
type rejectConnectionError struct {
reason string
code int
header HandshakeHeader
header protocol.HandshakeHeader
}
// Error implements error interface.