Skip to content

Commit cbfb3c0

Browse files
committed
refactor: adopt src/ project layout
- Moved core and UI code into `src/`. - Moved assets and generated files into `resources/` and `src/ui/generated/`. - Added `run.py` as entry point and `build_ui.py` for Qt compilation. - Updated docs and GitHub Actions workflow.
1 parent e63a0ca commit cbfb3c0

37 files changed

Lines changed: 324 additions & 295 deletions

.github/workflows/build.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
2929
- name: Package application
3030
run: >
31-
pyinstaller -i icons/icon.ico -F -w --clean --noupx --log-level WARN
31+
pyinstaller -i resources/icons/icon.ico -n main -F -w --clean --noupx --log-level WARN
3232
--exclude-module tkinter
3333
--exclude-module turtle
3434
--exclude-module unittest
@@ -67,7 +67,7 @@ jobs:
6767
--exclude-module PySide6.QtSvg
6868
--exclude-module PySide6.QtSvgWidgets
6969
--exclude-module PySide6.QtUiTools
70-
main.py
70+
run.py
7171
7272
- name: Upload package
7373
uses: actions/upload-artifact@v4
@@ -97,13 +97,14 @@ jobs:
9797
uses: Nuitka/Nuitka-Action@main
9898
with:
9999
nuitka-version: main
100-
script-name: main.py
100+
script-name: run.py
101101
output-dir: build
102102
mode: onefile
103103
enable-plugins: pyside6
104104
msvc: latest
105105
windows-console-mode: disable
106-
windows-icon-from-ico: icons/icon.ico
106+
windows-icon-from-ico: resources/icons/icon.ico
107+
output-file: main.exe
107108
disable-cache: true
108109

109110
- name: Upload package
@@ -132,7 +133,7 @@ jobs:
132133
133134
- name: Package application
134135
run: >
135-
pyinstaller -i icons/icon.icns -F -w --clean --log-level WARN
136+
pyinstaller -i resources/icons/icon.icns -n main -F -w --clean --log-level WARN
136137
--exclude-module tkinter
137138
--exclude-module turtle
138139
--exclude-module unittest
@@ -172,7 +173,7 @@ jobs:
172173
--exclude-module PySide6.QtSvg
173174
--exclude-module PySide6.QtSvgWidgets
174175
--exclude-module PySide6.QtUiTools
175-
main.py
176+
run.py
176177
177178
- name: Zip application
178179
run: |

README.en.md

Lines changed: 49 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -2,104 +2,92 @@
22

33
<h1>GoogleTranslate_IPFinder</h1>
44

5-
<a href="http://github.com/GoodCoder666/GoogleTranslate_IPFinder/releases"><img alt="GitHub release" src="https://img.shields.io/github/release/GoodCoder666/GoogleTranslate_IPFinder.svg" /></a>
6-
<a href="http://github.com/GoodCoder666/GoogleTranslate_IPFinder/releases"><img alt="GitHub Release Date" src="https://img.shields.io/github/release-date/GoodCoder666/GoogleTranslate_IPFinder.svg" /></a>
7-
<a href="http://github.com/GoodCoder666/GoogleTranslate_IPFinder/LICENSE.md"><img alt="License" src="https://img.shields.io/github/license/GoodCoder666/GoogleTranslate_IPFinder.svg" /></a>
8-
<a href="http://github.com/GoodCoder666/GoogleTranslate_IPFinder/stargazers"><img alt="GitHub stars" src="https://img.shields.io/github/stars/GoodCoder666/GoogleTranslate_IPFinder.svg?style=social" /></a>
5+
<a href="https://github.com/GoodCoder666/GoogleTranslate_IPFinder/releases"><img alt="GitHub release" src="https://img.shields.io/github/release/GoodCoder666/GoogleTranslate_IPFinder.svg" /></a>
6+
<a href="https://github.com/GoodCoder666/GoogleTranslate_IPFinder/releases"><img alt="GitHub Release Date" src="https://img.shields.io/github/release-date/GoodCoder666/GoogleTranslate_IPFinder.svg" /></a>
7+
<a href="https://github.com/GoodCoder666/GoogleTranslate_IPFinder/blob/main/LICENSE"><img alt="License" src="https://img.shields.io/github/license/GoodCoder666/GoogleTranslate_IPFinder.svg" /></a>
8+
<a href="https://github.com/GoodCoder666/GoogleTranslate_IPFinder/stargazers"><img alt="GitHub stars" src="https://img.shields.io/github/stars/GoodCoder666/GoogleTranslate_IPFinder.svg?style=social" /></a>
99

