Project OkamiGSpeed

Homepage: https://amaterasu.moe/

OkamiGSpeed is a game acceleration software aimed for Chinese Mainland users.

This project was build into parts: The distributable client, and a server to handle authentication etc.

The Client

OkamiGSpeed Client Screenshot

The client was built with C# 4.5 with other open-source components:

After user have logged in and have selected the server they would like to connect to, the client will create an instance of "OkamiLauncher" with administrator privilege. The Launcher will then be used to interact with elevated OpenVPN.

To be able to communicate with elevated launcher, I have created a Communication Class using socket, that implements IBasicClient:

/// <summary>
/// A basic client interface used for elevated launcher.
/// </summary>
public interface IBasicClient
{
    /// <summary>
    /// Start the client.
    /// This should block the thread until the child-process exit.
    /// </summary>
    void Start();

    /// <summary>
    /// Pass in the command line arguments.
    /// </summary>
    /// <param name="arguments">
    /// arguments used start up the executable,
    /// without the class name (which was arguments[0]).
    /// </param>
    void SetupCliArguments(string[] arguments);

    /// <summary>
    /// Stop the execution of child process.
    /// </summary>
    void Kill();
}

The launcher will check the arguments, then use reflection to find corresponding IBasicClient interface and use it.

All communication logics are stored in the main executable. This way, when only one executable was upgraded, the communication is not going to break.

The Server

The server was built with Express to handle all the network traffic. On top of this, it is used to render a simple administration web page for admin to maintain the server side without restart the instance.

I did consider to make it in php, however I found that node js is not only more comfortable for me, as well as easy to debug without expose too much information to the public.

Is not much to talk about the server, pretty much standard stuff and it doesn't even use ajax to deliver dynamic content.

The End

Understood how RSA really works, when I was digging information about how to encrypt large chunks of data (i.e. data larger than the key size). I would also like to thank the project manager, Chen, who provided the server, helped me out debugging, and let me to deploy the server application.

It was all great fun to debug and messing around, after all.


首页: https://amaterasu.moe/

OkamiGSpeed 是一个针对国内用户设计的网游加速器。

这个项目分为两个部分:分发给用户的客户端,以及用于处理用户认证等功能的服务器。

客户端

OkamiGSpeed 客户端截图

客户端使用 C# 4.5 开发,使用了大量的开源第三方组件:

当用户登陆、选择服务器之后,客户端将已管理员权限启动 “OkamiLauncher”,与提权的 OpenVPN 进行交互。

为了让启动器与客户端相互交流,我建立了一个通信的基础类,而且实现了 IBasicClient 接口:

/// <summary>
/// A basic client interface used for elevated launcher.
/// </summary>
public interface IBasicClient
{
    /// <summary>
    /// Start the client.
    /// This should block the thread until the child-process exit.
    /// </summary>
    void Start();

    /// <summary>
    /// Pass in the command line arguments.
    /// </summary>
    /// <param name="arguments">
    /// arguments used start up the executable,
    /// without the class name (which was arguments[0]).
    /// </param>
    void SetupCliArguments(string[] arguments);

    /// <summary>
    /// Stop the execution of child process.
    /// </summary>
    void Kill();
}

而启动器则根据参数,利用反射寻找相对应的 IBasicClient 接口然后动态调用。

通信相关的逻辑全部储存在主程序,这样就不会因为两个程序的版本不一致导致通信错误。

服务器

服务器使用 Express 构建,主要用于与客户端的通信。
但是它也被用来提供一个基础的管理员后台,这样就可以不重启服务器更改设定。

开发的时候的确想过使用 php 来开发,但是我觉得 node 写起来更顺手,而且更加容易在不提供过多信息给公众的情况下调试。

服务器方面并没有什么值得一提的地方,连动态加载网页内容的 ajax 都没有。

结束语

在研究怎么加解密大块数据(数据长度 > 密钥长度) 的时候搞懂了 RSA 到底是怎么回事。同时感谢项目主管,晨,提供了服务器、帮助调试以及让我部署服务端应用。

过程中各种好玩的调试,不止一次吐槽过 C# 的一些奇葩特性,嘛。