mirror of
https://github.com/sshnet/SSH.NET.git
synced 2026-09-10 09:15:47 +00:00
Add SSH Forwarding into documentation
This commit is contained in:
+1
-1
@@ -8,7 +8,7 @@
|
||||
<codeExample>
|
||||
<list class="ordered">
|
||||
<listItem>
|
||||
<para>Display exit status when command is executed..</para>
|
||||
<para>Display exit status when command is executed.</para>
|
||||
<code language="cs">
|
||||
using (var client = new SshClient("host", "username", "password"))
|
||||
{
|
||||
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<topic id="07e8ea92-89dd-45ab-a35f-34a3202243e1" revisionNumber="1">
|
||||
<developerHowToDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<content>
|
||||
<codeExample>
|
||||
<para>Start and stop local port forwarding.</para>
|
||||
<code language="cs">
|
||||
using (var client = new SshClient("host", "username", "password"))
|
||||
{
|
||||
client.Connect();
|
||||
var port = client.AddForwardedPort<ForwardedPortLocal>(8084, "host to be forwarded", 80);
|
||||
port.Exception += delegate(object sender, ExceptionEventArgs e)
|
||||
{
|
||||
Console.WriteLine(e.Exception.ToString());
|
||||
};
|
||||
port.Start();
|
||||
|
||||
Thread.Sleep(1000 * 60 * 20); // Wait 20 minutes for port to be forwarded
|
||||
|
||||
port.Stop();
|
||||
}
|
||||
</code>
|
||||
</codeExample>
|
||||
</content>
|
||||
<relatedTopics>
|
||||
<codeEntityReference>T:Renci.SshClient.SshClient</codeEntityReference>
|
||||
<codeEntityReference>T:Renci.SshClient.ForwardedPortLocal</codeEntityReference>
|
||||
</relatedTopics>
|
||||
</developerHowToDocument>
|
||||
</topic>
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<topic id="a28b7535-bc8c-4635-a60a-d9067e60f1c9" revisionNumber="1">
|
||||
<developerOrientationDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<content>
|
||||
<codeExample>
|
||||
<para>Start and stop local port forwarding.</para>
|
||||
<code language="cs">
|
||||
using (var client = new SshClient("host", "username", "password"))
|
||||
{
|
||||
client.Connect();
|
||||
var port = client.AddForwardedPort<ForwardedPortRemote>(8082, "host to be forwarded", 80);
|
||||
port.Exception += delegate(object sender, ExceptionEventArgs e)
|
||||
{
|
||||
Console.WriteLine(e.Exception.ToString());
|
||||
};
|
||||
port.Start();
|
||||
|
||||
Thread.Sleep(1000 * 60 * 20); // Wait 20 minutes for port to be forwarded
|
||||
|
||||
port.Stop();
|
||||
}
|
||||
</code>
|
||||
</codeExample>
|
||||
</content>
|
||||
<relatedTopics>
|
||||
<codeEntityReference>T:Renci.SshClient.SshClient</codeEntityReference>
|
||||
<codeEntityReference>T:Renci.SshClient.ForwardedPortLocal</codeEntityReference>
|
||||
</relatedTopics>
|
||||
</developerOrientationDocument>
|
||||
</topic>
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<topic id="f4ce1bdd-403f-45ec-a622-86c05a4bd913" revisionNumber="1">
|
||||
<developerHowToDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<introduction>
|
||||
<para>Port forwarding supported for remote and local ports.</para>
|
||||
<para>Multiple port can be forwarded simultaneously.</para>
|
||||
<para>To start port forwarding you need to create an <codeEntityReference>T:Renci.SshClient.ForwardedPortLocal</codeEntityReference> or <codeEntityReference>T:Renci.SshClient.ForwardedPortRemote </codeEntityReference> object.
|
||||
Once port object is created you can use <codeEntityReference>M:Renci.SshClient.ForwardedPort.Start</codeEntityReference> start port forwarding or <codeEntityReference>M:Renci.SshClient.ForwardedPort.Stop</codeEntityReference> to stop it.
|
||||
</para>
|
||||
|
||||
<alert class="tip">
|
||||
<para>An exception can be thrown while port is forwarded. When this happens an <codeEntityReference>E:Renci.SshClient.ForwardedPort.Exception</codeEntityReference> event is raised.</para>
|
||||
</alert>
|
||||
|
||||
</introduction>
|
||||
</developerHowToDocument>
|
||||
</topic>
|
||||
@@ -18,6 +18,10 @@
|
||||
<Topic id="b9451bd3-f759-4964-8f42-b48b06c19dca" visible="True" tocTitle="Timeout" />
|
||||
</Topic>
|
||||
<Topic id="addfc69b-01c2-49cc-8e4d-9c8bada86d6c" visible="True" title="SFtp" />
|
||||
<Topic id="f4ce1bdd-403f-45ec-a622-86c05a4bd913" visible="True" tocTitle="Port Forwarding">
|
||||
<Topic id="07e8ea92-89dd-45ab-a35f-34a3202243e1" visible="True" tocTitle="Local" />
|
||||
<Topic id="a28b7535-bc8c-4635-a60a-d9067e60f1c9" visible="True" tocTitle="Remote" />
|
||||
</Topic>
|
||||
</Topic>
|
||||
<Topic id="8e553ec7-3a42-4bd1-9252-b9b3c957b454" visible="True" apiParentMode="InsertAsChild" title="Programming Reference" />
|
||||
</Topic>
|
||||
|
||||
@@ -272,6 +272,9 @@
|
||||
<None Include="Documentation\Content\Guide\Guide.Connection.PrivateKey.aml" />
|
||||
<None Include="Documentation\Content\Guide\Guide.Connection.Prompt.aml" />
|
||||
<None Include="Documentation\Content\Guide\Guide.Connection.Timeout.aml" />
|
||||
<None Include="Documentation\Content\Guide\Guide.PortForward.aml" />
|
||||
<None Include="Documentation\Content\Guide\Guide.PortForward.Local.aml" />
|
||||
<None Include="Documentation\Content\Guide\Guide.PortForward.Remote.aml" />
|
||||
<None Include="Documentation\Content\Guide\Guide.SFtp.aml" />
|
||||
<None Include="Documentation\Content\HowTo.Connect.aml" />
|
||||
<None Include="Documentation\Content\Reference.aml" />
|
||||
|
||||
Reference in New Issue
Block a user