diff --git a/cmd/rdpgw/protocol/process.go b/cmd/rdpgw/protocol/process.go index ceaf16e..9c4e54d 100644 --- a/cmd/rdpgw/protocol/process.go +++ b/cmd/rdpgw/protocol/process.go @@ -12,9 +12,17 @@ import ( "strconv" "time" + "golang.org/x/net/proxy" + "github.com/wrouesnel/go.connect-proxy-scheme" + "github.com/bolkedebruin/rdpgw/cmd/rdpgw/identity" ) +func init() { + proxy.RegisterDialerType("http", connect_proxy_scheme.ConnectProxy) + proxy.RegisterDialerType("https", connect_proxy_scheme.ConnectProxy) +} + type Processor struct { // gw is the gateway instance on which the connection arrived // Immutable; never nil. @@ -139,7 +147,9 @@ func (p *Processor) Process(ctx context.Context) error { } } log.Printf("Establishing connection to RDP server: %s", host) - p.tunnel.rwc, err = net.DialTimeout("tcp", host, time.Second*15) + ctx, cancel := context.WithTimeout(context.Background(), time.Second*15) + defer cancel() + p.tunnel.rwc, err = proxy.Dial(ctx, "tcp", host) if err != nil { log.Printf("Error connecting to %s, %s", host, err) msg := p.channelResponse(E_PROXY_INTERNALERROR) diff --git a/go.mod b/go.mod index ca53951..fe39fbe 100644 --- a/go.mod +++ b/go.mod @@ -27,7 +27,9 @@ require ( github.com/prometheus/client_golang v1.19.0 github.com/stretchr/testify v1.10.0 github.com/thought-machine/go-flags v1.6.3 + github.com/wrouesnel/go.connect-proxy-scheme v0.0.0-20240822095422-f6d0c8f327b9 golang.org/x/crypto v0.36.0 + golang.org/x/net v0.38.0 golang.org/x/oauth2 v0.18.0 google.golang.org/grpc v1.62.1 google.golang.org/protobuf v1.33.0 @@ -37,23 +39,31 @@ require ( github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect + github.com/dsnet/compress v0.0.1 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/go-jose/go-jose/v3 v3.0.4 // indirect github.com/golang/protobuf v1.5.4 // indirect + github.com/golang/snappy v0.0.4 // indirect github.com/gorilla/securecookie v1.1.2 // indirect github.com/hashicorp/go-uuid v1.0.3 // indirect + github.com/integralist/go-findroot v0.0.0-20160518114804-ac90681525dc // indirect github.com/jcmturner/aescts/v2 v2.0.0 // indirect github.com/jcmturner/dnsutils/v2 v2.0.0 // indirect github.com/jcmturner/rpc/v2 v2.0.3 // indirect github.com/knadh/koanf/maps v0.1.1 // indirect - github.com/kr/text v0.2.0 // indirect + github.com/magefile/mage v1.15.0 // indirect + github.com/mholt/archiver v3.1.1+incompatible // indirect github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect + github.com/nwaples/rardecode v1.1.3 // indirect + github.com/pierrec/lz4 v2.6.1+incompatible // indirect + github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/client_model v0.6.0 // indirect github.com/prometheus/common v0.50.0 // indirect github.com/prometheus/procfs v0.13.0 // indirect - golang.org/x/net v0.38.0 // indirect + github.com/ulikunitz/xz v0.5.12 // indirect + github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect golang.org/x/sys v0.31.0 // indirect golang.org/x/text v0.23.0 // indirect google.golang.org/appengine v1.6.8 // indirect