package com.fireflysource.net.tcp.secure;

import kotlinx.coroutines.CoroutineScope;

import java.util.List;

/**
 * The TLS engine factory.
 *
 * @author Pengtao Qiu
 */
public interface SecureEngineFactory {

    /**
     * Create a TLS engine.
     *
     * @param coroutineScope     The coroutine scope.
     * @param clientMode         If true, the current connection is the client tcp connection.
     * @param supportedProtocols The supported application layer protocols.
     * @return The TLS engine.
     */
    SecureEngine create(CoroutineScope coroutineScope, boolean clientMode, List<String> supportedProtocols);

    /**
     * Create a TLS engine using advisory peer information.
     * Applications using this factory method are providing hints for an internal session reuse strategy.
     * Some cipher suites (such as Kerberos) require remote hostname information, in which case peerHost needs to be specified.
     *
     * @param coroutineScope     The coroutine scope.
     * @param clientMode         If true, the current connection is the client tcp connection.
     * @param peerHost           the non-authoritative name of the host.
     * @param peerPort           the non-authoritative port.
     * @param supportedProtocols The supported application layer protocols.
     * @return The TLS engine.
     */
    SecureEngine create(CoroutineScope coroutineScope, boolean clientMode, String peerHost, int peerPort,
                        List<String> supportedProtocols);

}

@@ -1437,66 +1437,1360 @@
 ort,
+ List%3CString%3E supportedProtocols);%0A
 %0A    
+/**%0A
      
-               List%3CString%3E supportedProtocols);%0A
+* Create a TLS engine by default coroutine scope.%0A     *%0A     * @param clientMode         If true, the current connection is the client tcp connection.%0A     * @param supportedProtocols The supported application layer protocols.%0A     * @return The TLS engine.%0A     */%0A    default SecureEngine create(boolean clientMode, List%3CString%3E supportedProtocols) %7B%0A        return create(null, clientMode, supportedProtocols);%0A    %7D%0A%0A    /**%0A     * Create a TLS engine by default coroutine scope and advisory peer information.%0A     * Applications using this factory method are providing hints for an internal session reuse strategy.%0A     * Some cipher suites (such as Kerberos) require remote hostname information, in which case peerHost needs to be specified.%0A     *%0A     * @param clientMode         If true, the current connection is the client tcp connection.%0A     * @param peerHost           the non-authoritative name of the host.%0A     * @param peerPort           the non-authoritative port.%0A     * @param supportedProtocols The supported application layer protocols.%0A     * @return The TLS engine.%0A     */%0A    default SecureEngine create(boolean clientMode, String peerHost, int peerPort, List%3CString%3E supportedProtocols) %7B%0A        return create(null, clientMode, peerHost, peerPort, supportedProtocols);%0A    %7D
 %0A%7D%0A

add default coroutine scope APIs for secure engine factory.