Beispiel #1
0
        /// <summary>
        /// Create a log file scanner
        /// </summary>
        /// <param name="options">Options</param>
        public IPBanLogFileScanner(IPBanIPAddressLogFileScannerOptions options) : base(options.PathAndMask, options.MaxFileSizeBytes, options.PingIntervalMilliseconds)
        {
            options.ThrowIfNull(nameof(options));
            options.LoginHandler.ThrowIfNull(nameof(options.LoginHandler));
            options.Dns.ThrowIfNull(nameof(options.Dns));
            Source = options.Source;

            this.loginHandler = options.LoginHandler;
            this.dns          = options.Dns;

            this.regexFailure = IPBanConfig.ParseRegex(options.RegexFailure, true);
            this.regexFailureTimestampFormat = options.RegexFailureTimestampFormat;

            this.regexSuccess = IPBanConfig.ParseRegex(options.RegexSuccess, true);
            this.regexSuccessTimestampFormat = options.RegexSuccessTimestampFormat;
        }
        /// <summary>
        /// Create a log file scanner
        /// </summary>
        /// <param name="options">Options</param>
        public IPBanLogFileScanner(IPBanIPAddressLogFileScannerOptions options) : base(options.PathAndMask, options.MaxFileSizeBytes, options.PingIntervalMilliseconds)
        {
            options.ThrowIfNull(nameof(options));
            options.LoginHandler.ThrowIfNull(nameof(options.LoginHandler));
            options.Dns.ThrowIfNull(nameof(options.Dns));
            Source = options.Source;
            FailedLoginThreshold = options.FailedLoginThreshold;
            FailedLogLevel       = options.FailedLogLevel;
            SuccessfulLogLevel   = options.SuccessfulLogLevel;

            this.loginHandler = options.LoginHandler;
            this.dns          = options.Dns;

            this.regexFailure = options.RegexFailure;
            this.regexFailureTimestampFormat = options.RegexFailureTimestampFormat;

            this.regexSuccess = options.RegexSuccess;
            this.regexSuccessTimestampFormat = options.RegexSuccessTimestampFormat;
        }