All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.erwinkok.libp2p.security.plaintext.PlainText.kt Maven / Gradle / Ivy

// Copyright (c) 2023 Erwin Kok. BSD-3-Clause license. See LICENSE file for more details.
package org.erwinkok.libp2p.security.plaintext

import org.erwinkok.libp2p.core.host.builder.HostDsl
import org.erwinkok.libp2p.core.host.builder.SecurityTransportBuilder

@HostDsl
fun SecurityTransportBuilder.plainText() {
    if (config.securityTransportFactories.isNotEmpty()) {
        errors.recordError { "cannot disable security transport with secure transports configured" }
    } else {
        config.securityTransportFactories.add(PlainTextSecureTransport)
        config.insecure = true
    }
}

@HostDsl
fun SecurityTransportBuilder.noSecurity() {
    plainText()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy