mirror of
https://github.com/sshnet/SSH.NET.git
synced 2026-09-10 09:15:47 +00:00
Make ZlibOpenSsh public (#1433)
This commit is contained in:
+4
-1
@@ -11,7 +11,10 @@
|
||||
}
|
||||
],
|
||||
"outputFormat": "apiPage",
|
||||
"output": "api"
|
||||
"output": "api",
|
||||
"properties": {
|
||||
"TargetFramework": "net8.0"
|
||||
}
|
||||
}
|
||||
],
|
||||
"build": {
|
||||
|
||||
@@ -21,8 +21,8 @@ namespace Renci.SshNet.Compression
|
||||
/// </summary>
|
||||
/// <param name="delayedCompression">
|
||||
/// <see langword="false"/> to start compression after receiving SSH_MSG_NEWKEYS.
|
||||
/// <see langword="true"/> to delay compression util receiving SSH_MSG_USERAUTH_SUCCESS.
|
||||
/// <see href="https://www.openssh.com/txt/draft-miller-secsh-compression-delayed-00.txt"/>.
|
||||
/// <see langword="true"/> to delay compression until SSH_MSG_USERAUTH_SUCCESS is received.
|
||||
/// See <see href="https://www.openssh.com/txt/draft-miller-secsh-compression-delayed-00.txt"/>.
|
||||
/// </param>
|
||||
protected Compressor(bool delayedCompression)
|
||||
{
|
||||
|
||||
@@ -5,9 +5,9 @@ using System.IO.Compression;
|
||||
namespace Renci.SshNet.Compression
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents "zlib" compression implementation.
|
||||
/// Represents the "zlib" compression algorithm.
|
||||
/// </summary>
|
||||
internal class Zlib : Compressor
|
||||
public class Zlib : Compressor
|
||||
{
|
||||
private readonly ZLibStream _compressor;
|
||||
private readonly ZLibStream _decompressor;
|
||||
@@ -15,11 +15,20 @@ namespace Renci.SshNet.Compression
|
||||
private MemoryStream _decompressorStream;
|
||||
private bool _isDisposed;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Zlib"/> class.
|
||||
/// </summary>
|
||||
public Zlib()
|
||||
: this(delayedCompression: false)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Zlib"/> class.
|
||||
/// </summary>
|
||||
/// <param name="delayedCompression">
|
||||
/// <inheritdoc cref="Compressor(bool)" path="/param[@name='delayedCompression']"/>
|
||||
/// </param>
|
||||
protected Zlib(bool delayedCompression)
|
||||
: base(delayedCompression)
|
||||
{
|
||||
@@ -30,14 +39,13 @@ namespace Renci.SshNet.Compression
|
||||
_decompressor = new ZLibStream(_decompressorStream, CompressionMode.Decompress);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets algorithm name.
|
||||
/// </summary>
|
||||
/// <inheritdoc/>
|
||||
public override string Name
|
||||
{
|
||||
get { return "zlib"; }
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override byte[] CompressCore(byte[] data, int offset, int length)
|
||||
{
|
||||
_compressorStream.SetLength(0);
|
||||
@@ -48,6 +56,7 @@ namespace Renci.SshNet.Compression
|
||||
return _compressorStream.ToArray();
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override byte[] DecompressCore(byte[] data, int offset, int length)
|
||||
{
|
||||
_decompressorStream.Write(data, offset, length);
|
||||
|
||||
@@ -1,13 +1,20 @@
|
||||
#if NET6_0_OR_GREATER
|
||||
namespace Renci.SshNet.Compression
|
||||
{
|
||||
internal sealed class ZlibOpenSsh : Zlib
|
||||
/// <summary>
|
||||
/// Represents the "zlib@openssh.com" compression algorithm.
|
||||
/// </summary>
|
||||
public class ZlibOpenSsh : Zlib
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ZlibOpenSsh"/> class.
|
||||
/// </summary>
|
||||
public ZlibOpenSsh()
|
||||
: base(delayedCompression: true)
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override string Name
|
||||
{
|
||||
get { return "zlib@openssh.com"; }
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
public abstract class Algorithm
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets algorithm name.
|
||||
/// Gets the algorithm name.
|
||||
/// </summary>
|
||||
public abstract string Name { get; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user