Sunshine0.0.5917
Sunshine 0.0.5917
Self-hosted game stream host for Moonlight.
Loading...
Searching...
No Matches
nvhttp::SunshineHTTPSServer Class Reference

HTTPS server backend that adds Sunshine's client-certificate verification. More...

Inheritance diagram for nvhttp::SunshineHTTPSServer:
Collaboration diagram for nvhttp::SunshineHTTPSServer:

Public Member Functions

 SunshineHTTPSServer (const std::string &certification_file, const std::string &private_key_file)
 Initialize the HTTPS server with Sunshine's certificate and key files.

Public Attributes

std::function< void(std::shared_ptr< Response >, std::shared_ptr< Request >)> on_verify_failed
 Handler used to return the pairing challenge when client verification fails.
std::function< int(SSL *)> verify
 Callback that validates a client's TLS certificate after handshake.

Protected Member Functions

void accept () override
 Accept a pending connection and arm the server for the next client.
void after_bind () override
 Enable client-certificate verification after the listening socket is bound.
void handle_handshake (const std::shared_ptr< Session > &session, const SimpleWeb::error_code &ec)
 Process a completed TLS handshake under the callback's server lifetime guard.

Protected Attributes

boost::asio::ssl::context context {boost::asio::ssl::context::tls_server}
 TLS server context configured with Sunshine's certificate and protocol policy.

Detailed Description

HTTPS server backend that adds Sunshine's client-certificate verification.

Constructor & Destructor Documentation

◆ SunshineHTTPSServer()

nvhttp::SunshineHTTPSServer::SunshineHTTPSServer ( const std::string & certification_file,
const std::string & private_key_file )
inline

Initialize the HTTPS server with Sunshine's certificate and key files.

Parameters
certification_filePath to the server certificate file.
private_key_filePath to the matching private key file.

Member Function Documentation

◆ accept()

void nvhttp::SunshineHTTPSServer::accept ( )
inlineoverrideprotected

Accept a pending connection and arm the server for the next client.

Keep each handler's scope guard alive until all access to the server has finished.

◆ after_bind()

void nvhttp::SunshineHTTPSServer::after_bind ( )
inlineoverrideprotected

Enable client-certificate verification after the listening socket is bound.

Ignore the TLS preverification result and context so failed authorization can receive an HTTP error.

◆ handle_handshake()

void nvhttp::SunshineHTTPSServer::handle_handshake ( const std::shared_ptr< Session > & session,
const SimpleWeb::error_code & ec )
inlineprotected

Process a completed TLS handshake under the callback's server lifetime guard.

Parameters
sessionSession whose TLS handshake has completed.
ecResult of the asynchronous handshake.
Precondition
The caller holds the session's handler scope guard.

The documentation for this class was generated from the following file: