Esempio n. 1
0
        internal virtual ForwardedPort CreateForwardedPort()
        {
            // TODO: Instantiate an appropriate concrete class.
            ForwardedPort target = null;

            return(target);
        }
Esempio n. 2
0
        public void StartTest()
        {
            ForwardedPort target = CreateForwardedPort(); // TODO: Initialize to an appropriate value

            target.Start();
            Assert.Inconclusive("A method that does not return a value cannot be verified.");
        }
        public ForwardedPortConnectionViewModel(ForwardedPort forwardedPort, string connectionName)
        {
            ForwardedPort.Value  = forwardedPort;
            ConnectionName.Value = connectionName;
            DisplayText          = ForwardedPort.CombineLatest(ConnectionName, (fp_, name) =>
            {
                var endpoints = "";
                switch (fp_)
                {
                case ForwardedPortLocal fp:
                    endpoints = $"{fp.BoundHost}:{fp.BoundPort} => {fp.Host}:{fp.Port}";
                    break;

                case ForwardedPortRemote fp:
                    endpoints = $"{fp.BoundHost}:{fp.BoundPort} => {fp.Host}:{fp.Port}";
                    break;

                case ForwardedPortDynamic fp:
                    endpoints = $"{fp.BoundHost}:{fp.BoundPort}";
                    break;
                }
                return(string.IsNullOrWhiteSpace(name) ? endpoints : $"{name} ({endpoints})");
            }).ToReactiveProperty();

            TypeInitial = ForwardedPort.CombineLatest(ConnectionName,
                                                      (fp_, name) => fp_.GetType().Name.Replace("ForwardedPort", "")[0].ToString()).ToReactiveProperty();
        }
Esempio n. 4
0
        public void RemoveForwardedPortTest()
        {
            ConnectionInfo connectionInfo = null;                          // TODO: Initialize to an appropriate value
            SshClient      target         = new SshClient(connectionInfo); // TODO: Initialize to an appropriate value
            ForwardedPort  port           = null;                          // TODO: Initialize to an appropriate value

            target.RemoveForwardedPort(port);
            Assert.Inconclusive("A method that does not return a value cannot be verified.");
        }
        public override async Task Connect()
        {
            if (!ForwardedPort.Value.IsStarted)
            {
                await Task.Run(() =>
                {
                    ForwardedPort.Value.Start();
                });

                ForwardedPort.ForceNotify();
                IsConnected.Value = true;
            }
        }
Esempio n. 6
0
 public void Init()
 {
     if (Type == TunnelTypes.Dynamic)
     {
         NativePort = string.IsNullOrEmpty(ForwardedAddress) ? new ForwardedPortDynamic(ForwardedPort) : new ForwardedPortDynamic(ForwardedAddress, ForwardedPort);
     }
     else if (Type == TunnelTypes.Remote)
     {
         var remoteIp = IPAddress.Parse(RemoteAddress);
         var localIp  = IPAddress.Parse(ForwardedAddress);
         NativePort = new ForwardedPortRemote(localIp, ForwardedPort, remoteIp, RemotePort);
     }
     else
     {
         NativePort = new ForwardedPortLocal(ForwardedPort, RemoteAddress, ForwardedPort);
     }
 }
Esempio n. 7
0
        public string this[string name]
        {
            get
            {
                string result = null;

                if (name == "ForwardedPort")
                {
                    if (ForwardedPort != null && !ForwardedPort.IsPort())
                    {
                        result = "Invalid port format";
                    }
                }

                return(result);
            }
        }
Esempio n. 8
0
        /// <summary>
        /// Thread
        /// </summary>
        /// <param name="o">Parameters</param>
        void jobRun(object o)
        {
            SshClient     ssh  = (SshClient)((object[])o)[0];
            ForwardedPort port = (ForwardedPort)((object[])o)[1];

            ssh.AddForwardedPort(port);
            port.RequestReceived += (sender2, e2) =>
            {
                WriteInfo(e2.OriginatorHost + ":" + e2.OriginatorPort);
            };

            port.Start();

            while (port.IsStarted)
            {
                Thread.Sleep(10);
            }
        }
 protected override void Act()
 {
     ForwardedPort.Stop();
 }