mirror of
https://github.com/jie65535/GrasscutterCommandGenerator.git
synced 2025-10-22 20:09:46 +08:00
Add Proxy page
This commit is contained in:
@@ -30,6 +30,11 @@ namespace GrasscutterTools.Utils
|
||||
{
|
||||
private const string TAG = "Proxy";
|
||||
|
||||
static ProxyHelper()
|
||||
{
|
||||
Eavesdropper.Certifier = new Certifier("jie65535", "GrasscutterTools Root Certificate Authority");
|
||||
}
|
||||
|
||||
#region - Windows API -
|
||||
|
||||
[DllImport("wininet.dll")]
|
||||
@@ -171,6 +176,8 @@ namespace GrasscutterTools.Utils
|
||||
private static string _gcDispatch;
|
||||
public static void StartProxy(string gcDispatch)
|
||||
{
|
||||
// Check Url format
|
||||
var _ = new Uri(gcDispatch);
|
||||
_gcDispatch = gcDispatch.TrimEnd('/');
|
||||
Logger.I(TAG, "Start Proxy, redirect to " + _gcDispatch);
|
||||
StartGsProxyServer(ProxyServerPort);
|
||||
@@ -184,12 +191,16 @@ namespace GrasscutterTools.Utils
|
||||
StopGsProxyServer();
|
||||
}
|
||||
|
||||
public static bool CheckAndCreateCertifier()
|
||||
public static bool CheckAndCreateCertificate()
|
||||
{
|
||||
Eavesdropper.Certifier = new Certifier("jie65535", "GrasscutterTools Root Certificate Authority");
|
||||
return Eavesdropper.Certifier.CreateTrustedRootCertificate();
|
||||
}
|
||||
|
||||
public static bool DestroyCertificate()
|
||||
{
|
||||
return Eavesdropper.Certifier.DestroyTrustedRootCertificate();
|
||||
}
|
||||
|
||||
public static bool IsRunning => Eavesdropper.IsRunning;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user