Skip to content

Commit a72c6b9

Browse files
committed
Integrate SslOption into AmqpTcpEndpoint
* Create an SslOption member in AmqpTcpEndpoint * Add the SslIsEnabled flag to allow explicit control of feature * Implement UseSsl() to allow convenient method to supply SslOption values
1 parent 4967d8b commit a72c6b9

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

src/client/api/AmqpTcpEndpoint.cs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,22 @@ public int Port
9191
set { m_port = value; }
9292
}
9393

94+
private bool m_sslIsEnabled;
95+
96+
public bool SslIsEnabled
97+
{
98+
get { return m_sslIsEnabled; }
99+
set { m_sslIsEnabled = value; }
100+
}
101+
102+
private SslOption m_sslOption;
103+
///<summary>Retrieve the SSL options for this AmqpTcpEndpoint.
104+
///If not set, null is returned</summary>
105+
public SslOption SslOption
106+
{
107+
get { return m_sslOption; }
108+
}
109+
94110
///<summary>Construct an AmqpTcpEndpoint with the given
95111
///IProtocol, hostname, and port number. If the port number is
96112
///-1, the default port number for the IProtocol will be
@@ -102,6 +118,22 @@ public AmqpTcpEndpoint(IProtocol protocolVariant, string hostname, int portOrMin
102118
m_port = portOrMinusOne;
103119
}
104120

121+
public void UseSsl(string certPath, string serverName)
122+
{
123+
m_sslOption = new SslOption(serverName, certPath);
124+
m_sslIsEnabled = true;
125+
}
126+
127+
public void UseSsl(string certPath)
128+
{
129+
UseSsl(certPath, m_hostName);
130+
}
131+
132+
public void UseSsl()
133+
{
134+
UseSsl("", m_hostName);
135+
}
136+
105137
///<summary>Returns a URI-like string of the form
106138
///amqp-PROTOCOL://HOSTNAME:PORTNUMBER</summary>
107139
///<remarks>

0 commit comments

Comments
 (0)