Exemple #1
0
        private static async Task <Int32> Main(String[] args)
        {
            ReassemblerCliOptions cliOptions = null;

            Parser.Default.ParseArguments <ReassemblerCliOptions>(args).WithParsed(options => cliOptions = options);
            if (cliOptions == null)
            {
                return(1);
            }

            var hostBuilder = new HostBuilder().ConfigureServices((hostContext, services) =>
            {
                ConfigureServices(services, cliOptions);
            });
            await hostBuilder.RunConsoleAsync().ConfigureAwait(false);

            return(0);
        }
Exemple #2
0
        private static void ConfigureServices(IServiceCollection services, ReassemblerCliOptions opts)
        {
            services.AddLogging();

            services.AddSingleton <IClusterSettings, ClusterSettings>(
                provider => new ClusterSettings
            {
                ClusterNodeHostname     = opts.ClusterNodeHostname,
                ClusterNodePort         = opts.ClusterNodePort,
                ClusterSeedNodeHostname = opts.ClusterSeedNodeHostname
            });

            services.AddSingleton <IHostedService, ReassemblerService>();

            ActorsServiceInstaller.Install(services);
            FacadesServiceInstaller.Install(services);

            if (opts.DevnullRepository)
            {
                DevNullServiceInstaller.Install(services);
            }
            else if (opts.CassandraRepository)
            {
                CassandraServiceInstaller.Install(services, opts.CassandraKeyspace, opts.CassandraContactPoint);
            }
            else
            {
                InMemoryServiceInstaller.Install(services);
            }

            if (opts.OutPcapDirectory != null)
            {
                services.AddSingleton <IPcapFacadeConfiguration>(new PcapFacadeConfiguration
                {
                    BaseDirectory = opts.OutPcapDirectory
                });
                services.AddSingleton <IPcapFacade, PcapFacade>();
            }
            else
            {
                services.AddSingleton <IPcapFacade, PcapDevnullFacade>();
            }
        }
Exemple #3
0
        private static void ConfigureServices(IServiceCollection services, ReassemblerCliOptions opts)
        {
            services.AddLogging();

            services.AddSingleton <IClusterSettings, ClusterSettings>(
                provider => new ClusterSettings
            {
                ClusterNodeHostname     = opts.ClusterNodeHostname,
                ClusterNodePort         = opts.ClusterNodePort,
                ClusterSeedNodeHostname = opts.ClusterSeedNodeHostname
            });

            services.AddSingleton <IHostedService, ReassemblerService>();

            services.AddSingleton <ICaptureFacade, CaptureFacade>();
            services.AddSingleton <IL7ConversationFacade, L7ConversationFacade>();
            services.AddSingleton <ICaptureTrackingActorFactory, CaptureTrackingActorFactory>();
            services.AddSingleton <IRawPacketBatchParserActorFactory, RawPacketBatchParserActorFactory>();
            services.AddSingleton <ICaptureTrackingActorFactory, CaptureTrackingActorFactory>();
            services.AddSingleton <IL3ConversationTrackingActorFactory, L3ConversationTrackingActorFactory>();
            services.AddSingleton <IL4ConversationTrackingActorFactory, L4ConversationTrackingActorFactory>();
            services.AddSingleton <IL7ConversationStorageActorFactory, L7ConversationStorageActorFactory>();

            if (opts.DevnullRepository)
            {
                DevNullServiceInstaller.Install(services);
            }
            else if (opts.CassandraRepository)
            {
                CassandraServiceInstaller.Install(services, opts.CassandraKeyspace, opts.CassandraContactPoint);
            }
            else
            {
                InMemoryServiceInstaller.Install(services);
            }
        }