Skip to content

Commit ba5d192

Browse files
author
Delta-Kronecker
committed
organize repo: tor source under tor-src/, portable data layout, start-tor.exe launcher
1 parent d732b3a commit ba5d192

1,429 files changed

Lines changed: 389 additions & 133 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build.yml

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -75,53 +75,57 @@ jobs:
7575
- name: Configure
7676
shell: msys2 {0}
7777
run: |
78-
cd "$GITHUB_WORKSPACE"
78+
cd "$GITHUB_WORKSPACE/tor-src"
7979
chmod +x configure
8080
./configure --host=x86_64-w64-mingw32 \
8181
--disable-asciidoc --disable-man --disable-html-docs
8282
8383
- name: Build
8484
shell: msys2 {0}
8585
run: |
86-
cd "$GITHUB_WORKSPACE"
86+
cd "$GITHUB_WORKSPACE/tor-src"
8787
make -j$(nproc) 2>&1 | tee build-win.log
8888
exit ${PIPESTATUS[0]}
8989
9090
- name: Smoke test
9191
shell: msys2 {0}
9292
run: |
93-
cd "$GITHUB_WORKSPACE"
93+
cd "$GITHUB_WORKSPACE/tor-src"
9494
./src/app/tor.exe --version
9595
9696
- name: Stage tor + runtime DLLs + geoip
9797
shell: msys2 {0}
9898
run: |
99-
cd "$GITHUB_WORKSPACE"
100-
mkdir -p dist/scripts dist/data
101-
cp src/app/tor.exe dist/
102-
cp "$MINGW_PREFIX"/bin/libevent*.dll "$MINGW_PREFIX"/bin/libssl-3-x64.dll "$MINGW_PREFIX"/bin/libcrypto-3-x64.dll "$MINGW_PREFIX"/bin/zlib1.dll dist/ 2>/dev/null || true
103-
cp src/config/geoip src/config/geoip6 dist/
99+
cd "$GITHUB_WORKSPACE/tor-src"
100+
mkdir -p ../dist/data/scripts
101+
cp src/app/tor.exe ../dist/data/
102+
cp "$MINGW_PREFIX"/bin/libevent*.dll "$MINGW_PREFIX"/bin/libssl-3-x64.dll "$MINGW_PREFIX"/bin/libcrypto-3-x64.dll "$MINGW_PREFIX"/bin/zlib1.dll ../dist/data/ 2>/dev/null || true
103+
cp src/config/geoip src/config/geoip6 ../dist/data/
104104
105105
- name: Download transports
106106
uses: actions/download-artifact@v4
107107
with:
108108
name: transports-win64
109109
path: transports/
110110

111-
- name: Merge transports into dist
111+
- name: Merge transports into dist/data
112112
shell: pwsh
113113
run: |
114-
Copy-Item "transports\*.exe" -Destination "dist\" -Force
115-
Get-ChildItem "dist" | Select-Object Name, Length
114+
Copy-Item "transports\*.exe" -Destination "dist\data\" -Force
115+
Get-ChildItem "dist" -Recurse -File | Select-Object FullName, Length
116116
117-
- name: Copy portable config, scripts, README, start.bat
117+
- name: Copy portable config, scripts, README
118118
shell: pwsh
119119
run: |
120-
Copy-Item "configs\torrc.iran" "dist\torrc" -Force
121-
Copy-Item "scripts\launcher.ps1" "dist\scripts\" -Force
122-
Copy-Item "scripts\fetch-bridges.ps1" "dist\scripts\" -Force
123-
if (Test-Path "README-iran.md") { Copy-Item "README-iran.md" "dist\" -Force }
124-
if (Test-Path "start.bat") { Copy-Item "start.bat" "dist\" -Force }
120+
Copy-Item "configs\torrc.iran" "dist\data\torrc" -Force
121+
Copy-Item "scripts\launcher.ps1" "dist\data\scripts\" -Force
122+
Copy-Item "scripts\fetch-bridges.ps1" "dist\data\scripts\" -Force
123+
Copy-Item "README.md" "dist\data\README.md" -Force
124+
125+
- name: Compile start-tor.exe
126+
shell: pwsh
127+
run: |
128+
& "scripts\build-start-tor.ps1" -OutFile "dist\start-tor.exe"
125129
126130
- name: Upload single release artifact
127131
uses: actions/upload-artifact@v4
@@ -134,4 +138,4 @@ jobs:
134138
uses: actions/upload-artifact@v4
135139
with:
136140
name: build-log-win
137-
path: build-win.log
141+
path: tor-src/build-win.log

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@
66

77
# tor runtime data (kept next to the packaged tor.exe, never in the repo)
88
data/
9+
10+
# locally compiled launcher (CI builds it into the artifact)
11+
/scripts/start-tor.exe

README-iran.md

Lines changed: 0 additions & 46 deletions
This file was deleted.

README.md

Lines changed: 32 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,46 @@
1-
Tor protects your privacy on the internet by hiding the connection between
2-
your Internet address and the services you use. We believe Tor is reasonably
3-
secure, but please ensure you read the instructions and configure it properly.
1+
# Tor Portable for Iran
42

5-
## Build
6-
7-
To build Tor from source:
8-
9-
```
10-
./configure
11-
make
12-
make install
13-
```
3+
Single-folder, portable Tor client for Iranian networks. Built in CI from the
4+
official tor 0.4.9.11 sources plus pluggable transports (obfs4, snowflake,
5+
webtunnel). No installation and no `%APPDATA%` — every file and all runtime
6+
state stays inside one folder, so you can copy or move it anywhere.
147

15-
To build Tor from a just-cloned git repository:
8+
## Layout
169

1710
```
18-
./autogen.sh
19-
./configure
20-
make
21-
make install
11+
start-tor.exe double-click to start Tor and set the system proxy
12+
data\ everything else lives here
13+
tor.exe + DLLs, geoip, geoip6, transports (obfs4/snowflake/webtunnel)
14+
torrc portable config (relative paths; sits next to tor.exe)
15+
scripts\ launcher.ps1 (new identity / stop) + fetch-bridges.ps1
16+
data\ runtime state (cached consensus, keys, tor.log)
2217
```
2318

24-
## Releases
25-
26-
The tarballs, checksums and signatures can be found here: https://dist.torproject.org
27-
28-
- Checksum: `<tarball-name>.sha256sum`
29-
- Signatures: `<tarball-name>.sha256sum.asc`
30-
31-
### Schedule
32-
33-
You can find our release schedule here:
34-
35-
- https://gitlab.torproject.org/tpo/core/team/-/wikis/NetworkTeam/CoreTorReleases
36-
37-
### Keys that CAN sign a release
19+
## Usage
3820

39-
The following keys are the maintainers of this repository. One or many of
40-
these keys can sign the releases, do NOT expect them all:
21+
1. Download the `tor-win64-portable` artifact from GitHub Actions and unzip.
22+
2. Double-click `start-tor.exe`.
23+
3. Tor bootstraps (direct by default). On 100% the system proxy is enabled
24+
(HTTP 127.0.0.1:8118, SOCKS5 127.0.0.1:9050, DNS 127.0.0.1:53530).
25+
Press Enter to stop Tor and restore the proxy.
4126

42-
- Alexander Færøy:
43-
[514102454D0A87DB0767A1EBBE6A0531C18A9179](https://keys.openpgp.org/vks/v1/by-fingerprint/1C1BC007A9F607AA8152C040BEA7B180B1491921)
44-
- David Goulet:
45-
[B74417EDDF22AC9F9E90F49142E86A2A11F48D36](https://keys.openpgp.org/vks/v1/by-fingerprint/B74417EDDF22AC9F9E90F49142E86A2A11F48D36)
46-
- Nick Mathewson:
47-
[2133BC600AB133E1D826D173FE43009C4607B1FB](https://keys.openpgp.org/vks/v1/by-fingerprint/2133BC600AB133E1D826D173FE43009C4607B1FB)
27+
## If Tor is blocked
4828

49-
## Development
29+
Run `data\scripts\fetch-bridges.ps1` to fetch fresh bridges (it rewrites
30+
`data\torrc`), then start again.
5031

51-
See our hacking documentation in [doc/HACKING/](./doc/HACKING).
32+
## Advanced
5233

53-
## Resources
54-
55-
Home page:
56-
57-
- https://www.torproject.org/
58-
59-
Download new versions:
60-
61-
- https://www.torproject.org/download/tor
62-
63-
How to verify Tor source:
64-
65-
- https://support.torproject.org/little-t-tor/
66-
67-
Documentation and Frequently Asked Questions:
34+
```
35+
data\scripts\launcher.ps1 -NewCircuit request a new identity
36+
data\scripts\launcher.ps1 -Stop stop Tor and restore the proxy
37+
```
6838

69-
- https://support.torproject.org/
39+
## Build
7040

71-
How to run a Tor relay:
41+
`.github/workflows/build.yml` builds tor + transports on every push and
42+
publishes the `tor-win64-portable` artifact.
7243

73-
- https://community.torproject.org/relay/
44+
- `tor-src\` — unmodified official tor 0.4.9.11 source
45+
- `configs\torrc.iran` — the portable config template (becomes `data\torrc`)
46+
- `scripts\start-tor.cs` — source of `start-tor.exe` (compiled with `build-start-tor.ps1`)

scripts/build-start-tor.ps1

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<#
2+
.SYNOPSIS
3+
Compile scripts\start-tor.cs into start-tor.exe using the .NET Framework csc.
4+
5+
.PARAMETER OutFile
6+
Output path for start-tor.exe (default: scripts\start-tor.exe)
7+
#>
8+
param(
9+
[string]$OutFile = (Join-Path $PSScriptRoot "start-tor.exe")
10+
)
11+
12+
$candidates = @(
13+
(Join-Path $env:WINDIR "Microsoft.NET\Framework64\v4.0.30319\csc.exe"),
14+
(Join-Path $env:WINDIR "Microsoft.NET\Framework\v4.0.30319\csc.exe")
15+
)
16+
$csc = $candidates | Where-Object { Test-Path $_ } | Select-Object -First 1
17+
if (-not $csc) { Write-Host "[x] csc.exe ('.NET Framework 4.x') not found."; exit 1 }
18+
19+
$src = Join-Path $PSScriptRoot "start-tor.cs"
20+
& $csc -nologo -optimize+ -target:exe -out:$OutFile $src
21+
if ($LASTEXITCODE -ne 0) { Write-Host "[x] compile failed ($LASTEXITCODE)"; exit $LASTEXITCODE }
22+
Write-Host "[ok] built $OutFile"

scripts/fetch-bridges.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,4 +145,4 @@ if ($all.Count -gt 0) {
145145
Write-Host " 3. Paste them into: $TorrcPath (add 'Bridge ' before each)"
146146
}
147147
if ($failed.Count) { Write-Host "No bridges for: $($failed -join ', ')" }
148-
Write-Host "Run tor.exe (or start.bat / launcher.ps1) to connect."
148+
Write-Host "Run start-tor.exe (or data\scripts\launcher.ps1) to connect."

scripts/launcher.ps1

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44
system proxy (HTTP 127.0.0.1:8118) on success.
55
66
.DESCRIPTION
7-
Layout (fully portable, all files together):
7+
Layout (fully portable, all files together under data\):
88
folder\
9-
tor.exe + DLLs + webtunnel.exe + obfs4proxy.exe + snowflake-client.exe
10-
torrc <- complete config (direct by default, or with
11-
bridges after running fetch-bridges.ps1)
12-
data\ <- created next to tor.exe: tor.log, bridges.txt
9+
start-tor.exe
10+
data\
11+
tor.exe + DLLs + transports + torrc + geoip + geoip6
12+
scripts\ <- this script + fetch-bridges.ps1
13+
data\ <- runtime state: tor.log, cached-*, keys
1314
1415
There is NO runtime config generation: torrc already sits next to tor.exe.
1516
This launcher just starts tor, waits for 100% bootstrap and sets the system

0 commit comments

Comments
 (0)