private static IFtpServerBuilder ConfigureServer(this IFtpServerBuilder builder, FtpOptions options)
        {
            builder = builder
                      .DisableChecks();

            if (options.Connection.Inactivity.Enabled)
            {
                builder = builder
                          .EnableIdleCheck();
                builder.Services
                .Configure <FtpConnectionOptions>(
                    opt => opt.InactivityTimeout = ToTimeSpan(options.Connection.Inactivity.InactivityTimeout));
            }

            if (options.Connection.SocketState.Enabled)
            {
                builder = builder
                          .EnableConnectionCheck();
            }

            if (options.Ftps.Implicit)
            {
                var implicitFtpsCertificate = options.GetCertificate();
                if (implicitFtpsCertificate != null)
                {
                    builder = builder.UseImplicitTls(implicitFtpsCertificate);
                }
            }

            return(builder);
        }
Ejemplo n.º 2
0
        private static IFtpServerBuilder ConfigureServer(this IFtpServerBuilder builder, FtpOptions options)
        {
            builder = builder
                      .DisableChecks();

            if (options.Connection.Inactivity.Enabled)
            {
                builder = builder
                          .EnableIdleCheck();
                builder.Services
                .Configure <FtpConnectionOptions>(
                    opt => opt.InactivityTimeout = ToTimeSpan(options.Connection.Inactivity.InactivityTimeout));
            }

            if (options.Connection.SocketState.Enabled)
            {
                builder = builder
                          .EnableConnectionCheck();
            }

            return(builder);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Adds the default checks for the connection.
 /// </summary>
 /// <param name="builder">The FTP server builder.</param>
 /// <returns>The same FTP server builder.</returns>
 public static IFtpServerBuilder EnableDefaultChecks(
     this IFtpServerBuilder builder)
 {
     return(builder.EnableConnectionCheck().EnableIdleCheck());
 }