Skip to content

Commit a7a3a3e

Browse files
authored
Merge pull request #14 from iyouport-org/dev
Dev
2 parents 303b53a + a751064 commit a7a3a3e

Some content is hidden

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

54 files changed

+1960
-273
lines changed

Diff for: .github/workflows/go.yaml

+4-1
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,8 @@ jobs:
2525
- name: Get dependencies
2626
run: go mod vendor
2727

28-
- name: Build
28+
- name: Build core
2929
run: make
30+
31+
- name: Build C++ static lib
32+
run: make desktop

Diff for: Makefile

+9-14
Original file line numberDiff line numberDiff line change
@@ -61,31 +61,31 @@ endif
6161
##############################
6262

6363
relaybaton: go
64-
GOROOT=$(GOROOT_LOCAL) go build -o $(PRJ_DIR)/bin/relaybaton $(PRJ_DIR)/cmd/cli/main.go
64+
GOROOT=$(GOROOT_LOCAL) go build -tags=jsoniter -ldflags="-s -w" -gcflags="-trimpath=$(go env GOPATH)" -asmflags=-trimpath=$(go env GOPATH) -o $(PRJ_DIR)/bin/relaybaton $(PRJ_DIR)/cmd/cli/main.go
6565

6666
desktop: go
67-
GOROOT=$(GOROOT_LOCAL) go build -buildmode=c-archive -o $(PRJ_DIR)/bin/core.a $(PRJ_DIR)/cmd/desktop/core.go
67+
GOROOT=$(GOROOT_LOCAL) go build -ldflags="-s -w" -gcflags="-trimpath=$(go env GOPATH)" -asmflags=-trimpath=$(go env GOPATH) -buildmode=c-archive -o $(PRJ_DIR)/bin/core.a $(PRJ_DIR)/cmd/desktop/core.go
6868

6969
mobile: go
7070
GO111MODULE="off" go get golang.org/x/mobile/cmd/gomobile
7171
GO111MODULE="off" go get golang.org/x/mobile/cmd/gobind
7272
GO111MODULE="off" gomobile init
73-
GOROOT=$(GOROOT_LOCAL) GO111MODULE="off" $(GOPATH_ENV)/bin/gomobile bind -v -o bin/relaybaton_mobile.aar -target=android $(PRJ_DIR)/cmd/relaybaton_mobile
73+
GOROOT=$(GOROOT_LOCAL) GO111MODULE="off" $(GOPATH_ENV)/bin/gomobile bind -o bin/relaybaton_mobile.aar -target=android -ldflags="-s -w" -gcflags="-trimpath=$(go env GOPATH)" $(PRJ_DIR)/cmd/relaybaton_mobile
7474

7575
cross_windows: go
76-
GOROOT=$(GOROOT_LOCAL) GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CC_FOR_TARGET=x86_64-w64-mingw32-gcc CC=x86_64-w64-mingw32-gcc CC_FOR_windows_amd64=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ CXX_FOR_TARGET=x86_64-w64-mingw32-g++ CXX_FOR_windows_amd64=x86_64-w64-mingw32-g++ go build -o $(PRJ_DIR)/bin/relaybaton.exe $(PRJ_DIR)/cmd/cli/main.go
76+
GOROOT=$(GOROOT_LOCAL) GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CC_FOR_TARGET=x86_64-w64-mingw32-gcc CC=x86_64-w64-mingw32-gcc CC_FOR_windows_amd64=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ CXX_FOR_TARGET=x86_64-w64-mingw32-g++ CXX_FOR_windows_amd64=x86_64-w64-mingw32-g++ go build -ldflags="-s -w" -gcflags="-trimpath=$(go env GOPATH)" -asmflags=-trimpath=$(go env GOPATH) -o $(PRJ_DIR)/bin/relaybaton.exe $(PRJ_DIR)/cmd/cli/main.go
7777

