diff options
author | Mattes D <github@xoft.cz> | 2023-05-09 11:29:35 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2023-05-19 16:25:12 +0200 |
commit | c2e0344110c01eef33697c9611c5689e8eee0691 (patch) | |
tree | aa09568a54eda66f062ae0032ce88957730cd3a5 /src/OSSupport/TCPLinkImpl.h | |
parent | Auth SSL Fixes (diff) | |
download | cuberite-c2e0344110c01eef33697c9611c5689e8eee0691.tar cuberite-c2e0344110c01eef33697c9611c5689e8eee0691.tar.gz cuberite-c2e0344110c01eef33697c9611c5689e8eee0691.tar.bz2 cuberite-c2e0344110c01eef33697c9611c5689e8eee0691.tar.lz cuberite-c2e0344110c01eef33697c9611c5689e8eee0691.tar.xz cuberite-c2e0344110c01eef33697c9611c5689e8eee0691.tar.zst cuberite-c2e0344110c01eef33697c9611c5689e8eee0691.zip |
Diffstat (limited to '')
-rw-r--r-- | src/OSSupport/TCPLinkImpl.h | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/OSSupport/TCPLinkImpl.h b/src/OSSupport/TCPLinkImpl.h index d26b1e358..c757303d2 100644 --- a/src/OSSupport/TCPLinkImpl.h +++ b/src/OSSupport/TCPLinkImpl.h @@ -40,9 +40,16 @@ public: /** Creates a new link based on the given socket. Used for connections accepted in a server using cNetwork::Listen(). + a_Host is the hostname used for TLS SNI (can be empty in cases TLS is not used). a_Address and a_AddrLen describe the remote peer that has connected. The link is created disabled, you need to call Enable() to start the regular communication. */ - cTCPLinkImpl(evutil_socket_t a_Socket, cCallbacksPtr a_LinkCallbacks, cServerHandleImplPtr a_Server, const sockaddr * a_Address, socklen_t a_AddrLen); + cTCPLinkImpl( + evutil_socket_t a_Socket, + cCallbacksPtr a_LinkCallbacks, + cServerHandleImplPtr a_Server, + const sockaddr * a_Address, + socklen_t a_AddrLen + ); /** Destroys the LibEvent handle representing the link. */ virtual ~cTCPLinkImpl() override; @@ -68,8 +75,7 @@ public: virtual void Close(void) override; virtual AString StartTLSClient( cX509CertPtr a_OwnCert, - cCryptoKeyPtr a_OwnPrivKey, - const std::string_view hostname + cCryptoKeyPtr a_OwnPrivKey ) override; virtual AString StartTLSServer( cX509CertPtr a_OwnCert, @@ -151,6 +157,10 @@ protected: /** The port of the local endpoint. Valid only after the socket has been connected. */ UInt16 m_LocalPort; + /** The original host parameter which was used for creating the link, either hostname or IP address. + Used for TLS SNI. */ + AString m_RemoteHost; + /** The IP address of the remote endpoint. Valid only after the socket has been connected. */ AString m_RemoteIP; @@ -175,7 +185,7 @@ protected: Used for outgoing connections created using cNetwork::Connect(). To be used only by the Connect() factory function. The link is created disabled, you need to call Enable() to start the regular communication. */ - cTCPLinkImpl(const cCallbacksPtr a_LinkCallbacks); + cTCPLinkImpl(const std::string & a_Host, const cCallbacksPtr a_LinkCallbacks); /** Callback that LibEvent calls when there's data available from the remote peer. */ static void ReadCallback(bufferevent * a_BufferEvent, void * a_Self); |