1010
<a href="./README.md">简体中文</a> | English
1111

1212
</div>
1313

14-
## Project summary
14+
## About the Project
1515

16-
Google Translate API server (`translate.googleapis.com`) IP address scanning and speed test tool.
16+
An IP address scanner and speed testing tool for the Google Translate API server (`translate.googleapis.com`) in mainland China.
1717

1818
<details>
1919
<summary>Project Background</summary>
20-
Google stopped providing translation services on mainland China GWS servers in September 2022. This project aims to help users find usable GWS IPs and override local domain name resolution to access Google Translate servers.
20+
Google stopped translation services on GWS servers in mainland China in September 2022. This project aims to help users find usable GWS IPs for translation and override local DNS resolution results to regain access to Google Translate servers.
2121
</details>
2222

2323
<details>
2424
<summary>Disclaimer</summary>
25-
Please comply with local laws and Google's policies when using this open-source software. <strong>All consequences of illegal or unauthorized use are your own responsibility.</strong>
25+
When using this open-source software, please comply with local laws and regulations, as well as relevant Google policies. <strong>You are solely responsible for any consequences arising from illegal or non-compliant use.</strong>
2626
</details>
2727

28-
Stable version download link:
28+
Stable release download link:
2929

3030
- [https://github.com/GoodCoder666/GoogleTranslate_IPFinder/releases](https://github.com/GoodCoder666/GoogleTranslate_IPFinder/releases)
3131

32-
Preview version (alpha) download links:
32+
Preview release (alpha) download links:
3333

3434
- Windows: [https://github.com/GoodCoder666/GoogleTranslate_IPFinder/releases/download/alpha/checker-win-x64.exe](https://github.com/GoodCoder666/GoogleTranslate_IPFinder/releases/download/alpha/checker-win-x64.exe)
3535
- Mac OS: [https://github.com/GoodCoder666/GoogleTranslate_IPFinder/releases/download/alpha/checker-mac.zip](https://github.com/GoodCoder666/GoogleTranslate_IPFinder/releases/download/alpha/checker-mac.zip)
3636

3737
<details>
3838
<summary>About the English translations</summary>
39-
We <a href="https://github.com/GoodCoder666/GoogleTranslate_IPFinder/issues/38">noticed</a> that the tool might also be helpful in other countries/regions, thus English translations are added on 21 Sep, 2024. This document is mostly translated with ChatGPT and the UI is translated all by myself. Feel free to open an issue if something is wrong.
39+
We <a href="https://github.com/GoodCoder666/GoogleTranslate_IPFinder/issues/38">noticed</a> that the tool might also be helpful in other countries/regions, thus English translations are added on 21 Sep, 2024. This document is mostly translated with <strong>Gemini 3.1 Pro</strong> and the UI is translated all by myself. Feel free to open an issue if something is wrong.
4040
</details>
4141

42-
4342
> [!NOTE]
4443
>
45-
> **This project has only been tested on Windows 11.** If you encounter bugs on other operating systems, please [submit an issue](https://github.com/GoodCoder666/GoogleTranslate_IPFinder/issues/new).
44+
> **This project has only been tested on Windows 11.** If the program does not work properly on other operating systems, please [open an issue](https://github.com/GoodCoder666/GoogleTranslate_IPFinder/issues/new).
4645
>
47-
> *Due to the limitations of Python, this project does not support Windows 7 or earlier.*
46+
> *Due to Python limitations, this project does not support Windows 7 and below.*
4847
4948
## Quick Start
5049

51-
Steps for basic usage (speed test + Hosts file update):
50+
Standard usage steps (Speed test + Write to Hosts):
5251

53-
1. Download the executable file for your system (links above).
54-
2. Open it with administrator/sudo permissions. **This is required to use the Hosts file writing feature.**
55-
3. Select "Test" and wait for the operation to complete.
56-
4. Click "Update hosts," and the Google Translate API will be accessible.
52+
1. Download the executable file for your respective system (links above).
53+
2. Open with administrator/sudo privileges. **This is required to use the Write to Hosts feature.**
54+
3. Select "Speedtest" and wait for the operation to complete.
55+
4. Click "Write to Hosts", and the Google Translate API will function normally.
5756

5857
> [!TIP]
5958
>
60-
> Difference between "Test" and "Scan":
59+
> Difference between "Speed Test" and "Scan":
6160
>
62-
> - **Test**: Identifies usable IPs from the available IPs (IP library) and sorts them by response time. Once this process is complete, you can write to the Hosts file.
63-
> - **Scan**: Finds usable IPs from the GWS IP range and adds them to the IP library. *Since the GWS network is very large, scanning even a small preset part often takes a long time.*
61+
> - **Speed Test**: Finds available IPs from the IPs to be tested (i.e., the IP library) and sorts them by response time. After this operation is complete, you can write the results to your Hosts file.
62+
> - **Scan**: Finds available IPs from GWS IP ranges and puts them into the IP library. *Because the GWS network is extremely large, scanning even a small preset portion usually takes a long time.*
6463
>
65-
> Generally, just start the program, select "Test" (using the default IP library), and then write to the Hosts file to restore access to Google Translate services.
64+
> Generally, after starting the program, you can directly select "Speed Test" (using the default IP library) and then write to Hosts to restore the Google Translate web service.
6665
67-
A demonstration for Windows 11:
66+
Windows 11 system demonstration:
6867

6968
![](screenshots/1.gif)
7069

7170
> [!WARNING]
7271
>
73-
> **The stability of IPv6 addresses is generally poor, so avoid using them unless absolutely necessary.**
72+
> **The stability of IPv6 addresses is generally poor; try to avoid using them unless absolutely necessary.**
7473
>
75-
> Considering IP stability, all IPs must pass at least 3 tests before they appear in the speed test results by default. If you want to verify the stability of a single IP, use the "Debug" feature.
74+
> Considering IP stability issues, under default settings, all IPs must pass at least 3 tests before being displayed in the speed test results. If you want to verify the stability of a single IP, please use the "Debug" feature.
7675
>
77-
> If you must use IPv6, it's recommended to set the number of speed tests to the maximum (10) in "Settings > Speed Test."
76+
> If you must use IPv6, it is recommended to adjust the test count to the maximum value of 10 under "Settings > Speedtest".
7877
>
79-
> For discussions on IP availability, see [#42](https://github.com/GoodCoder666/GoogleTranslate_IPFinder/issues/42).
80-
81-
## Feature Comparison
82-
83-
| Feature | This Project | [GoogleTranslateIpCheck](https://github.com/Ponderfly/GoogleTranslateIpCheck) | [google-translate-cn-ip](https://github.com/hcfyapp/google-translate-cn-ip) | [ip-scanner](https://github.com/csyezheng/ip-scanner) | [gscan_quic](https://codeberg.org/antigng/gscan_quic) |
84-
| :-------------: | :---------------------: | :------------------------------------------------------: | :------------------------------------------------------: | :----------------------------------------------: | :----------------------------------------------: |
85-
| IP Collection | ✔️ | ✔️ | ✔️ | ✔️ ||
86-
| IP Scanning | ✔️ | ✔️ || ✔️ | ✔️ |
87-
| IP Speed Test | ✔️ | ✔️ | ✔️ |||
88-
| Hosts File Write | ✔️ | ✔️ ||||
89-
| GUI | ✔️ |||||
90-
| English Support | ✔️ |||||
78+
> For discussions regarding IP availability issues, please refer to [#42](https://github.com/GoodCoder666/GoogleTranslate_IPFinder/issues/42).
9179
92-
## Running from Source
80+
## Running from Source Code
9381

94-
Running from source works on any operating system with a graphical interface, as long as Python >= 3.6 is installed (with the additional `PySide6` package).
82+
Running from source code is applicable to all operating systems that support graphical interfaces. It requires Python >= 3.10 (3.12 and above is recommended).
9583

96-
For Linux:
84+
For Linux systems:
9785

9886
```bash
9987
$ git clone https://github.com/GoodCoder666/GoogleTranslate_IPFinder.git
10088
$ cd GoogleTranslate_IPFinder
101-
$ pip3 install PySide6
102-
$ python3 main.py
89+
$ pip3 install PySide6 aiohttp
90+
$ python3 run.py
10391
```
10492

10593
For non-Linux systems:
@@ -108,38 +96,34 @@ For non-Linux systems:
10896
git clone https://github.com/GoodCoder666/GoogleTranslate_IPFinder.git
10997
cd GoogleTranslate_IPFinder
11098
pip install -r requirements.txt
111-
python main.py
99+
python run.py
112100
```
113101

114102
## Development Roadmap
115103

116-
- [x] IP Speed Test
117-
- [x] IP Scanning
118-
- [x] Automatic Hosts File Write
119-
- [x] Automatic IP List Retrieval
120-
- [x] Speed Test/Scan Progress Bar
121-
- [ ] Customizable IP Range Scanning
104+
* [x] IP Speed Test
105+
* [x] IP Scan
106+
* [x] Automatically Write to Hosts
107+
* [x] Automatically Fetch IP List
108+
* [x] Speed Test/Scan Progress Bar
109+
* [x] Custom Scan IP Ranges
122110

123-
...(If you have other requests, feel free to submit them in the [issues](https://github.com/GoodCoder666/GoogleTranslate_IPFinder/issues)).
111+
... (If you have other feature requests, feel free to raise them in [issues](https://github.com/GoodCoder666/GoogleTranslate_IPFinder/issues))
124112

125-
## About Online Syncing
113+
## About the Online Sync Feature
126114

127-
> [!WARNING]
128-
>
129-
> The following mentioned libraries are designed for use in Mainland China. Consider running a full scan to get available IPs.
130-
>
131-
> This part may be outdated. Please refer to the Chinese README for accurate information.
115+
The [Official IPv4 Address Library](https://github.com/GoodCoder666/gtdb) is built into the program and is updated periodically alongside feature updates. You can sync the latest IP library via `Import -> Online Services`. Additionally, two IP libraries from GoogleTranslateIpCheck are provided as options (Thanks to @Ponderfly). The URLs for the three libraries are as follows:
132116

133-
The [official IPv4 address library](https://github.com/GoodCoder666/gtdb) is built into the program and is periodically updated with new features. You can sync the latest IP library via `Import -> Online service`. Two IP libraries from GoogleTranslateIpCheck are also available (thanks to @Ponderfly). The URLs of the three libraries are as follows:
117+
* Official IPv4: https://raw.githubusercontent.com/GoodCoder666/gtdb/main/src/ip.txt
118+
* Extended IPv4: https://raw.githubusercontent.com/Ponderfly/GoogleTranslateIpCheck/master/src/GoogleTranslateIpCheck/GoogleTranslateIpCheck/ip.txt
119+
* Extended IPv6: https://raw.githubusercontent.com/Ponderfly/GoogleTranslateIpCheck/master/src/GoogleTranslateIpCheck/GoogleTranslateIpCheck/IPv6.txt
134120

135-
- Official IPv4: https://raw.githubusercontent.com/GoodCoder666/gtdb/main/src/ip.txt
136-
- Extended IPv4: https://raw.githubusercontent.com/Ponderfly/GoogleTranslateIpCheck/master/src/GoogleTranslateIpCheck/GoogleTranslateIpCheck/ip.txt
137-
- Extended IPv6: https://raw.githubusercontent.com/Ponderfly/GoogleTranslateIpCheck/master/src/GoogleTranslateIpCheck/GoogleTranslateIpCheck/IPv6.txt
121+
There is also a newly included [Super Address Library](https://github.com/GoodCoder666/gtdb/tree/main/full), which is recommended to try when all the above IPs become invalid.
138122

139123
Additionally, if GitHub Raw cannot be connected, the program will attempt to use the [ghproxy](https://ghproxy.net/) mirror. Please be patient.
140124

141-
## License Information
125+
## License
142126

143-
This project is licensed under the [GPLv3](https://github.com/GoodCoder666/GoogleTranslate_IPFinder/blob/main/LICENSE). The IP scanning logic references [gscan_quic](https://codeberg.org/antigng/gscan_quic).
127+
This project is licensed under the [GPLv3](https://github.com/GoodCoder666/GoogleTranslate_IPFinder/blob/main/LICENSE) license. The IP scanning logic is inspired by [gscan_quic](https://codeberg.org/antigng/gscan_quic).
144128

145-
Similar projects: [hcfyapp/google-translate-cn-ip](https://github.com/hcfyapp/google-translate-cn-ip) [Ponderfly/GoogleTranslateIpCheck](https://github.com/Ponderfly/GoogleTranslateIpCheck) [csyezheng/ip-scanner](https://github.com/csyezheng/ip-scanner).
129+
Similar projects: [hcfyapp/google-translate-cn-ip](https://github.com/hcfyapp/google-translate-cn-ip) | [Ponderfly/GoogleTranslateIpCheck](https://github.com/Ponderfly/GoogleTranslateIpCheck) | [csyezheng/ip-scanner](https://github.com/csyezheng/ip-scanner)

README.md

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,6 @@ Windows 11 系统演示如下:
7272
>
7373
> 关于 IP 可用性问题的讨论请移步 [#42](https://github.com/GoodCoder666/GoogleTranslate_IPFinder/issues/42)
7474
75-
## 功能对比
76-
77-
| 功能 | 本项目 | [GoogleTranslateIpCheck](https://github.com/Ponderfly/GoogleTranslateIpCheck) | [google-translate-cn-ip](https://github.com/hcfyapp/google-translate-cn-ip) | [ip-scanner](https://github.com/csyezheng/ip-scanner) | [gscan_quic](https://codeberg.org/antigng/gscan_quic) |
78-
| :----------: | :----------------: | :----------------------------------------------------------: | :----------------------------------------------------------: | :---------------------------------------------------: | :---------------------------------------------------: |
79-
| IP 收集 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :x: |
80-
| IP 扫描 | :heavy_check_mark: | :heavy_check_mark: | :x: | :heavy_check_mark: | :heavy_check_mark: |
81-
| IP 测速 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :x: | :x: |
82-
| HOSTS 写入 | :heavy_check_mark: | :heavy_check_mark: | :x: | :x: | :x: |
83-
| GUI 图形界面 | :heavy_check_mark: | :x: | :x: | :x: | :x: |
84-
8575
## 从源代码运行
8676

8777
从源代码运行的方法适用于所有支持图形界面的操作系统,只需 Python >= 3.10(推荐 3.12 及以上版本)。
@@ -92,7 +82,7 @@ Windows 11 系统演示如下:
9282
$ git clone https://github.com/GoodCoder666/GoogleTranslate_IPFinder.git
9383
$ cd GoogleTranslate_IPFinder
9484
$ pip3 install PySide6 aiohttp
95-
$ python3 main.py
85+
$ python3 run.py
9686
```
9787

9888
对于非 Linux 系统:
@@ -101,7 +91,7 @@ $ python3 main.py
10191
git clone https://github.com/GoodCoder666/GoogleTranslate_IPFinder.git
10292
cd GoogleTranslate_IPFinder
10393
pip install -r requirements.txt
104-
python main.py
94+
python run.py
10595
```
10696

10797
## 开发计划

0 commit comments

Comments
 (0)