Browse Source

use local port in pac

tags/2.3
clowwindy 10 years ago
parent
commit
5aa2822904
2 changed files with 8 additions and 1 deletions
  1. +7
    -1
      shadowsocks-csharp/Controller/PACServer.cs
  2. +1
    -0
      shadowsocks-csharp/Controller/ShadowsocksController.cs

+ 7
- 1
shadowsocks-csharp/Controller/PACServer.cs View File

@@ -17,6 +17,7 @@ namespace Shadowsocks.Controller
public static string PAC_FILE = "pac.txt";
FileSystemWatcher watcher;
private Configuration _config;
public event EventHandler PACFileChanged;
@@ -25,6 +26,11 @@ namespace Shadowsocks.Controller
this.WatchPacFile();
}
public void UpdateConfiguration(Configuration config)
{
this._config = config;
}
public bool Handle(byte[] firstPacket, int length, Socket socket)
{
try
@@ -159,7 +165,7 @@ Connection: Close
private string GetPACAddress(byte[] requestBuf, int length, IPEndPoint localEndPoint)
{
return "PROXY " + localEndPoint.Address + ":8123;";
return "PROXY " + localEndPoint.Address + ":" + this._config.localPort + ";";
}
}
}

+ 1
- 0
shadowsocks-csharp/Controller/ShadowsocksController.cs View File

@@ -196,6 +196,7 @@ namespace Shadowsocks.Controller
_pacServer = new PACServer();
_pacServer.PACFileChanged += pacServer_PACFileChanged;
}
_pacServer.UpdateConfiguration(_config);
if (gfwListUpdater == null)
{
gfwListUpdater = new GFWListUpdater();


Loading…
Cancel
Save