7878
cross_mac: go
79-
GOROOT=$(GOROOT_LOCAL) GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 CC_FOR_TARGET=o64-clang CC=o64-clang CC_FOR_darwin_amd64=o64-clang CXX=o64-clang++ CXX_FOR_TARGET=o64-clang++ CXX_FOR_darwin_amd64=o64-clang++ go build -o $(PRJ_DIR)/bin/relaybaton+darwin $(PRJ_DIR)/cmd/cli/main.go
79+
GOROOT=$(GOROOT_LOCAL) GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 CC_FOR_TARGET=o64-clang CC=o64-clang CC_FOR_darwin_amd64=o64-clang CXX=o64-clang++ CXX_FOR_TARGET=o64-clang++ CXX_FOR_darwin_amd64=o64-clang++ go build -ldflags="-s -w" -gcflags="-trimpath=$(go env GOPATH)" -asmflags=-trimpath=$(go env GOPATH) -o $(PRJ_DIR)/bin/relaybaton+darwin $(PRJ_DIR)/cmd/cli/main.go
8080

8181
cross_windows_desktop: go
82-
GOROOT=$(GOROOT_LOCAL) GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CC_FOR_TARGET=x86_64-w64-mingw32-gcc CC=x86_64-w64-mingw32-gcc CC_FOR_windows_amd64=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ CXX_FOR_TARGET=x86_64-w64-mingw32-g++ CXX_FOR_windows_amd64=x86_64-w64-mingw32-g++ go build -buildmode=c-archive -o $(PRJ_DIR)/bin/core.lib $(PRJ_DIR)/cmd/desktop/core.go
82+
GOROOT=$(GOROOT_LOCAL) GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CC_FOR_TARGET=x86_64-w64-mingw32-gcc CC=x86_64-w64-mingw32-gcc CC_FOR_windows_amd64=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ CXX_FOR_TARGET=x86_64-w64-mingw32-g++ CXX_FOR_windows_amd64=x86_64-w64-mingw32-g++ go build -ldflags="-s -w" -gcflags="-trimpath=$(go env GOPATH)" -asmflags=-trimpath=$(go env GOPATH) -buildmode=c-archive -o $(PRJ_DIR)/bin/core.lib $(PRJ_DIR)/cmd/desktop/core.go
8383

8484
cross_mac_desktop: go
85-
GOROOT=$(GOROOT_LOCAL) GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 CC_FOR_TARGET=o64-clang CC=o64-clang CC_FOR_darwin_amd64=o64-clang CXX=o64-clang++ CXX_FOR_TARGET=o64-clang++ CXX_FOR_darwin_amd64=o64-clang++ go build -buildmode=c-archive -o $(PRJ_DIR)/bin/core.a $(PRJ_DIR)/cmd/desktop/core.go
85+
GOROOT=$(GOROOT_LOCAL) GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 CC_FOR_TARGET=o64-clang CC=o64-clang CC_FOR_darwin_amd64=o64-clang CXX=o64-clang++ CXX_FOR_TARGET=o64-clang++ CXX_FOR_darwin_amd64=o64-clang++ go build -ldflags="-s -w" -gcflags=-trimpath="-trimpath=$(go env GOPATH)" -asmflags=-trimpath=$(go env GOPATH) -buildmode=c-archive -o $(PRJ_DIR)/bin/core.a $(PRJ_DIR)/cmd/desktop/core.go
8686

8787
cross_arm64: go
88-
GOROOT=$(GOROOT_LOCAL) GOOS=linux GOARCH=arm64 CGO_ENABLED=1 CC_FOR_TARGET=aarch64-linux-gnu-gcc CC=aarch64-linux-gnu-gcc CC_FOR_linux_arm64=o64-clang CXX=aarch64-linux-gnu-g++ CXX_FOR_TARGET=aarch64-linux-gnu-g++ CXX_FOR_linux_arm64=aarch64-linux-gnu-g++ go build -o $(PRJ_DIR)/bin/relaybaton-arm64 $(PRJ_DIR)/cmd/cli/main.go
88+
GOROOT=$(GOROOT_LOCAL) GOOS=linux GOARCH=arm64 CGO_ENABLED=1 CC_FOR_TARGET=aarch64-linux-gnu-gcc CC=aarch64-linux-gnu-gcc CC_FOR_linux_arm64=o64-clang CXX=aarch64-linux-gnu-g++ CXX_FOR_TARGET=aarch64-linux-gnu-g++ CXX_FOR_linux_arm64=aarch64-linux-gnu-g++ go build -ldflags="-s -w" -gcflags=-"-trimpath=$(go env GOPATH)" -asmflags=-trimpath=$(go env GOPATH) -o $(PRJ_DIR)/bin/relaybaton-arm64 $(PRJ_DIR)/cmd/cli/main.go
8989

9090
# Default target must build Go
9191
.PHONY: go
@@ -99,13 +99,8 @@ $(PRJ_DIR)/vendor:
9999
go mod tidy
100100
go mod vendor
101101

102-
$(GOROOT_LOCAL)/bin: $(GOROOT_ENV)/bin
103-
#rm -rf $(GOROOT_LOCAL)/bin
104-
#mkdir -p "$(GOROOT_LOCAL)/bin"
105-
#cp -r $(GOROOT_ENV)/bin $(GOROOT_LOCAL)/
106-
#cp -r $(GOPATH_ENV)/bin $(GOROOT_LOCAL)/
107102
# Replace the local copy if the system Go version has changed.
108-
$(GOROOT_LOCAL)/pkg/.ok_$(VER_OS_ARCH): $(GOROOT_ENV)/pkg | $(GOROOT_LOCAL)/src/$(STD_VENDOR_DIR) $(GOROOT_LOCAL)/bin
103+
$(GOROOT_LOCAL)/pkg/.ok_$(VER_OS_ARCH): $(GOROOT_ENV)/pkg
109104
rm -rf $(GOROOT_LOCAL)/pkg $(GOROOT_LOCAL)/src
110105
mkdir -p "$(GOROOT_LOCAL)/pkg"
111106
cp -r $(GOROOT_ENV)/src $(GOROOT_LOCAL)/

Diff for: README.md

+34-31
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# relaybaton
2+
23
A pluggable transport to circumvent Internet censorship with Encrypted SNI.
34

45
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5-
[![GoDoc](https://godoc.org/github.com/iyouport-org/relaybaton?status.svg)](https://godoc.org/github.com/iyouport-org/relaybaton)
6+
[![GoDoc](https://godoc.org/github.com/iyouport-org/relaybaton?status.svg)](https://pkg.go.dev/github.com/iyouport-org/relaybaton)
67
[![Go Report Card](https://goreportcard.com/badge/github.com/iyouport-org/relaybaton)](https://goreportcard.com/report/github.com/iyouport-org/relaybaton)
78

89
## Getting Started
@@ -19,7 +20,7 @@ go get github.com/iyouport-org/relaybaton
1920

2021
#### CLI
2122

22-
```CGO_ENABLED=1``` should be set in cross-compiling
23+
`CGO_ENABLED=1` should be set in cross-compiling
2324

2425
```bash
2526
make
@@ -44,13 +45,15 @@ For supporting ESNI features and hiding the IP address of the server from interc
4445
Cloudflare CDN will provide TLS encryption with ESNI extension.
4546

4647
### Server
47-
```sudo``` is required for listening on port 80
48+
49+
`sudo` is required for listening on port 80
4850

4951
```bash
5052
sudo relaybation server --config /path/to/server/config.toml
5153
```
5254

5355
### Client
56+
5457
```bash
5558
relaybation client --config /path/to/client/config.toml
5659
```
@@ -65,15 +68,15 @@ A local proxy server will listen on the local ports which given in the configura
6568
[client]
6669
port = 1080
6770
http_port = 1088
68-
transparent_port = 1090
71+
redir_port = 1090
6972
server = "example.com"
7073
username = "username"
7174
password = "password"
7275
proxy_all = true
7376

7477
[server]
7578
port = 80
76-
pretend = "https://www.kernel.org"
79+
admin_password = "password"
7780

7881
[db]
7982
type = "sqlite3"
@@ -96,40 +99,40 @@ level = "trace"
9699

97100
### Description of the fields
98101

99-
| Field | TOML Type | Go Type | Description |
100-
| :---------------------: | :-------: | :-----------------------------------------------: | :------------------------------------------------------: |
101-
| client.port | Integer | uint16 | SOCKS5 port that client listen to |
102-
| client.http_port | Integer | uint16 | HTTP port that client listen to |
103-
| client.transparent_port | Integer | uint16 | Redirect port that client listen to |
104-
| client.server | String | string | domain name of the server |
105-
| client.username | String | string | username of the client |
106-
| client.password | String | string | password of the client |
107-
| client.proxy_all | Boolean | bool | if proxy all traffic |
108-
| server.port | Integer | uint16 | port that server listen to |
109-
| server.pretend | String | url.URL | domain name of the website that the server pretend to be |
110-
| db.type | String | github.com/iyouport-org/relaybaton config.dbType | type of the database |
111-
| db.username | String | string | username for database connection |
112-
| db.password | String | string | password for database connection |
113-
| db.host | String | string | hostname for database connection |
114-
| db.port | Integer | uint16 | port for database connection |
115-
| db.database | String | string | name of database |
116-
| dns.type | String | github.com/iyouport-org/relaybaton config.DNSType | type of DNS resolver |
117-
| dns.server | String | string | server name of the DNS server |
118-
| dns.addr | String | net.Addr | IP address of the DNS server |
119-
| log.file | String | os.File | filename of log file |
120-
| log.level | String | github.com/sirupsen/logrus logrus.Level | minimum log level to write |
102+
| Field | TOML Type | Go Type | Description |
103+
| :-------------------: | :-------: | :-----------------------------------------------: | :---------------------------------: |
104+
| client.port | Integer | uint16 | SOCKS5 port that client listen to |
105+
| client.http_port | Integer | uint16 | HTTP port that client listen to |
106+
| client.redir_port | Integer | uint16 | Redirect port that client listen to |
107+
| client.server | String | string | domain name of the server |
108+
| client.username | String | string | username of the client |
109+
| client.password | String | string | password of the client |
110+
| client.proxy_all | Boolean | bool | if proxy all traffic |
111+
| server.port | Integer | uint16 | port that server listen to |
112+
| server.admin_password | String | string | password of account "admin" |
113+
| db.type | String | github.com/iyouport-org/relaybaton config.dbType | type of the database |
114+
| db.username | String | string | username for database connection |
115+
| db.password | String | string | password for database connection |
116+
| db.host | String | string | hostname for database connection |
117+
| db.port | Integer | uint16 | port for database connection |
118+
| db.database | String | string | name of database |
119+
| dns.type | String | github.com/iyouport-org/relaybaton config.DNSType | type of DNS resolver |
120+
| dns.server | String | string | server name of the DNS server |
121+
| dns.addr | String | net.Addr | IP address of the DNS server |
122+
| log.file | String | os.File | filename of log file |
123+
| log.level | String | github.com/sirupsen/logrus logrus.Level | minimum log level to write |
121124

122125
## Built With
123126

124-
* [github.com/cloudflare/tls-tris](https://github.com/cloudflare/tls-tris/tree/pwu/esni) - crypto/tls, now with 100% more 1.3.
127+
- [github.com/cloudflare/tls-tris](https://github.com/cloudflare/tls-tris/tree/pwu/esni) - crypto/tls, now with 100% more 1.3.
125128

126129
## Versioning
127130

128-
We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/iyouport-org/relaybaton/tags).
131+
We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/iyouport-org/relaybaton/tags).
129132

130133
## Authors
131134

132-
- [onoketa]((https://github.com/onoketa))
135+
- [onoketa](<(https://github.com/onoketa)>)
133136

134137
See also the list of [contributors](https://github.com/iyouport-org/relaybaton/contributors) who participated in this project.
135138

@@ -139,4 +142,4 @@ This project is licensed under the **MIT License** - see the [LICENSE](LICENSE)
139142

140143
## Acknowledgments
141144

142-
* Cloudflare
145+
- Cloudflare

Diff for: cmd/cli/main.go

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
package main
22

3-
// void Hello();
43
import (
54
"C"
5+
"os"
6+
"runtime/debug"
7+
68
_ "github.com/cloudflare/tls-tris"
9+
"github.com/gin-gonic/gin"
710
"github.com/iyouport-org/relaybaton/internal/cmd/relaybaton"
811
log "github.com/sirupsen/logrus"
912
"github.com/spf13/viper"
10-
"os"
11-
"runtime/debug"
1213
)
1314

1415
func main() {
@@ -31,4 +32,5 @@ func init() {
3132
}
3233
log.SetReportCaller(true)
3334
log.SetLevel(log.TraceLevel)
35+
gin.SetMode(gin.ReleaseMode)
3436
}

0 commit comments

Comments
 (0)