public ProxyConsole(string prefix) { //Create a ProxyOptions options = new ProxyOptions(); //If a filter list exists on disk, load it into the filter options.LoadFilter(); //logs stack for processing logged messages logs = new ConcurrentStack <string>(); //Begin the page serving server server.Prefixes.Add(prefix); server.Start(); server.BeginGetContext(Handle, null); //Begin the WebSocket listener httpListener = new HttpListener(); httpListener.Prefixes.Add("http://+:8080/"); httpListener.Start(); Write("Web Console Started"); }
public ProxyServer(RequestDelegate next, IOptions <ProxyOptions> options) { if (options == null) { throw new ArgumentNullException(nameof(options)); } if (options.Value.Scheme == null) { throw new ArgumentException("Options parameter must specify scheme.", nameof(options)); } if (!options.Value.Host.HasValue) { throw new ArgumentException("Options parameter must specify host.", nameof(options)); } _next = next ?? throw new ArgumentNullException(nameof(next)); _options = options.Value; }
public static void RunProxy(this IApplicationBuilder app, Uri baseUri) { if (app == null) { throw new ArgumentNullException(nameof(app)); } if (baseUri == null) { throw new ArgumentNullException(nameof(baseUri)); } var options = new ProxyOptions { Scheme = baseUri.Scheme, Host = new HostString(baseUri.Authority), PathBase = baseUri.AbsolutePath, AppendQuery = new QueryString(baseUri.Query) }; app.UseMiddleware <ProxyServer>(Options.Create(options)); }