|
14 | 14 | DTLSVersion, |
15 | 15 | HandshakeStep, |
16 | 16 | HelloVerifyRequest, |
17 | | - MbedTLSBuffer, |
| 17 | +) |
| 18 | +from ._tls import MbedTLSBuffer as TLSWrappedBuffer |
| 19 | +from ._tls import ( |
18 | 20 | NextProtocol, |
19 | 21 | Purpose, |
20 | 22 | RaggedEOF, |
@@ -162,82 +164,6 @@ def wrap_buffers(self): |
162 | 164 | return TLSWrappedBuffer(self) |
163 | 165 |
|
164 | 166 |
|
165 | | -class TLSWrappedBuffer: |
166 | | - # _pep543.TLSWrappedBuffer |
167 | | - def __init__(self, context, server_hostname=None): |
168 | | - self._tlsbuf = MbedTLSBuffer(context, server_hostname) |
169 | | - |
170 | | - def __repr__(self): |
171 | | - return "%s(%r)" % (type(self).__name__, self.context) |
172 | | - |
173 | | - def __getstate__(self): |
174 | | - raise TypeError(f"cannot pickle {self.__class__.__name__!r} object") |
175 | | - |
176 | | - @property |
177 | | - def _server_hostname(self): |
178 | | - return self._tlsbuf._server_hostname |
179 | | - |
180 | | - @property |
181 | | - def _handshake_state(self): |
182 | | - return self._tlsbuf._handshake_state |
183 | | - |
184 | | - def read(self, amt): |
185 | | - # PEP 543 |
186 | | - return self._tlsbuf.read(amt) |
187 | | - |
188 | | - def readinto(self, buffer, amt): |
189 | | - # PEP 543 |
190 | | - return self._tlsbuf.readinto(buffer, amt) |
191 | | - |
192 | | - def write(self, buffer): |
193 | | - # PEP 543 |
194 | | - return self._tlsbuf.write(buffer) |
195 | | - |
196 | | - def do_handshake(self): |
197 | | - # PEP 543 |
198 | | - self._tlsbuf.do_handshake() |
199 | | - |
200 | | - def setcookieparam(self, param): |
201 | | - self._tlsbuf.setcookieparam(param) |
202 | | - |
203 | | - def cipher(self): |
204 | | - # PEP 543 |
205 | | - return self._tlsbuf.cipher() |
206 | | - |
207 | | - def negotiated_protocol(self): |
208 | | - # PEP 543 |
209 | | - return self._tlsbuf.negotiated_protocol() |
210 | | - |
211 | | - @property |
212 | | - def context(self): |
213 | | - # PEP 543 |
214 | | - """The ``Context`` object this buffer is tied to.""" |
215 | | - return self._tlsbuf.context |
216 | | - |
217 | | - def negotiated_tls_version(self): |
218 | | - # PEP 543 |
219 | | - return self._tlsbuf.negotiated_tls_version() |
220 | | - |
221 | | - def shutdown(self): |
222 | | - # PEP 543 |
223 | | - self._tlsbuf.shutdown() |
224 | | - |
225 | | - def receive_from_network(self, data): |
226 | | - # PEP 543 |
227 | | - # Append data to input buffer. |
228 | | - self._tlsbuf.receive_from_network(data) |
229 | | - |
230 | | - def peek_outgoing(self, amt): |
231 | | - # PEP 543 |
232 | | - # Read from output buffer. |
233 | | - return self._tlsbuf.peek_outgoing(amt) |
234 | | - |
235 | | - def consume_outgoing(self, amt): |
236 | | - """Consume `amt` bytes from the output buffer.""" |
237 | | - # PEP 543 |
238 | | - self._tlsbuf.consume_outgoing(amt) |
239 | | - |
240 | | - |
241 | 167 | class TLSWrappedSocket: |
242 | 168 | # _pep543.TLSWrappedSocket |
243 | 169 | def __init__(self, socket, buffer): |
|
0 commit comments