public GClass123(ProxySettings[] proxySettings_1, int int_1 = 0) { Class13.NP5bWyNzLwONS(); base..ctor(); if (int_1 < 0 || int_1 > 65535) { throw new ArgumentOutOfRangeException("internalServerPort"); } if (proxySettings_1 == null) { throw new ArgumentNullException("proxyList"); } if (proxySettings_1.Length == 0) { throw new ArgumentException("proxyList is empty", "proxyList"); } if (proxySettings_1.Any(new Func <ProxySettings, bool>(GClass123.< > c.< > c_0.method_0))) { throw new ArgumentNullException("proxyList", "Proxy in proxyList is null"); } this.proxySettings_0 = proxySettings_1; this.method_1(int_1); this.socket_0 = GClass123.smethod_4(); this.socket_0.Bind(new IPEndPoint(IPAddress.Loopback, this.method_0())); if (this.method_0() == 0) { this.method_1(((IPEndPoint)this.socket_0.LocalEndPoint).Port); } this.uri_0 = new Uri("http://127.0.0.1:" + this.method_0().ToString()); this.socket_0.Listen(8); this.socket_0.BeginAccept(new AsyncCallback(this.method_4), null); }
private void method_5(Socket socket_1) { Socket socket = null; bool flag = true; try { string string_; int num; string text; bool flag2; string string_2; byte[] array; if (GClass123.smethod_0(socket_1, out string_, out num, out text, out flag2, out string_2, out array)) { try { socket = GClass123.smethod_4(); socket.Connect(this.proxySettings_0[0].Host, this.proxySettings_0[0].Port); } catch (SocketException) { GClass123.smethod_3(socket_1, (GClass123.GEnum7)(-2147483644), "HTTP/1.1 "); flag = false; } catch (Exception) { GClass123.smethod_3(socket_1, (GClass123.GEnum7)(-2147483647), "HTTP/1.1 "); flag = false; } if (flag) { int i = 0; while (i < this.proxySettings_0.Length - 1) { ProxySettings proxySettings = this.proxySettings_0[i]; ProxySettings proxySettings2 = this.proxySettings_0[i + 1]; GClass123.GEnum7 genum = GClass123.Class3.smethod_0(socket, proxySettings2.Host, proxySettings2.Port, proxySettings); if (genum == (GClass123.GEnum7) 0) { i++; } else { GClass123.smethod_3(socket_1, genum, text); flag = false; IL_CE: if (!flag) { goto IL_12E; } ProxySettings proxySettings3 = this.proxySettings_0.Last <ProxySettings>(); genum = GClass123.Class3.smethod_0(socket, string_, num, proxySettings3); if (genum != (GClass123.GEnum7) 0) { GClass123.smethod_3(socket_1, genum, text); flag = false; goto IL_12E; } if (flag2) { GClass123.smethod_2(socket_1, text + "200 Connection established\r\nProxy-Agent: HttpToSocksProxy\r\n\r\n"); goto IL_12E; } GClass123.smethod_2(socket, string_2); if (array != null) { socket.Send(array, SocketFlags.None); goto IL_12E; } goto IL_12E; } } goto IL_CE; } } else { flag = false; } IL_12E :; } catch { flag = false; try { GClass123.smethod_3(socket_1, (GClass123.GEnum7)(-2147483647), "HTTP/1.1 "); } catch { } } finally { if (flag) { GClass123.Class2.smethod_1(socket, socket_1); } else { socket_1.smethod_3(); socket.smethod_3(); } } }