Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Hysteria2 Protocol #2721

Open
wants to merge 88 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
671e06c
Update Protobuf
JimmyHuang454 Oct 3, 2023
257cb9f
fix vprotogen check version
JimmyHuang454 Oct 3, 2023
11f6704
update README
JimmyHuang454 Oct 3, 2023
5d89c28
triger test
JimmyHuang454 Oct 3, 2023
b6a0f00
fix deprecated ReadFile()
JimmyHuang454 Oct 3, 2023
55cfdeb
fix deprecated grpc.WithInsecure()
JimmyHuang454 Oct 3, 2023
2d4f7f0
use DialEarly and rename conns
JimmyHuang454 Oct 3, 2023
e46987d
replace quic-go with apernet/quic-go
JimmyHuang454 Oct 3, 2023
b8768ed
go mode tidy
JimmyHuang454 Oct 3, 2023
96a1e63
add quic congestion
JimmyHuang454 Oct 3, 2023
b912374
fix brutal congestion setting
JimmyHuang454 Oct 3, 2023
5daf391
add congestion to quic server
JimmyHuang454 Oct 3, 2023
d789bfa
try fix quic timeout
JimmyHuang454 Oct 4, 2023
be6e364
fix test
JimmyHuang454 Oct 6, 2023
6478c8a
Merge branch 'master' of github.com:v2fly/v2ray-core into dev
JimmyHuang454 Oct 21, 2023
ecfc7f4
update vprotogen
JimmyHuang454 Oct 21, 2023
ea84415
fix BBR test
JimmyHuang454 Oct 22, 2023
9327ddf
go mod tidy
JimmyHuang454 Oct 22, 2023
44e011f
Merge branch 'master' of github.com:v2fly/v2ray-core into dev
JimmyHuang454 Oct 26, 2023
07478e6
update vprotogen
JimmyHuang454 Oct 26, 2023
150132d
add test and fix golint
JimmyHuang454 Oct 26, 2023
0b7f037
go mod tidy
JimmyHuang454 Oct 26, 2023
a7b0ef4
Merge branch 'master' of github.com:v2fly/v2ray-core into dev
JimmyHuang454 Nov 10, 2023
9fa7e87
add hysteria2(WIP)
JimmyHuang454 Nov 10, 2023
a392cf2
remove unused code
JimmyHuang454 Nov 10, 2023
3bac98a
update server side
JimmyHuang454 Nov 13, 2023
983fc00
update hysteria2 transport
JimmyHuang454 Nov 14, 2023
29359a8
rebase to original quic-go
JimmyHuang454 Nov 26, 2023
bd7cce4
Merge branch 'dev' of github.com:JimmyHuang454/v2ray-core into dev
JimmyHuang454 Nov 26, 2023
b2c5359
Merge branch 'master' of github.com:v2fly/v2ray-core into dev
JimmyHuang454 Dec 6, 2023
7305037
update
JimmyHuang454 Dec 6, 2023
3b0a885
update test case
JimmyHuang454 Dec 6, 2023
13d88de
Merge branch 'master' of github.com:v2fly/v2ray-core into dev
JimmyHuang454 Feb 9, 2024
32920f6
test ok
JimmyHuang454 Feb 13, 2024
10b1aee
run with v5 config
JimmyHuang454 Feb 13, 2024
8e794b2
add to v4
JimmyHuang454 Feb 13, 2024
9f26634
add hysteria2 tcp
JimmyHuang454 Feb 13, 2024
750a0e3
update test
JimmyHuang454 Feb 13, 2024
63159c3
update test
JimmyHuang454 Feb 14, 2024
6630faf
test ok
JimmyHuang454 Feb 14, 2024
573ce78
add config examples
JimmyHuang454 Feb 14, 2024
c4c2782
try add udp
JimmyHuang454 Feb 17, 2024
e690e4b
fix go mod
JimmyHuang454 Feb 27, 2024
3c49311
fix test
JimmyHuang454 Mar 2, 2024
1422206
use hyProtocol
JimmyHuang454 Mar 2, 2024
c622aa9
update
JimmyHuang454 Mar 3, 2024
7328121
Merge branch 'dev' of github.com:JimmyHuang454/v2ray-core into dev
JimmyHuang454 Mar 4, 2024
6a62f80
update
JimmyHuang454 Mar 7, 2024
38ddcb1
remove
JimmyHuang454 Mar 7, 2024
fa42b47
Merge branch 'master' of github.com:v2fly/v2ray-core into dev
JimmyHuang454 Mar 23, 2024
96529c6
add CloseHyClient
JimmyHuang454 Mar 30, 2024
3f49529
add udp
JimmyHuang454 Mar 30, 2024
fc77e5f
add UdpHijacker
JimmyHuang454 Mar 31, 2024
7d6818f
check IsServer before close
JimmyHuang454 Mar 31, 2024
760d9b6
update
JimmyHuang454 Apr 1, 2024
32902b2
update
JimmyHuang454 Apr 1, 2024
1bf4ee7
add package into hysteria2
JimmyHuang454 Apr 4, 2024
860af00
hysteria2 udp can not apply on others transport
JimmyHuang454 Apr 4, 2024
f5d3ba9
other proxy protocol can use udpExtension
JimmyHuang454 Apr 4, 2024
3e133d1
add udp test
JimmyHuang454 Apr 4, 2024
b3c31b6
remove fmt
JimmyHuang454 Apr 4, 2024
76f44b6
udp test ok
JimmyHuang454 Apr 5, 2024
a7399cd
change test name and add udp test
JimmyHuang454 Apr 5, 2024
70071f8
need to fix addr
JimmyHuang454 Apr 6, 2024
c6dc7e0
add address to udp
JimmyHuang454 Apr 7, 2024
50bc1f2
test udp ok
JimmyHuang454 Apr 7, 2024
cde121f
change config name
JimmyHuang454 Apr 8, 2024
6b0b561
change config name
JimmyHuang454 Apr 8, 2024
63b5d2b
Merge branch 'dev' of github.com:JimmyHuang454/v2ray-core into dev
JimmyHuang454 Apr 8, 2024
49ab4eb
add example config
JimmyHuang454 Apr 8, 2024
ab0f81b
update go mod
JimmyHuang454 Apr 8, 2024
78f563a
fix test
JimmyHuang454 Apr 8, 2024
cdbd68d
remove legacy code, add traffic counter(Only TCP), add err checker
JimmyHuang454 Apr 10, 2024
91c2d87
update example
JimmyHuang454 May 6, 2024
76051df
Merge branch 'master' of github.com:v2fly/v2ray-core into dev
JimmyHuang454 May 6, 2024
08ea4ef
fix hysteria2OnTCP and use ListenSystemPacket
JimmyHuang454 May 9, 2024
725e120
Merge branch 'master' of github.com:v2fly/v2ray-core into dev
JimmyHuang454 May 9, 2024
09e1776
rename
JimmyHuang454 May 9, 2024
fe0c3aa
rename and fix address parsing
JimmyHuang454 May 11, 2024
74593e0
rename and fix address parsing
JimmyHuang454 May 11, 2024
b2cb959
update core version
JimmyHuang454 May 11, 2024
3fdf7fe
Merge branch 'dev' of github.com:JimmyHuang454/v2ray-core into dev
JimmyHuang454 May 11, 2024
dfb42e1
update hysteria2
JimmyHuang454 May 11, 2024
2d0ba37
mod tidy
JimmyHuang454 May 11, 2024
0653961
optimize GetTLSConfig()
JimmyHuang454 May 13, 2024
8e323bf
update
JimmyHuang454 May 13, 2024
52c0007
remove and format legacy code
JimmyHuang454 May 23, 2024
221a25a
update hysteria2
JimmyHuang454 May 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/linter.yml
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v4
with:
go-version: ^1.19
go-version: ^1.21

