48 lines
1.5 KiB
C#
48 lines
1.5 KiB
C#
#nullable enable
|
|
using System;
|
|
using System.Security.Authentication;
|
|
|
|
namespace ShrinkNetwork
|
|
{
|
|
public interface IShrinkNetworkTransport
|
|
{
|
|
bool IsStarted { get; }
|
|
|
|
event Action<ShrinkNetworkTransportEvent> OnEvent;
|
|
|
|
void Start();
|
|
void Stop();
|
|
void Send(long sessionId, byte[] packetData);
|
|
}
|
|
|
|
public interface IShrinkNetworkSessionControlTransport
|
|
{
|
|
bool DisconnectSession(long sessionId, string? reason = null);
|
|
}
|
|
|
|
public sealed class ShrinkTcpTlsOptions
|
|
{
|
|
public bool Enabled { get; set; }
|
|
public string? TargetHost { get; set; }
|
|
public bool AllowInvalidServerCertificate { get; set; }
|
|
public string? ServerCertificatePath { get; set; }
|
|
public string? ServerCertificatePassword { get; set; }
|
|
public bool CheckCertificateRevocation { get; set; } = true;
|
|
public SslProtocols EnabledProtocols { get; set; } = SslProtocols.None;
|
|
|
|
public ShrinkTcpTlsOptions Clone()
|
|
{
|
|
return new ShrinkTcpTlsOptions
|
|
{
|
|
Enabled = Enabled,
|
|
TargetHost = TargetHost,
|
|
AllowInvalidServerCertificate = AllowInvalidServerCertificate,
|
|
ServerCertificatePath = ServerCertificatePath,
|
|
ServerCertificatePassword = ServerCertificatePassword,
|
|
CheckCertificateRevocation = CheckCertificateRevocation,
|
|
EnabledProtocols = EnabledProtocols
|
|
};
|
|
}
|
|
}
|
|
}
|