示例#1
0
文件: Program.cs 项目: trampster/Ropu
        static async Task Main(string[] args)
        {
            Console.WriteLine("Ropu Serving Node");
            Console.WriteLine("Copyright (c) Daniel Hughes");
            Console.WriteLine();

            var settingsReader = new CommandLineSettingsReader();
            var settings       = settingsReader.ParseArgs(args);

            if (settings == null)
            {
                return;
            }

            var portFinder          = new PortFinder();
            var credentialsProvider = new CredentialsProvider()
            {
                Email    = settings.Email,
                Password = settings.Password
            };
            var webClient        = new RopuWebClient("https://192.168.1.9:5001", credentialsProvider);
            var keysClient       = new KeysClient(webClient, true, encryptionKey => new CachedEncryptionKey(encryptionKey, key => new AesGcmWrapper(key)));
            var packetEncryption = new PacketEncryption(keysClient);

            var mediaProtocol        = new RopuProtocol(portFinder, StartingServingNodePort, packetEncryption, keysClient);
            var loadBalancerProtocol = new LoadBalancerProtocol(portFinder, StartingLoadBalancerPort, packetEncryption, keysClient);
            var serviceDiscovery     = new ServiceDiscovery();

            var groupsClient = new GroupsClient(webClient, new ImageClient(webClient));
            var registra     = new Registra(groupsClient);
            var servingNodes = new ServingNodes(100);
            var groupCallControllerLookup = new GroupCallControllerLookup();

            var servicesClient = new ServicesClient(webClient, ServiceType.ServingNode);

            var servingNodeRunner = new ServingNodeRunner(
                mediaProtocol,
                loadBalancerProtocol,
                serviceDiscovery,
                registra,
                servingNodes,
                groupCallControllerLookup,
                servicesClient,
                keysClient);

            await servingNodeRunner.Run();
        }
示例#2
0
 public ServingNodeRunner(
     RopuProtocol mediaProtocol,
     LoadBalancerProtocol loadBalancerProtocol,
     ServiceDiscovery serviceDiscovery,
     Registra registra,
     ServingNodes servingNodes,
     GroupCallControllerLookup groupCallControllerLookup,
     ServicesClient servicesClient,
     KeysClient keysClient)
 {
     _ropuProtocol = mediaProtocol;
     _ropuProtocol.SetMessageHandler(this);
     _loadBalancerProtocol      = loadBalancerProtocol;
     _serviceDiscovery          = serviceDiscovery;
     _registra                  = registra;
     _servingNodes              = servingNodes;
     _groupCallControllerLookup = groupCallControllerLookup;
     _servicesClient            = servicesClient;
     _keysClient                = keysClient;
     loadBalancerProtocol.SetClientMessageHandler(this);
 }