public ProxyApiController(IProxyService proxyService, IProxyProviderService proxyProviderService = null, IProxyTestService proxyTestService = null, IProxyTestServerService proxyTestServerService = null)
 {
     this._proxyService      = proxyService;
     _proxyProviderService   = proxyProviderService;
     _proxyTestService       = proxyTestService;
     _proxyTestServerService = proxyTestServerService;
 }
 /// <summary>
 /// 取Service实例
 /// </summary>
 /// <typeparam name="TService"></typeparam>
 /// <param name="SvrID"></param>
 /// <returns></returns>
 public static TService GetService <TService>(string SvrID) where TService : class
 {
     try
     {
         IProxyService proxy = Container.Resolve <IProxyService>(SvrID);
         if (proxy != null)
         {
             try
             {
                 TService service = Container.Resolve <TService>(SvrID + "Proxy");
                 return(service);
             }
             catch
             {
                 TService svr = proxy.GetService <TService>();
                 Container.Register(
                     Component.For <TService>()
                     .Instance(svr)
                     .Named(SvrID + "Proxy")
                     .LifeStyle.Singleton
                     );
                 return(svr);
             }
         }
     }
     catch { }
     return(Container.Resolve <TService>(SvrID));
 }
Example #3
0
        public AcmeDnsClient(LookupClientProvider dnsClient, IProxyService proxy, ILogService log,
                             ISettingsService settings, IInputService?input, Uri baseUri)
        {
            _baseUri   = baseUri;
            _proxy     = proxy;
            _dnsClient = dnsClient;
            _log       = log;
            _input     = input;
            var configDir       = new DirectoryInfo(settings.Client.ConfigurationPath);
            var legacyPath      = Path.Combine(configDir.FullName, "acme-dns", _baseUri.CleanUri() !);
            var legacyDirectory = new DirectoryInfo(legacyPath);

            if (!legacyDirectory.Exists)
            {
                // Go up one level so that multiple ACME servers
                // can share the same acme-dns registrations
                var parentPath      = Path.Combine(configDir.Parent !.FullName, "acme-dns", _baseUri.CleanUri() !);
                var parentDirectory = new DirectoryInfo(parentPath);
                if (!parentDirectory.Exists)
                {
                    parentDirectory.Create();
                }
                _dnsConfigPath = parentPath;
            }
            else
            {
                _dnsConfigPath = legacyPath;
            }
            _log.Debug("Using {path} for acme-dns configuration", _dnsConfigPath);
        }
        public SettingDialogViewModel(ISettingDialogView view, IProxyService proxyService, IMessageService messageService, SettingsViewModel settingsViewModel)
            : base(view)
        {
            this.proxyService      = proxyService;
            this.settingsViewModel = settingsViewModel;
            this.messageService    = messageService;

            this.submitCommand = new DelegateCommand(SubmitSettingCommand, CanSubmitSetting);
            this.cancelCommand = new DelegateCommand(() => Close(false));

            this.views = new ObservableCollection <object>();
            this.views.Add(this.settingsViewModel.View);
            if (this.proxyService.ActiveProxy != null)
            {
                var settingView = this.proxyService.ActiveProxy.InitializeSettingDialog();
                if (settingView != null)
                {
                    this.views.Add(settingView);
                }
            }
            SelectView = this.settingsViewModel.View;

            AddWeakEventListener(this.settingsViewModel, SettingsViewModelPropertyChanged);

            if (!string.IsNullOrWhiteSpace(this.settingsViewModel.ActiveProxy))
            {
                this.settingActiveProxy = this.proxyService.Proxies.First(x => x.ProxyName == settingsViewModel.ActiveProxy);
            }
            if (this.settingActiveProxy != null)
            {
                AddWeakEventListener(this.settingActiveProxy, ActiveProxyPropertyChanged);
                AddWeakEventListener(this.settingActiveProxy.StateValues, StateValuesCollectionChanged);
                StateValuesCollectionChanged(null, null);
            }
        }
Example #5
0
 public KeyVault(KeyVaultOptions options, SecretServiceManager ssm, IProxyService proxyService, ILogService log)
 {
     _options      = options;
     _proxyService = proxyService;
     _log          = log;
     _ssm          = ssm;
 }
Example #6
0
 public KeyVault(KeyVaultOptions options, IProxyService proxyService, ILogService log)
 {
     _options      = options;
     _proxyService = proxyService;
     _log          = log;
     _helpers      = new AzureHelpers(_options, log);
 }
Example #7
0
        public static void Main(string[] args)
        {
            //TODO: Implement better command line handling.
            #if DEBUG
            args = new string[]
            {
                "gamea.clashofclans.com",
                "9339"
            };
            #endif
            var port = -1;
            var address = (IPAddress)null;
            if (!TryGetPort(args, out port))
                return;
            if (!TryGetIPAddress(args, out address))
                return;

            Kernal = new StandardKernel();
            Kernal.Load(Assembly.GetExecutingAssembly());

            Console.WriteLine("Starting proxy server...");
            ProxyService = Kernal.Get<IProxyService>();
            ProxyService.Start();

            // TODO: Setup visitor design pattern so that 1 or more implementations can be notified of these events.
            Configuration = ClientConfiguration.LoadConfiguration("clientConfig.xml");
            Client = new CoCClient();
            Client.Login += OnLogin;
            Client.ChatMessage += OnChatMessage;
            Client.AllianceInfo += ProxyService.OnAllianceInfo;
            Client.Avatar.ID = Configuration.UserID;
            Client.Avatar.Token = Configuration.UserToken;

            Console.WriteLine("Connecting to {0}:{1}...", address, port);
            Client.Connect(new IPEndPoint(address, port));

            Console.WriteLine("Waiting for commands..");

            while (true)
            {
                var input = Console.ReadLine();

                if (string.IsNullOrWhiteSpace(input))
                    continue;

                if (input[0] == '/')
                {
                    var command = input.Substring(1).Split(' ');

                    switch (command[0])
                    {
                        case "a":
                            Client.SendAllianceInfoRequest(long.Parse(command[1]));
                            break;
                    }
                }
                else
                    Client.SendChatMessage(input);
            }
        }
Example #8
0
        private static void InititalChanncel()
        {
            ProxyServiceCallBack callback = new ProxyServiceCallBack(proxy);
            DuplexChannelFactory <IProxyService> channel = new DuplexChannelFactory <IProxyService>(callback, "ProxyClient");

            service = channel.CreateChannel();
        }
Example #9
0
 public DnsManagementClient(string apiKey, string apiSecret, ILogService logService, IProxyService proxyService)
 {
     _apiKey       = apiKey;
     _apiSecret    = apiSecret;
     _log          = logService;
     _proxyService = proxyService;
 }
Example #10
0
 public ProxyServerMiddleware(RequestDelegate next, IProxyConfigService proxyConfigService, IProxyService proxyService, IMemoryCache memoryCache)
 {
     this.next = next;
     cache     = memoryCache ?? throw new ArgumentNullException(nameof(memoryCache));
     this.proxyConfigService = proxyConfigService ?? throw new ArgumentNullException(nameof(proxyConfigService));
     this.proxyService       = proxyService ?? throw new ArgumentNullException(nameof(proxyService));
 }
Example #11
0
 public WebDav(
     WebDavOptions options,
     HttpValidationParameters pars,
     RunLevel runLevel,
     IProxyService proxy,
     SecretServiceManager secretService) :
     base(options, runLevel, pars) =>
 /// <summary>
 /// 取Service实例
 /// </summary>
 /// <param name="SvrID"></param>
 /// <param name="serviceType"></param>
 /// <returns></returns>
 public static object GetService(string SvrID, Type serviceType)
 {
     try
     {
         IProxyService proxy = Container.Resolve <IProxyService>(SvrID);
         if (proxy != null)
         {
             try
             {
                 var service = Container.Resolve(SvrID + "Proxy", serviceType);
                 return(service);
             }
             catch
             {
                 var svr = proxy.GetService();
                 Container.Register(
                     Component.For(serviceType)
                     .Instance(svr)
                     .Named(SvrID + "Proxy")
                     .LifeStyle.Singleton
                     );
                 return(svr);
             }
         }
     }
     catch { }
     return(Container.Resolve(SvrID, serviceType));
 }
 public HomeController(IAvailabilityService availabilityService, IBookingAndAccountsService bookingAndAccountsService,
     IProxyService proxyService)
 {
     _availabilityService = availabilityService;
     _bookingAndAccountsService = bookingAndAccountsService;
     _proxyService = proxyService;
 }
Example #14
0
        /// <summary>
        /// Starts a proxy service
        /// </summary>
        /// <param name="executableName">The executable name of the service to start</param>
        /// <param name="channelServerName">The channel name for IPC</param>
        /// <returns>The proxy service that is created</returns>
        private IProxyService StartProxyService(String executableName, String channelServerName)
        {
            try
            {
                // Start the proxy service
                EventWaitHandle  processStartEvent = new EventWaitHandle(false, EventResetMode.ManualReset, ProxyCommunicator.WaitEventName);
                ProcessStartInfo processInfo       = new ProcessStartInfo(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), executableName));
                processInfo.Arguments       = Process.GetCurrentProcess().Id.ToString() + " " + channelServerName + " " + ProxyCommunicator.WaitEventName;
                processInfo.UseShellExecute = false;
                processInfo.CreateNoWindow  = true;
                Process.Start(processInfo);
                processStartEvent.WaitOne();

                // Create connection
                NetNamedPipeBinding binding = new NetNamedPipeBinding(NetNamedPipeSecurityMode.None);
                binding.ReceiveTimeout         = TimeSpan.MaxValue;
                binding.MaxReceivedMessageSize = Int32.MaxValue;
                binding.MaxBufferSize          = Int32.MaxValue;

                EndpointAddress endpoint     = new EndpointAddress(channelServerName);
                IProxyService   proxyService = ChannelFactory <IProxyService> .CreateChannel(binding, endpoint);

                OutputViewModel.GetInstance().Log(OutputViewModel.LogLevel.Info, "Started proxy service: " + executableName + " over channel " + channelServerName);

                return(proxyService);
            }
            catch (Exception ex)
            {
                OutputViewModel.GetInstance().Log(OutputViewModel.LogLevel.Fatal, "Failed to start proxy service: " + executableName + ". This may impact Scripts and .NET explorer", ex);
                AnalyticsService.GetInstance().SendEvent(AnalyticsService.AnalyticsAction.General, ex);
                return(null);
            }
        }
 public APIHttpClientService(
     IProxyService proxyService,
     IAPIConfigService configService
     )
 {
     this.proxyService  = proxyService ?? throw new System.ArgumentNullException(nameof(proxyService));
     this.configService = configService ?? throw new System.ArgumentNullException(nameof(configService));
 }
Example #16
0
 internal Host(string name, IProxyService proxyService, IHostConfigurationManager hostConfigurationManager, IUrlManipulationService urlManipulationService)
 {
     _configurationManager = hostConfigurationManager;
     _urlManipulation = urlManipulationService;
     _proxyService = proxyService;
     _settings = _configurationManager.GetOptions(name);
     ValidateSettings(_settings);
 }
 public PaymentManager(EntityFramework.DataContext.TestProjectDbContext dbContext,
                       IConfiguration config,
                       IProxyService proxyService)
 {
     _dbContext    = dbContext;
     _proxyService = proxyService;
     _config       = config;
 }
        public ProxyHttpMessageHandlerBuilder(IServiceProvider services, IProxyService proxyService)
        {
            services.NotNull(nameof(services));
            proxyService.NotNull(nameof(proxyService));

            Services      = services;
            _proxyService = proxyService;
        }
 public LoginService(IDataService dataService,
                     IProxyService proxyService,
                     INetService netService)
 {
     _dataService  = dataService;
     _proxyService = proxyService;
     _netService   = netService;
 }
Example #20
0
 public HttpClientDownloader(IHttpClientFactory httpClientFactory,
                             IServiceProvider serviceProvider,
                             ILogger <HttpClientDownloader> logger)
 {
     HttpClientFactory = httpClientFactory;
     Logger            = logger;
     _proxyService     = serviceProvider.GetService <IProxyService>();
 }
Example #21
0
 public UserService(IUserRepository repository,
                    IProxyService proxyService,
                    IProjectRepository projectRepository)
     : base(repository)
 {
     _proxyService      = proxyService;
     _projectRepository = projectRepository;
 }
 public ProxyBackgroundService(
     IProxyService pool, ILogger <ProxyService> logger, IServiceProvider serviceProvider,
     IOptions <SpiderOptions> options)
 {
     _proxySupplier = serviceProvider.GetService(typeof(IProxySupplier)) as IProxySupplier;
     _pool          = pool;
     _logger        = logger;
     _options       = options.Value;
 }
Example #23
0
 public TransIpOptionsFactory(
     ArgumentsInputService arguments,
     ILogService log,
     IProxyService proxy) : base(Dns01ChallengeValidationDetails.Dns01ChallengeType)
 {
     _arguments = arguments;
     _log       = log;
     _proxy     = proxy;
 }
Example #24
0
 public SimplyDnsValidation(
     LookupClientProvider dnsClient,
     ILogService logService,
     ISettingsService settings,
     IProxyService proxyService,
     SecretServiceManager ssm,
     SimplyOptions options)
     : base(dnsClient, logService, settings)
     => _client = new SimplyDnsClient(
 public static IApplicationBuilder UseAgsProxyServer(
     this IApplicationBuilder builder,
     IProxyConfigService proxyConfigService,
     IProxyService proxyService,
     IMemoryCache memoryCache
     )
 {
     return(builder.Use(next => new ProxyServerMiddleware(next, proxyConfigService, proxyService, memoryCache).Invoke));
 }
 public HttpClientDownloader(IHttpClientFactory httpClientFactory,
                             IProxyService proxyService,
                             ILogger <HttpClientDownloader> logger)
 {
     HttpClientFactory = httpClientFactory;
     Logger            = logger;
     _proxyService     = proxyService;
     UseProxy          = !(_proxyService is EmptyProxyService);
 }
Example #27
0
        public ChatViewModel(IEventAggregator ea, IProxyService proxy) : base(ea)
        {
            this.proxy = proxy;

            SendMessageCommand = new DelegateCommand(SendMessage, () => Connected && !string.IsNullOrWhiteSpace(Message));
            commandsToNotify.Add(SendMessageCommand);

            IsTypingCommand = new DelegateCommand(IsTyping);
        }
Example #28
0
 public WebAgent(IRateLimiter rateLimiter, IProxyService proxyService)
 {
     _rateLimiter      = rateLimiter;
     _proxyService     = proxyService;
     _acceptedEncoding = new Dictionary <string, Func <Stream, Stream> >
     {
         { "gzip", (stream) => new GZipStream(stream, CompressionMode.Decompress) },
         { "deflate", (stream) => new DeflateStream(stream, CompressionMode.Decompress) }
     };
 }
Example #29
0
 public SberbankHttpClientService(
     ILoggerService logger,
     IProxyService proxyService,
     ISberbankConfigService sberbankConfigService
     )
 {
     this.logger                = logger ?? throw new System.ArgumentNullException(nameof(logger));
     this.proxyService          = proxyService ?? throw new System.ArgumentNullException(nameof(proxyService));
     this.sberbankConfigService = sberbankConfigService ?? throw new System.ArgumentNullException(nameof(sberbankConfigService));
 }
 public PublishPackageViewModel(string publishUrl, PackageViewModel viewModel)
 {
     if (viewModel == null)
     {
         throw new ArgumentNullException("viewModel");
     }
     _publishUrl    = publishUrl;
     _package       = viewModel.PackageMetadata;
     _packageStream = new Lazy <Stream>(viewModel.GetCurrentPackageStream);
     _proxyService  = new ProxyService(new AutoDiscoverCredentialProvider());
 }
Example #31
0
 public CloudDns(
     LookupClientProvider dnsClient,
     ILogService log,
     IProxyService proxy,
     ISettingsService settings,
     CloudDnsOptions options) : base(dnsClient, log, settings)
 {
     _options = options;
     _proxy   = proxy;
     _client  = CreateDnsService();
 }
Example #32
0
 public TransIpOptionsFactory(
     IArgumentsService arguments,
     ILogService log,
     IProxyService proxy,
     SecretServiceManager secretServiceManager) : base(Dns01ChallengeValidationDetails.Dns01ChallengeType)
 {
     _arguments            = arguments;
     _log                  = log;
     _proxy                = proxy;
     _secretServiceManager = secretServiceManager;
 }
Example #33
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="log"></param>
 /// <param name="input"></param>
 /// <param name="options"></param>
 /// <param name="proxy"></param>
 /// <param name="renewal"></param>
 /// <param name="target"></param>
 /// <param name="runLevel"></param>
 /// <param name="identifier"></param>
 public HttpValidation(TOptions options, RunLevel runLevel, HttpValidationParameters pars)
 {
     _options  = options;
     _runLevel = runLevel;
     _path     = options.Path;
     _log      = pars.LogService;
     _input    = pars.InputService;
     _proxy    = pars.ProxyService;
     _settings = pars.Settings;
     _renewal  = pars.Renewal;
 }
        public PackageChooserViewModel(IMruPackageSourceManager packageSourceManager)
        {
            Packages = new ObservableCollection<PackageInfo>();
            NavigationCommand = new NavigateCommand(this);
            SortCommand = new RelayCommand<string>(Sort, column => TotalPackageCount > 0);
            SearchCommand = new RelayCommand<string>(Search);
            LoadedCommand = new RelayCommand(() => Sort("VersionDownloadCount", ListSortDirection.Descending));
            ChangePackageSourceCommand = new RelayCommand<string>(ChangePackageSource);
            _credentialProvider = new AutoDiscoverCredentialProvider();
            _proxyService = new ProxyService(_credentialProvider);

            _packageSourceManager = packageSourceManager;
        }
Example #35
0
 public GalleryServer(string userAgent, string galleryServerSource, IProxyService proxyService)
 {
     if (string.IsNullOrEmpty(galleryServerSource)) {
         throw new ArgumentNullException("galleryServerSource");
     }
     if (null == proxyService) {
         throw new ArgumentNullException("proxyService");
     }
     _proxyService = proxyService;
     _cachedProxy = _proxyService.GetProxy(new Uri(galleryServerSource));
     _baseGalleryServerUrl = GetSafeRedirectedUri(galleryServerSource);
     _userAgent = userAgent;
 }
        public DownloadProgressWindow(Uri downloadUri, string id, Version version)
        {
            if (downloadUri == null) {
                throw new ArgumentNullException("downloadUri");
            }

            InitializeComponent();

            _proxyService = new ProxyService(new AutoDiscoverCredentialProvider());
            Title = "Downloading package " + id + " " + version.ToString();

            _downloadUri = downloadUri;
        }
        protected override void OnTestInitialize()
        {
            this.proxyService = new ProxyService(Container.GetExportedValues<ITracingSystemProxy>());
            this.proxyService.ActiveProxy = this.proxyService.Proxies.First(x => x.ProxyName == activeProxy);
            foreach (var proxy in this.proxyService.Proxies)
            {
                proxy.Initialize();
            }

            ISettingsView settingsView = Container.GetExportedValue<ISettingsView>();
            this.settingsViewModel = new SettingsViewModel(settingsView, proxyService, teamMembersString);

            this.settingsViewModel.UserName = this.userName;
            this.settingsViewModel.RefreshMinutes = this.refreshMinutes;
            this.settingsViewModel.IsFilterCreatedBy = this.isFilterCreatedBy;

            ISettingDialogView dialogView = Container.GetExportedValue<ISettingDialogView>();
            this.dialogViewModel = new SettingDialogViewModel(dialogView, proxyService, new MockMessageService(), settingsViewModel);
        }
Example #38
0
 protected override void OnTestInitialize()
 {
     this.proxys = Container.GetExportedValues<ITracingSystemProxy>();
     this.proxyService = new ProxyService(proxys);
 }
Example #39
0
        private void StartInDomain()
        {
            GallatinEventLog.WriteEntry( "Starting Gallatin Proxy", EventLogEntryType.Information );

            AppDomainSetup appDomainSetup = new AppDomainSetup();
            appDomainSetup.ApplicationName = "GallatinProxyAppDomain";
            appDomainSetup.ShadowCopyFiles = "true";

            _domain = AppDomain.CreateDomain( "GallatinDomain", AppDomain.CurrentDomain.Evidence, appDomainSetup );
            _domain.UnhandledException += HandleDomainUnhandledException;
            _domain.InitializeLifetimeService();
            _service = (IProxyService) _domain.CreateInstanceAndUnwrap( "Gallatin.Core", "Gallatin.Core.Service.CrossDomainProxyService" );
            _service.Start();

            MarshalByRefObject marshalByRefObject = _service as MarshalByRefObject;
            if ( marshalByRefObject == null )
            {
                throw new InvalidCastException( "Unable to cast service as a MarshalByRefObject" );
            }

            _sponsor = new ClientSponsor();
            _sponsor.Register( marshalByRefObject );
        }
 /// <summary>
 ///     The initialize.
 /// </summary>
 /// <param name="components">
 ///     The components.
 /// </param>
 public override void Initialize(ComponentRegistry components)
 {
     _service = components.Get<IProxyService>();
 }