Example #1
0
        public override void Dispose()
        {
            if (_subBackend != null)
            {
                _subBackend.Dispose();
                _subBackend = null;
            }

            if (_client != null)
            {
                _client.Dispose();
                _client = null;
            }
        }
Example #2
0
        public Proxy(Target target)
        {
            _client = new SshClient(target.ProxyServer.Host,
                target.ProxyServer.UserInfo,
                target.ProxyPassword);
            _client.Connect();

            var fwPort = new ForwardedPortLocal("127.0.0.1",0, target.TargetServer.Host, (uint) target.TargetServer.Port);
            _client.AddForwardedPort(fwPort);
            fwPort.Start();

            var port = HackExtractPort(fwPort); // TODO: Update the library to read it directly from BoundPort

            _localUri = string.Format("{0}://{1}@127.0.0.1:{2}{3}", target.TargetServer.Scheme,
                target.TargetServer.UserInfo,
                port,
                target.TargetServer.LocalPath);

            _subBackend = Backend.OpenBackend(new Uri(_localUri), target.Password);
        }