| 294 | """An optional proxy server specification via which the connection should be established.""" |
| 295 | |
| 296 | def __str__(self): |
| 297 | if self.alpn: |
| 298 | tls_state = f", alpn={self.alpn.decode(errors='replace')}" |
| 299 | elif self.tls_established: |
| 300 | tls_state = ", tls" |
| 301 | else: |
| 302 | tls_state = "" |
| 303 | if self.sockname: |
| 304 | local_port = f", src_port={self.sockname[1]}" |
| 305 | else: |
| 306 | local_port = "" |
| 307 | state = self.state.name |
| 308 | assert state |
| 309 | return f"Server({human.format_address(self.address)}, state={state.lower()}{tls_state}{local_port})" |
| 310 | |
| 311 | def __setattr__(self, name, value): |
| 312 | if name in ("address", "via"): |