-
-
Notifications
You must be signed in to change notification settings - Fork 366
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for setting certificate on PeerConnection #1170
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,9 +45,17 @@ static LogCounter | |
"Number of unknown RTCP packet types over past second"); | ||
|
||
PeerConnection::PeerConnection(Configuration config_) | ||
: config(std::move(config_)), mCertificate(make_certificate(config.certificateType)) { | ||
: config(std::move(config_)) { | ||
PLOG_VERBOSE << "Creating PeerConnection"; | ||
|
||
if( config.certPem.has_value() && config.keyPem.has_value() ) { | ||
std::promise<certificate_ptr> cert; | ||
cert.set_value(std::make_shared<Certificate>(Certificate::FromString(config.certPem.value(), config.keyPem.value()))); | ||
mCertificate = cert.get_future(); | ||
} else { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should create the certificate if both certificate and key are not specified, else throw an There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. get it. |
||
mCertificate = make_certificate(config.certificateType); | ||
} | ||
|
||
if (config.portRangeEnd && config.portRangeBegin > config.portRangeEnd) | ||
throw std::invalid_argument("Invalid port range"); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should make the configuration fields consistent with existing ones in
WebSocketConfiguration
andWebSocketServerConfiguration
. The fields are calledcertificatePemFile
,keyPemFile
, andkeyPemPass
, they allow the user to pass certificate and key either as a file path or as a PEM string.