- name: Checkout codebase
uses: actions/checkout@v3
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Expand Up @@ -5,7 +5,7 @@ on:
branches:
- master
- v*
- dev-*
- dev*
paths:
- "**/*.go"
- "go.mod"
Expand All @@ -30,7 +30,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v4
with:
go-version: ^1.19
go-version: ^1.21

- name: Checkout codebase
uses: actions/checkout@v3
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -26,3 +26,5 @@ vprotogen
errorgen
!common/errors/errorgen/
*.dat
*~
[._]*.un~
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -32,7 +32,7 @@ This repo relies on the following third-party projects:

- In production:
- [gorilla/websocket](https://github.com/gorilla/websocket)
- [lucas-clemente/quic-go](https://github.com/lucas-clemente/quic-go)
- [quic-go/quic-go](https://github.com/quic-go/quic-go)
- [pires/go-proxyproto](https://github.com/pires/go-proxyproto)
- [seiflotfy/cuckoofilter](https://github.com/seiflotfy/cuckoofilter)
- [google/starlark-go](https://github.com/google/starlark-go)
Expand Down
6 changes: 0 additions & 6 deletions app/dns/config.pb.go
@@ -1,9 +1,3 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.31.0
// protoc v4.24.4
// source: app/dns/config.proto

package dns

import (
Expand Down
15 changes: 13 additions & 2 deletions app/router/command/command_test.go
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/test/bufconn"

"github.com/v2fly/v2ray-core/v5/app/router"
Expand Down Expand Up @@ -90,7 +91,13 @@ func TestServiceSubscribeRoutingStats(t *testing.T) {
// Client goroutine
go func() {
defer lis.Close()
conn, err := grpc.DialContext(context.Background(), "bufnet", grpc.WithContextDialer(bufDialer), grpc.WithInsecure())
conn, err := grpc.DialContext(
context.Background(),
"bufnet",
grpc.WithContextDialer(bufDialer),
grpc.WithTransportCredentials(insecure.NewCredentials()),
)

if err != nil {
errCh <- err
return
Expand Down Expand Up @@ -268,7 +275,11 @@ func TestSerivceTestRoute(t *testing.T) {
// Client goroutine
go func() {
defer lis.Close()
conn, err := grpc.DialContext(context.Background(), "bufnet", grpc.WithContextDialer(bufDialer), grpc.WithInsecure())
conn, err := grpc.DialContext(
context.Background(),
"bufnet", grpc.WithContextDialer(bufDialer),
grpc.WithTransportCredentials(insecure.NewCredentials()),
)
if err != nil {
errCh <- err
}
Expand Down
235 changes: 115 additions & 120 deletions app/router/config.pb.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion config.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 17 additions & 9 deletions go.mod
Expand Up @@ -6,6 +6,8 @@ toolchain go1.21.4

require (
github.com/adrg/xdg v0.4.0
github.com/apernet/hysteria/core/v2 v2.0.0-20240523014710-44f4ddacfedf
github.com/apernet/quic-go v0.44.1-0.20240520215222-bb2e53664023
github.com/go-chi/chi/v5 v5.0.12
github.com/go-chi/render v1.0.3
github.com/go-playground/validator/v10 v10.20.0
Expand All @@ -32,10 +34,10 @@ require (
github.com/xiaokangwang/VLite v0.0.0-20220418190619-cff95160a432
go.starlark.net v0.0.0-20230612165344-9532f5667272
go4.org/netipx v0.0.0-20230303233057-f1b76eb4bb35
golang.org/x/crypto v0.22.0
golang.org/x/net v0.24.0
golang.org/x/crypto v0.23.0
golang.org/x/net v0.25.0
golang.org/x/sync v0.7.0
golang.org/x/sys v0.19.0
golang.org/x/sys v0.20.0
google.golang.org/grpc v1.63.2
google.golang.org/protobuf v1.34.0
gopkg.in/yaml.v3 v3.0.1
Expand All @@ -59,29 +61,35 @@ require (
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/google/btree v1.1.2 // indirect
github.com/google/pprof v0.0.0-20230602150820-91b7bce49751 // indirect
github.com/google/pprof v0.0.0-20240320155624-b11c3daa6f07 // indirect
github.com/klauspost/compress v1.17.4 // indirect
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
github.com/klauspost/reedsolomon v1.11.7 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/mustafaturan/monoton v1.0.0 // indirect
github.com/onsi/ginkgo/v2 v2.10.0 // indirect
github.com/onsi/ginkgo/v2 v2.17.0 // indirect
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
github.com/pion/dtls/v2 v2.2.7 // indirect
github.com/pion/logging v0.2.2 // indirect
github.com/pion/randutil v0.1.0 // indirect
github.com/pion/sctp v1.8.7 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/quic-go/qpack v0.4.0 // indirect
github.com/riobard/go-bloom v0.0.0-20200614022211-cdc8013cb5b3 // indirect
github.com/secure-io/siv-go v0.0.0-20180922214919-5ff40651e2c4 // indirect
github.com/stretchr/objx v0.5.2 // indirect
github.com/xtaci/smux v1.5.24 // indirect
go.uber.org/mock v0.4.0 // indirect
golang.org/x/exp v0.0.0-20230725093048-515e97ebf090 // indirect
golang.org/x/mod v0.16.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect
golang.org/x/mod v0.17.0 // indirect
golang.org/x/text v0.15.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.19.0 // indirect
golang.org/x/tools v0.21.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de // indirect
)

replace github.com/lunixbochs/struc v0.0.0-20200707160740-784aaebc1d40 => github.com/xiaokangwang/struc v0.0.0-20231031203518-0e381172f248

replace github.com/apernet/hysteria/core/v2 v2.0.0-20240523014710-44f4ddacfedf => github.com/JimmyHuang454/hysteria/core/v2 v2.0.0-20240523073322-ddfdce403cba

//replace github.com/apernet/hysteria/core/v2 => ../hysteria/core/