io.vertx.kotlin.core.net.ClientSSLOptions.kt Maven / Gradle / Ivy
/*
* Copyright 2019 Red Hat, Inc.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Apache License v2.0 which accompanies this distribution.
*
* The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* The Apache License v2.0 is available at
* http://www.opensource.org/licenses/apache2.0.php
*
* You may elect to redistribute this code under either of these licenses.
*/
package io.vertx.kotlin.core.net
import io.vertx.core.net.ClientSSLOptions
import io.vertx.core.buffer.Buffer
import java.util.concurrent.TimeUnit
/**
* A function providing a DSL for building [io.vertx.core.net.ClientSSLOptions] objects.
*
* Client SSL options.
*
* @param trustOptions Set the trust options.
* @param enabledCipherSuites Add an enabled cipher suite, appended to the ordered suites.
* @param crlPaths Add a CRL path
* @param crlValues Add a CRL value
* @param useAlpn Set the ALPN usage.
* @param enabledSecureTransportProtocols Sets the list of enabled SSL/TLS protocols.
* @param sslHandshakeTimeout Set the SSL handshake timeout, default time unit is seconds.
* @param sslHandshakeTimeoutUnit Set the SSL handshake timeout unit. If not specified, default is seconds.
* @param applicationLayerProtocols Set the list of application-layer protocols to provide to the server during the Application-Layer Protocol Negotiation.
* @param hostnameVerificationAlgorithm Set the hostname verification algorithm interval
* @param trustAll Set whether all server certificates should be trusted
* @param keyCertOptions Set the key/cert options.
*
*
* NOTE: This function has been automatically generated from the [io.vertx.core.net.ClientSSLOptions original] using Vert.x codegen.
*/
fun clientSSLOptionsOf(
trustOptions: io.vertx.core.net.TrustOptions? = null,
enabledCipherSuites: Iterable? = null,
crlPaths: Iterable? = null,
crlValues: Iterable? = null,
useAlpn: Boolean? = null,
enabledSecureTransportProtocols: Iterable? = null,
sslHandshakeTimeout: Long? = null,
sslHandshakeTimeoutUnit: TimeUnit? = null,
applicationLayerProtocols: Iterable? = null,
hostnameVerificationAlgorithm: String? = null,
trustAll: Boolean? = null,
keyCertOptions: io.vertx.core.net.KeyCertOptions? = null): ClientSSLOptions = io.vertx.core.net.ClientSSLOptions().apply {
if (trustOptions != null) {
this.setTrustOptions(trustOptions)
}
if (enabledCipherSuites != null) {
for (item in enabledCipherSuites) {
this.addEnabledCipherSuite(item)
}
}
if (crlPaths != null) {
for (item in crlPaths) {
this.addCrlPath(item)
}
}
if (crlValues != null) {
for (item in crlValues) {
this.addCrlValue(item)
}
}
if (useAlpn != null) {
this.setUseAlpn(useAlpn)
}
if (enabledSecureTransportProtocols != null) {
this.setEnabledSecureTransportProtocols(enabledSecureTransportProtocols.toSet())
}
if (sslHandshakeTimeout != null) {
this.setSslHandshakeTimeout(sslHandshakeTimeout)
}
if (sslHandshakeTimeoutUnit != null) {
this.setSslHandshakeTimeoutUnit(sslHandshakeTimeoutUnit)
}
if (applicationLayerProtocols != null) {
this.setApplicationLayerProtocols(applicationLayerProtocols.toList())
}
if (hostnameVerificationAlgorithm != null) {
this.setHostnameVerificationAlgorithm(hostnameVerificationAlgorithm)
}
if (trustAll != null) {
this.setTrustAll(trustAll)
}
if (keyCertOptions != null) {
this.setKeyCertOptions(keyCertOptions)
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy