public RootConfig() { Logging = new LoggingConfig(); Proxy = new ProxyConfig(); EndpointDefinition = AWSConfigs._endpointDefinition; Region = AWSConfigs._awsRegion; ProfileName = AWSConfigs._awsProfileName; ProfilesLocation = AWSConfigs._awsAccountsLocation; UseSdkCache = AWSConfigs._useSdkCache; CorrectForClockSkew = true; #if !WIN_RT && !WINDOWS_PHONE var root = AWSConfigs.GetSection <AWSSection>(_rootAwsSectionName); Logging.Configure(root.Logging); Proxy.Configure(root.Proxy); ServiceSections = root.ServiceSections; if (root.UseSdkCache.HasValue) { UseSdkCache = root.UseSdkCache.Value; } EndpointDefinition = Choose(EndpointDefinition, root.EndpointDefinition); Region = Choose(Region, root.Region); ProfileName = Choose(ProfileName, root.ProfileName); ProfilesLocation = Choose(ProfilesLocation, root.ProfilesLocation); if (root.CorrectForClockSkew.HasValue) { CorrectForClockSkew = root.CorrectForClockSkew.Value; } #endif }
public static IServiceCollection AddProxyConnector( this IServiceCollection services, ProxyConfig config) { ProxyConnectionInfo connectionInfo; switch (config.AuthType) { case ProxyConfig.CertificateAuthType: connectionInfo = new ProxyConnectionInfo(config.Endpoint, config.Certificate.Thumbprint); break; case ProxyConfig.VaultCertificateAuthType: connectionInfo = new ProxyConnectionInfo( config.Endpoint, new KeyVaultConfiguration( config.VaultCertificate.ClientId, config.VaultCertificate.ClientSecret, config.VaultCertificate.VaultName ), config.VaultCertificate.CertName ); break; default: connectionInfo = new ProxyConnectionInfo(config.Endpoint); break; } return(services .AddScoped(serv => connectionInfo) .AddScoped <TicketingClient, ProxyClient>() .AddScoped <Connector, ProxyConnector>()); }
public Runner(ILogger <Runner> logger, string configPath) { log = logger; log.LogInformation("Starting Ari Proxy"); // Load config ProxyConfig.Current = ProxyConfig.Load(configPath); try { // Init using ( BackendProvider.Current = CreateProvider(ProxyConfig.Current.BackendProvider, ProxyConfig.Current.BackendConfig)) { // LoadAPCoRs(log); LoadAppProxies(log); log.LogInformation("Load complete"); Console.CancelKeyPress += Console_CancelKeyPress; // Wait for exit _quitEvent.WaitOne(); Console.CancelKeyPress -= Console_CancelKeyPress; } } catch (Exception ex) { log.LogCritical("Something went wrong... " + ex.Message, ex); } }
public frmSecondGlance() { InitializeComponent(); PacketType[] types = (PacketType[])Enum.GetValues(typeof(PacketType)); // Fill up the "To Log" combo box with options foreach (PacketType type in types) { if (type != PacketType.Default) { cboToLog.Items.Add(type); } } // Set the default selection to the first entry cboToLog.SelectedIndex = 0; // Setup the proxy ProxyConfig proxyConfig = new ProxyConfig("Second Glance", "John Hurliman <*****@*****.**>", new string[0]); Proxy = new Proxy(proxyConfig); Proxy.Start(); // Start the timer that moves packets from the queue and displays them DisplayTimer.Elapsed += new System.Timers.ElapsedEventHandler(DisplayTimer_Elapsed); DisplayTimer.Start(); }
protected void Page_Load(object sender, EventArgs e) { Request.InputStream.Position = 0; try { JSONRequest req = JSON.GetRequest(Request.InputStream); using (IAMDatabase db = new IAMDatabase(IAMDatabase.GetWebConnectionString())) { ProxyConfig config = new ProxyConfig(); config.GetDBConfig(db.Connection, ((EnterpriseData)Page.Session["enterprise_data"]).Id, req.host); if (config.fqdn != null) //Encontrou o proxy { //Limpa os certificados para não enviar config.server_cert = ""; config.server_pkcs12_cert = ""; config.client_cert = ""; db.ExecuteNonQuery("update proxy set last_sync = getdate(), address = '" + Tools.Tool.GetIPAddress() + "', config = 0 where id = " + config.proxyID, System.Data.CommandType.Text, null); ReturnHolder.Controls.Add(new LiteralControl(config.ToJsonString())); } else { db.AddUserLog(LogKey.API_Error, DateTime.Now, "ProxyAPI", UserLogLevel.Warning, 0, ((EnterpriseData)Page.Session["enterprise_data"]).Id, 0, 0, 0, 0, 0, "Proxy not found " + req.host, req.ToString()); } } } catch (Exception ex) { Tools.Tool.notifyException(ex, this); //throw ex; } }
public static WebClient GetTorWebClient() { WebClient wc = new WebClient(); if (NetworkAdapter.OpenVpnAdapter != null && NetworkAdapter.OpenVpnAdapter.IsConnected) { return(wc); } try { var proxyConfig = new ProxyConfig( //This is an internal http->socks proxy that runs in process IPAddress.Parse(Settings.BrowserProxy), //This is the port your in process http->socks proxy will run on 53549, //This could be an address to a local socks proxy (ex: Tor / Tor Browser, If Tor is running it will be on 127.0.0.1) IPAddress.Parse(Settings.BrowserProxy), //This is the port that the socks proxy lives on (ex: Tor / Tor Browser, Tor is 9150) 9150, //This Can be Socks4 or Socks5 ProxyConfig.SocksVersion.Five ); var proxy = new SocksWebProxy(proxyConfig); wc.Proxy = proxy;// new WebProxy(Settings.BrowserProxy, true); } catch (Exception ex) { Logging.Log("Error: not able to establish Tor proxy."); } return(wc); }
/// <summary> /// Compute proxy config from env var /// </summary> /// <returns>Config from env var</returns> private static ProxyConfig ParseConfig() { if (Config == null) { // retrieve Proxy address string[] proxyConfig = System.Environment.GetEnvironmentVariable("SOCKS5_PROXY").Split(':'); if (proxyConfig.Length != 2) { throw new Exception("Bad IP format for SOCKS5_PROXY"); } byte[] ip = proxyConfig[0].Split('.').Select(x => Convert.ToByte(x)).ToArray(); if (ip.Length != 4) { throw new Exception("Bad IP format for SOCKS5_PROXY"); } Config = new ProxyConfig() { proxyAddress = new Socket.in_addr() { s_b1 = ip[0], s_b2 = ip[1], s_b3 = ip[2], s_b4 = ip[3] }, proxyPort = Convert.ToUInt16(proxyConfig[1]) }; } return(Config); }
public RootConfig() { Logging = new LoggingConfig(); Proxy = new ProxyConfig(); EndpointDefinition = AWSConfigs._endpointDefinition; Region = AWSConfigs._awsRegion; ProfileName = AWSConfigs._awsProfileName; ProfilesLocation = AWSConfigs._awsAccountsLocation; UseSdkCache = AWSConfigs._useSdkCache; CorrectForClockSkew = true; AWSSection section = AWSConfigs.GetSection <AWSSection>("aws"); Logging.Configure(section.Logging); Proxy.Configure(section.Proxy); ServiceSections = section.ServiceSections; if (section.UseSdkCache.HasValue) { UseSdkCache = section.UseSdkCache.Value; } EndpointDefinition = Choose(EndpointDefinition, section.EndpointDefinition); Region = Choose(Region, section.Region); ProfileName = Choose(ProfileName, section.ProfileName); ProfilesLocation = Choose(ProfilesLocation, section.ProfilesLocation); ApplicationName = Choose(ApplicationName, section.ApplicationName); if (section.CorrectForClockSkew.HasValue) { CorrectForClockSkew = section.CorrectForClockSkew.Value; } }
private void LoadCurrentConfiguration() { _modifiedConfiguration = controller.GetConfigurationCopy().proxy; UseProxyCheckBox.Checked = _modifiedConfiguration.useProxy; ProxyServerTextBox.Text = _modifiedConfiguration.proxyServer; ProxyPortTextBox.Text = _modifiedConfiguration.proxyPort.ToString(); }
/// <summary> /// /// </summary> private DomainFacade(ProxyConfig pConfig, IPlugin pPlugin) { cPlugin = pPlugin; cObserverList = new List <IObserver>(); cInfrastructure = InfrastructureFacade.getInstance(pConfig, pPlugin); cRecordList = new List <POP3Account>(); }
private void button4_Click(object sender, EventArgs e) { //取消 ProxyConfig.Instance = ProxyConfig.Load(ProxyConfig.DefaultFile); LoadConfig(); }
private ProxyListener GetListener(ProxyConfig config, bool allowBypass = true) { lock (locker) { SocksWebProxy.allowBypass = allowBypass; if (listeners == null) { listeners = new List <ProxyListener>(); } var listener = listeners.Where(x => x.Port == config.HttpPort).FirstOrDefault(); if (listener == null) { listener = new ProxyListener(config); listener.Start(); listeners.Add(listener); } if (listener.Version != config.Version) { throw new Exception("Socks Version Mismatch for Port " + config.HttpPort); } return(listener); } }
private void button_getIESet_Click(object sender, RoutedEventArgs e) { CurrentUserIEProxyConfig ieConfig = new CurrentUserIEProxyConfig(); textBox_proxy_addr.Text = ""; if (util.GetIEProxyConfig(ref ieConfig) == true) { if (ieConfig.proxy.Length == 0) { ProxyConfig proxyConfig = new ProxyConfig(); if (ieConfig.autoDetect == 1) { util.GetProxyAutoDetect(ref proxyConfig); if (proxyConfig.proxy.Length > 0) { textBox_proxy_addr.Text = proxyConfig.proxy; } } if (proxyConfig.proxy.Length == 0 && ieConfig.autoConfigUrl.Length > 0) { util.GetProxyAutoScript(ieConfig.autoConfigUrl, ref proxyConfig); if (proxyConfig.proxy.Length > 0) { textBox_proxy_addr.Text = proxyConfig.proxy; } } } else { textBox_proxy_addr.Text = ieConfig.proxy; } } }
public ProxyListener(ProxyConfig config) : base(config.HttpAddress, config.HttpPort) { Port = config.HttpPort; Version = config.Version; Config = config; }
/// <summary> /// 加载配置 /// </summary> /// <returns></returns> ProxyConfig LoadConfig() { if (!File.Exists(ProxyConfig.DefaultFile)) { return(null); } ProxyConfig config = ProxyConfig.Instance; if (config == null || config.Listeners == null || config.Listeners.Length < 1) { return(null); } //服务不会修改配置文件,所以不保存 //config.IsSaved = true; //建立监视器 if (watcher == null) { watcher = new FileSystemWatcher(); String path = ProxyConfig.DefaultFile; watcher.Path = Path.GetDirectoryName(path); watcher.Filter = Path.GetFileName(path); watcher.NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite | NotifyFilters.FileName; watcher.Changed += new FileSystemEventHandler(watcher_Changed); watcher.EnableRaisingEvents = true; //XLog.Trace.WriteLine("建立监视器!"); } return(config); }
/// <summary> /// 启动服务 /// </summary> public void StartService() { ProxyConfig config = LoadConfig(); if (config == null) { XLog.Trace.WriteLine("无法找到配置文件!"); return; } foreach (ListenerConfig lc in config.Listeners) { if (lc.Enable) { try { Listener listener = new Listener(lc); Listeners.Add(listener); if (lc.IsShow) { listener.OnWriteLog += WriteLogEvent; } listener.Start(); } catch (Exception ex) { XLog.Trace.WriteLine("启动[" + lc.Name + "]时出错!" + ex.ToString()); } } } }
public ConnectorStarter(String ConfigJson, PluginConnectorBase plugin) { if (plugin == null) { throw new Exception("Plugin is null"); } if (String.IsNullOrWhiteSpace(ConfigJson)) { throw new Exception("Config is null or empty"); } System.Reflection.Assembly asm = System.Reflection.Assembly.GetAssembly(this.GetType()); basePath = Path.GetDirectoryName(asm.Location); config = new ProxyConfig(); config.FromJsonString(ConfigJson); ConfigJson = null; this.plugin = plugin; logProxy = new LogProxy(basePath, config.server_cert); pluginsTimer = new Timer(new TimerCallback(TimerCallback), null, 1000, 60000); }
private static void Main(string[] args) { Logger.Info("Starting Ari Proxy"); // Load config ProxyConfig.Current = ProxyConfig.Load(); try { // Init using ( BackendProvider.Current = CreateProvider(ProxyConfig.Current.BackendProvider, ProxyConfig.Current.BackendConfig)) { LoadAPCoRs(); LoadAppProxies(); Logger.Info("Load complete"); Console.CancelKeyPress += Console_CancelKeyPress; // Wait for exit _quitEvent.WaitOne(); Console.CancelKeyPress -= Console_CancelKeyPress; } } catch (Exception ex) { Logger.Fatal("Something went wrong... " + ex.Message, ex); } }
private ProxyConfigService GetSut(ProxyConfig config) { var mockProxyConfigService = new Mock <ProxyConfigService>(_mockHostingEnv.Object, "mock.path.json"); mockProxyConfigService.SetupGet(x => x.Config).Returns(config); return(mockProxyConfigService.Object); }
internal RootConfig() { Logging = new LoggingConfig(); DynamoDB = new DynamoDBConfig(); S3 = new S3Config(); EC2 = new EC2Config(); Proxy = new ProxyConfig(); EndpointDefinition = AWSConfigs._endpointDefinition; Region = AWSConfigs._awsRegion; ProfileName = AWSConfigs._awsProfileName; ProfilesLocation = AWSConfigs._awsAccountsLocation; #if !WIN_RT && !WINDOWS_PHONE //var root = AWSConfigs.GetSection<AWSSection>(_rootAwsSectionName); // Logging.Configure(root.Logging); // DynamoDB.Configure(root.DynamoDB); // S3.Configure(root.S3); // EC2.Configure(root.EC2); // Proxy.Configure(root.Proxy); // // EndpointDefinition = Choose(EndpointDefinition, root.EndpointDefinition); // Region = Choose(Region, root.Region); // ProfileName = Choose(ProfileName, root.ProfileName); // ProfilesLocation = Choose(ProfilesLocation, root.ProfilesLocation); #endif }
public RootConfig() { Logging = new LoggingConfig(); Proxy = new ProxyConfig(); EndpointDefinition = AWSConfigs._endpointDefinition; Region = AWSConfigs._awsRegion; ProfileName = AWSConfigs._awsProfileName; ProfilesLocation = AWSConfigs._awsAccountsLocation; UseSdkCache = AWSConfigs._useSdkCache; CorrectForClockSkew = true; #if !PCL var root = AWSConfigs.GetSection<AWSSection>(_rootAwsSectionName); Logging.Configure(root.Logging); Proxy.Configure(root.Proxy); ServiceSections = root.ServiceSections; if (root.UseSdkCache.HasValue) UseSdkCache = root.UseSdkCache.Value; EndpointDefinition = Choose(EndpointDefinition, root.EndpointDefinition); Region = Choose(Region, root.Region); ProfileName = Choose(ProfileName, root.ProfileName); ProfilesLocation = Choose(ProfilesLocation, root.ProfilesLocation); ApplicationName = Choose(ApplicationName, root.ApplicationName); if (root.CorrectForClockSkew.HasValue) CorrectForClockSkew = root.CorrectForClockSkew.Value; #endif }
void LoadConfig() { ProxyConfig pc = ProxyConfig.Instance; if (pc == null) { return; } ListenerConfig[] list = pc.Listeners; if (list == null || list.Length < 1) { return; } this.Tag = list; listView1.Items.Clear(); foreach (ListenerConfig lc in list) { String str = lc.Name; if (String.IsNullOrEmpty(str)) { str = "未命名"; } ListViewItem item = listView1.Items.Add(""); //item.ImageList = imageList1; item.ImageKey = lc.Enable ? "Ok.ico" : "Delete.ico"; item.SubItems.Add(str); item.SubItems.Add(lc.Port.ToString()); item.SubItems.Add(lc.ServerAddress + ":" + lc.ServerPort.ToString()); item.Tag = lc; } propertyGrid1.SelectedObject = null; }
public override void Initialize(Uri uri, ProxyConfig proxyConfig) { base.Initialize(uri, proxyConfig); FileDownloaded += OnFileDownloaded; FileDownloadFailed += OnFileDownloadFailed; }
/// <summary> /// /// </summary> public DomainFacade(ProxyConfig pProxyConfig, IPlugin pPlugin) { cPlugin = pPlugin; cRecordList = new List <IMAP4Account>(); cObserverList = new List <IObserver>(); cInfrastructure = InfrastructureFacade.getInstance(pProxyConfig, pPlugin); }
static void Main(string[] args) { ProxyConfig config = new ProxyConfig(); config.EnableRequestLog = true; config.RouteMaps.Add(new ProxyRouteMap() { Prefix = "/api/", Host = "localhost:62477", Match = "" }); config.RouteMaps.Add(new ProxyRouteMap() { Prefix = "/api2/", Host = "localhost:8018", Match = "/api2/", Map = "/" }); string configStr = Newtonsoft.Json.JsonConvert.SerializeObject(config); Console.WriteLine(configStr); // try { DoTest(); } catch (Exception ex) { } Console.Read(); }
private void ImportDelete(ProxyConfig config, JsonGeneric jData, FileInfo f, JSONRequest req, IAMDatabase db) { Int32 resourceCol = jData.GetKeyIndex("resource"); Int32 sourceCol = jData.GetKeyIndex("source"); Int32 uriCol = jData.GetKeyIndex("uri"); Int32 entityIdCol = jData.GetKeyIndex("entityid"); Int32 identityIdCol = jData.GetKeyIndex("identityid"); if (resourceCol == -1) { TextLog.Log("Inbound", "\t[ImportDelete] Erro on find column 'resource' in " + f.Name + " enterprise " + req.enterpriseid + " and proxy " + req.host); return; } if (sourceCol == -1) { TextLog.Log("Inbound", "\t[ImportDelete] Erro on find column 'source' in " + f.Name + " enterprise " + req.enterpriseid + " and proxy " + req.host); return; } if (uriCol == -1) { TextLog.Log("Inbound", "\t[ImportDelete] Erro on find column 'uri' in " + f.Name + " enterprise " + req.enterpriseid + " and proxy " + req.host); return; } if (entityIdCol == -1) { TextLog.Log("Inbound", "\t[ImportDelete] Erro on find column 'entityId' in " + f.Name + " enterprise " + req.enterpriseid + " and proxy " + req.host); return; } if (identityIdCol == -1) { TextLog.Log("Inbound", "\t[ImportDelete] Erro on find column 'identityId' in " + f.Name + " enterprise " + req.enterpriseid + " and proxy " + req.host); return; } DateTime date = DateTime.Now; foreach (String[] dr in jData.data) { try { db.ExecuteNonQuery("update [identity] set deleted = 1, deleted_date = '" + date.ToString("o") + "' where id = " + dr[identityIdCol], CommandType.Text, null); } catch { } } #if DEBUG TextLog.Log("Inbound", "\t[ImportDelete] Changed " + jData.data.Count + " identities for deleted status in enterprise " + req.enterpriseid + " and proxy " + req.host); #endif jData = null; }
public WebControl() { InitializeComponent(); _proxyConfig = new ProxyConfig(); _savedTracks = new List <FullTrack>(); }
public StateMemory(IMemoryAPI eliteApi) { EliteApi = eliteApi; Executor = new Executor(eliteApi); UnitService = new UnitService(eliteApi); UnitFilters = new UnitFilters(); Config = new ProxyConfig(); }
public void GetUri_NullHost() { ProxyConfig config = new ProxyConfig { Host = null }; Assert.Throws <ArgumentNullException>(() => config.GetUri()); }
public void GetUri_EmptyHost() { ProxyConfig config = new ProxyConfig { Host = string.Empty }; Assert.Throws <UriFormatException>(() => config.GetUri()); }
public void GetUri_HostAddressWithoutScheme() { ProxyConfig config = new ProxyConfig { Host = "192.168.0.1" }; CheckUri(config.GetUri(), "http", "192.168.0.1", 80); }
public void GetUri_HostNameWithoutScheme() { ProxyConfig config = new ProxyConfig { Host = "test-host.com" }; CheckUri(config.GetUri(), "http", "test-host.com", 80); }
void CoreListener.RegistrationStateChanged(ProxyConfig config, RegistrationState state, string message) { RegistrationStateText = message; }
public Proxy(ProxyConfig config){}
// SimProxy: construct a proxy for a single simulator public SimProxy(ProxyConfig proxyConfig, IPEndPoint simEndPoint, Proxy proxy) { this.proxyConfig = proxyConfig; remoteEndPoint = new IPEndPoint(simEndPoint.Address, simEndPoint.Port); this.proxy = proxy; socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); socket.Bind(new IPEndPoint(proxyConfig.clientFacingAddress, 0)); proxy.AddHandler(remoteEndPoint, this); Reset(); }
public ProxyClient(ProxyConfig config, Socket ClientSocket, DestroyDelegate Destroyer) : base(ClientSocket, Destroyer) { Config = config; }