Compare commits

...

1201 commits

Author SHA1 Message Date
Toby
245c6e9bd1
Merge pull request #1332 from apernet/add-license
chore: add LICENSE to packages
2025-03-18 20:45:32 -07:00
Toby
ffab01730a chore: add LICENSE to packages 2025-03-18 20:44:59 -07:00
Toby
401ed5245d
Merge pull request #1306 from apernet/wip-userpass-ignore-case
Make username of userpass case insensitive
2025-02-03 18:05:27 -08:00
Toby
9466bc4e2f
Merge pull request #1307 from apernet/bump-quic
feat: quic-go v0.49.0
2025-02-03 18:04:56 -08:00
Toby
e11ad2b93b feat: quic-go v0.49.0 2025-02-03 18:04:17 -08:00
Haruue
7652ddcd99
chore: unexport UserPassAuthenticator.Users 2025-02-03 12:39:52 +09:00
Haruue
e1df8aa4e2
chore: make username of userpass case insensitive
close: #1297

Just a workaround for "uppercase usernames do not work".

Usernames in different cases (like "Gawr" and "gawR") will now conflict.
2025-02-03 12:34:01 +09:00
Toby
8c05217590
Merge pull request #1293 from zyppe/master
Add support for loongarch64
2025-01-12 19:57:53 -08:00
Haruue
d86aa0b4e2
chore(scripts): detect arch for loong64 2025-01-08 14:57:02 +09:00
Haruue
537e8144ea
ci: add linux/loong64 to platforms.txt 2025-01-08 14:56:15 +09:00
zyppe
817d6c9a2d
Add support for loongarch64
Test on Loongson 3A5000
2025-01-04 22:45:11 +08:00
Toby
5520bcc405
Merge pull request #1287 from apernet/fix-tun-ipv6-disable
fix: tun failed on linux when ipv6.disable=1
2025-01-03 20:50:10 -08:00
Toby
9e90d7d155
Merge pull request #1288 from apernet/wip-masq-insecure-upstream
feat: allow skip cert verify in masquerade.proxy
2024-12-29 11:25:38 -08:00
Toby
8aa80c233e fix: rename insecureSkipVerify to insecure for consistency 2024-12-29 11:25:08 -08:00
Haruue
2bdaf7b46a
feat: allow skip cert verify in masquerade.proxy
close: #1278

masquerade.proxy.insecureSkipVerify
2024-12-29 13:58:12 +09:00
Haruue
53a4ce2598
fix: tun failed on linux when ipv6.disable=1
close: #1285
2024-12-29 13:33:32 +09:00
Toby
cd396eea60
Merge pull request #1272 from apernet/wip-rename-libversion
chore(version): rename LibVersion to Libraries
2024-12-12 18:40:49 -08:00
Haruue
400fed3bd6
chore(version): rename LibVersion to Libraries
close: #1271

A key that also contains "Version" broke the version parsing of some
third-party clients.
2024-12-11 18:08:54 +09:00
Toby
6655d2a78d
Merge pull request #1258 from apernet/wip-server-fastopen
feat(server): tcp fast open on direct outbounds
2024-12-10 23:03:52 -08:00
Toby
5e11ea18fb chore: update core/go.mod 2024-12-10 22:42:25 -08:00
Haruue
d8c61c59d7
chore: disable fallback mode of tfo dialer
tfo-go caches the "unsupported" status when fallback mode is enabled.
In other words, if the hysteria server is started with
net.ipv4.tcp_fastopen=0 and it fails once, the tfo will not be enabled
until it is restarted, even if the user later sets sysctl
net.ipv4.tcp_fastopen=3.
2024-11-23 22:31:14 +09:00
Haruue
16c964b3e1
feat(server): tcp fast open on direct outbounds 2024-11-23 21:37:18 +09:00
Toby
15e31d48a0
Merge pull request #1247 from apernet/wip-dumpstream
feat: add /dump/streams as a traffic stats API
2024-11-08 17:31:35 -08:00
Toby
3e8c20518d chore: minor code tweaks 2024-11-08 14:29:50 -08:00
Toby
9cb8cb4f53 Merge branch 'master' into wip-dumpstream 2024-11-08 14:15:11 -08:00
Haruue
7ac8d87dda
test: fix integration_tests for trafficlogger 2024-11-08 16:03:48 +09:00
Haruue
0681638568
feat(trafficlogger): dump streams stats 2024-11-08 15:28:50 +09:00
Toby
c34f23755a
Merge pull request #1244 from apernet/better-version
feat: add toolchain & quic-go to version info
2024-11-04 21:28:53 -08:00
Toby
a52b02ba2b
Merge pull request #1243 from apernet/bump-quic
feat: quic-go v0.48.1
2024-11-04 21:27:32 -08:00
Haruue
d4a1c2b580
fix(scripts): extra line in installed version
Checking for installed version ... v2.5.2
v0.47.1
Checking for latest version ... v2.5.2
2024-11-05 10:06:43 +09:00
Toby
685cd3663b feat: add toolchain & quic-go to version info 2024-11-04 12:01:00 -08:00
Toby
04cf6f2e1a feat: quic-go v0.48.1 2024-11-04 11:32:58 -08:00
Toby
a2c7b8fd19
Merge pull request #1242 from apernet/fix-portunion-65535
fix: infinite loop in PortUnion.Ports() when port range contains 65535
2024-11-04 10:38:08 -08:00
Haruue
9a21e2e8c6
chore: a better fix to portunion 2024-11-05 01:30:44 +09:00
Haruue
a9422e63be
test: add ut for PortUnion.Ports() 2024-11-05 00:51:14 +09:00
Haruue
d65997c02b
fix: inf loop in PortUnion.Ports() when end=65535
fix: #1240

Any uint16 value is less than or equal to 65535.
2024-11-05 00:47:02 +09:00
Toby
78598bfd1b
Merge pull request #1229 from apernet/wip-share
feat: share subcommand
2024-10-19 11:43:55 -07:00
Toby
4567713ed8
Merge pull request #1228 from apernet/wip-masq-proxy-url-scheme
fix: check the URL scheme of `masquerade.proxy.url` in server config
2024-10-19 09:49:32 -07:00
Haruue Icymoon (usamimi-wsl)
99e959f8c9 feat: share subcommand
Useful for third-party scripts/clients that just want to generate the
sharing URI without starting the client.
2024-10-19 17:24:52 +08:00
Haruue Icymoon (usamimi-wsl)
af2d75d1d0 fix: check masq url scheme in server cfg parsing
Check the url scheme of masquerade.proxy.url when parsing server config
and fail fast if it is not "http" or "https".

ref: #1227

The user assigned the URL with a naked hostname and got errors until the
request was handled.
2024-10-19 16:27:16 +08:00
Toby
b960beabbd
Merge pull request #1216 from apernet/bump-quic
feat: quic-go v0.47.0
2024-10-04 22:33:56 -07:00
Toby
ecc95fb973
Merge pull request #1206 from apernet/fix-quic-sniff
fix: quic sniff not work if udp msg fragmentated
2024-10-04 19:33:00 -07:00
Haruue
1001b2b1ad
chore: fix comments 2024-10-05 10:23:43 +08:00
Toby
ef6da94927 feat: quic-go v0.47.0 2024-10-04 11:21:30 -07:00
Toby
b3116c6268 feat: update TestUDPSessionManager to cover the fragmented msg hook 2024-10-04 10:47:41 -07:00
Toby
947701897b fix: TestClientServerHookUDP 2024-10-04 10:29:25 -07:00
Haruue
4e2f138008
chore: fix comments 2024-10-04 16:57:32 +08:00
Haruue
dc023ae13a
fix: udpSessionManager.mutex reentrant by cleanup 2024-10-04 16:33:41 +08:00
Haruue
931fc2fdb2
chore: replace guard routine with CloseWithErr() 2024-10-04 11:27:36 +08:00
Haruue
4ecbd57294
fix: quic sniff not work if udp msg fragmentated 2024-09-22 22:53:47 +08:00
Toby
21ea2a024a
Merge pull request #1191 from apernet/wip-sni-guard
feat: local cert loader & sni guard
2024-08-25 10:30:17 -07:00
Haruue
d4b9c5a822
test: add requirements.txt for ut scripts 2024-08-25 13:36:45 +08:00
Toby
4ed3f21d72 fix: crash when the tls option is not used & change from python3 to python 2024-08-24 17:07:45 -07:00
Haruue
667b08ec3e
test: add tests for certloader 2024-08-24 17:31:52 +08:00
Haruue
bcf830c29a
chore: only init cert.Leaf when not populated
since Go 1.23, cert.Leaf will be populated after loaded.

see doc of tls.LoadX509KeyPair for details
2024-08-24 13:46:25 +08:00
Haruue
45893b5d1e
test: update server_test for sniGuard 2024-08-24 13:40:42 +08:00
Haruue
57a48a674b
chore: replace rwlock with atomic pointer 2024-08-24 10:37:08 +08:00
Haruue
fd2d20a46a
feat: local cert loader & sni guard 2024-08-24 00:27:57 +08:00
Haruue
903666f18e
Merge pull request #1188 from apernet/fix-scripts-selinux-detect
fix(scripts): detect selinux with getenforce
2024-08-21 18:27:25 +08:00
Haruue
00df1cab0f
fix(scripts): detect selinux with getenforce
chcon is widely available in coreutils, even if the system doesn't
support selinux.
2024-08-21 18:18:41 +08:00
Toby
4c04660684
Merge pull request #1184 from apernet/bump-quic
feat: quic-go v0.46.0
2024-08-16 21:06:49 -07:00
Toby
f2712aac93
Merge pull request #1183 from apernet/fix-http-sniff
fix: sniffing handled HTTP host header incorrectly
2024-08-16 20:52:08 -07:00
Toby
55c3a064cc fix: never overwrite the port 2024-08-16 20:48:14 -07:00
Toby
7e70547dbd feat: quic-go v0.46.0 2024-08-16 16:16:05 -07:00
Toby
f014c00546 fix: add a test case 2024-08-16 15:51:42 -07:00
Toby
48bf9b964a fix: sniffing handled HTTP host header incorrectly 2024-08-16 15:46:30 -07:00
Toby
442ee3898c
Merge pull request #1176 from apernet/fix-test-reqhook
fix(test): signature mismatch of udpIO.Hook
2024-08-04 15:05:05 -07:00
Toby
d527ff13b5
Merge pull request #1175 from apernet/bump-quic
feat: quic-go v0.45.2
2024-08-04 10:10:05 -07:00
Haruue
604132f8d0
fix(test): signature mismatch of udpIO.Hook
ref: #1125
2024-08-04 14:38:36 +08:00
Toby
c62c8c5513 feat: quic-go v0.45.2 2024-08-03 13:14:34 -07:00
Toby
b563f3981f
Merge pull request #1144 from yiguous/patch-1
fix escaped auth
2024-07-10 13:16:43 -07:00
yiguous
a7ecd08046
fix escaped auth 2024-07-05 18:34:54 +08:00
Toby
458ee1386c
Merge pull request #1141 from apernet/bump-quic
feat: quic-go v0.45.1
2024-07-02 15:25:52 -07:00
Toby
8d9c7fa04c feat: quic-go v0.45.1 2024-07-02 15:24:48 -07:00
Toby
0ce3df4396
Merge pull request #1134 from apernet/wip-sniff
feat: server-side sniffing for HTTP/TLS/QUIC
2024-06-30 21:16:23 -07:00
Toby
5315b60610
Merge pull request #1136 from apernet/wip-speedtest-grace
feat: graceful speed test shutdown
2024-06-30 20:50:06 -07:00
Toby
6a90fe18ee feat: graceful speed test shutdown 2024-06-30 20:16:55 -07:00
Toby
deeeafd8d7 feat: allow specifying port ranges for sniffing 2024-06-30 12:04:59 -07:00
Toby
b481b49a28 chore: import format fix 2024-06-29 17:46:04 -07:00
Toby
7b4def4c35 chore: add sniff test cases 2024-06-29 17:42:30 -07:00
Toby
3412368d20 feat: app sniff options 2024-06-29 16:27:57 -07:00
Toby
16bfdc7720 feat: QUIC sniffing 2024-06-29 15:52:56 -07:00
Toby
8aab735029 feat: experimental HTTP/TLS sniffing implementation (no QUIC yet) 2024-06-29 13:40:52 -07:00
Toby
988b86ae55
Merge pull request #1125 from apernet/wip-reqhook
feat(core): server RequestHook support
2024-06-18 22:00:06 -07:00
Toby
c78dbb38a1 feat: add a Check method to let the implementation decide whether to hook a request 2024-06-18 21:46:25 -07:00
Toby
2c62a1a1b4 fix: do not require client-side fast open 2024-06-16 13:26:02 -07:00
Toby
506d8e01b8 Merge branch 'master' into wip-reqhook 2024-06-16 13:10:23 -07:00
Toby
c5e7aa3f02
Merge pull request #1126 from apernet/wip-fix-formatspeed
fix: incorrect speed conversion base
2024-06-15 19:36:58 -07:00
Toby
a852febc1f fix: incorrect speed conversion base 2024-06-15 15:42:39 -07:00
Toby
feacb1f85e feat(core): server RequestHook support 2024-06-15 14:15:56 -07:00
Toby
4c2a905892
Merge pull request #1102 from mritd/master
feat(acme): add acme dns-01 challenge support
2024-06-11 13:07:23 -07:00
Toby
d318903783 chore: go mod tidy 2024-06-10 16:30:22 -07:00
Toby
18d075cc07 feat: rework acme config format 2024-06-10 16:28:21 -07:00
Toby
bc0e18980b Merge branch 'master' into acme2 2024-06-10 15:20:57 -07:00
Toby
52c8f82c2b
Merge pull request #1110 from apernet/fix-http-connect-header
fix(client/http): ffmpeg not works with proxy
2024-05-30 12:04:01 -07:00
Haruue
23b79688fb
chore(client/http): rm "Connection: close" header
Magic of undocumented features.
2024-05-30 23:15:13 +08:00
Haruue
e1ac7c88ab
fix(client/http): ffmpeg not works with proxy
Go's resp.Write() adds a "Content-Length: 0" header and it seems that
ffmpeg doesn't like this and immediately closes the proxy connection.

close: #1109
2024-05-30 22:55:39 +08:00
Toby
492145c124
Merge pull request #1105 from apernet/wip-rbq
fix: BBR stuck in STARTUP phase due to incorrect app-limited logic
2024-05-28 21:54:06 -07:00
Haruue
8fca92a319
Merge pull request #1106 from apernet/fix-hyperbole-cmdpkg
fix(hyperbole): missing v2 in cmdpkg
2024-05-29 11:31:24 +08:00
Haruue
10234e5daf
fix(hyperbole): missing v2 in cmdpkg 2024-05-29 11:28:33 +08:00
kovacs
3c22e5967f
fix(acme): fix config name
fix config name

Signed-off-by: kovacs <mritd@linux.com>
2024-05-27 12:45:50 +08:00
kovacs
3024fc079c
feat(acme): add dns provider
add dns provider

Signed-off-by: kovacs <mritd@linux.com>
2024-05-27 11:43:31 +08:00
Toby
146d077124
Merge pull request #1100 from apernet/fix-systemd-wd-centos7
fix(scripts): WorkingDirectory on CentOS 7
2024-05-25 11:11:05 -07:00
Haruue
9e9b4dbc7d
feat(scripts): change HYSTERIA_USER w/o --force 2024-05-25 17:13:22 +08:00
Haruue
788d04cfdd
fix(scripts): WorkingDirectory on CentOS 7
WorkingDirectory=~ requires systemd v227 or later, which is released on
Oct 2015, only CentOS 7 use an earlier version actually.

ref: systemd/systemd@5f5d8eab1f
2024-05-25 14:27:58 +08:00
Toby
12d4fbae80 Merge branch 'master' into wip-rbq 2024-05-23 18:51:57 -07:00
Toby
44f4ddacfe
Merge pull request #1093 from apernet/wip-bump-quic
feat: quic-go v0.44.0
2024-05-22 18:47:10 -07:00
Toby
adee547c21 feat: quic-go v0.44.0 2024-05-20 15:20:31 -07:00
Toby
09b08fa494 fix: try to fix maybeAppLimited 2 2024-05-20 14:19:04 -07:00
Toby
cd512ce1c6 chore: various tweaks 2024-05-19 11:46:52 -07:00
Toby
5b0ab76d44 Merge branch 'master' into wip-rbq 2024-05-18 15:59:56 -07:00
Toby
396dd0a68c
Merge pull request #1089 from apernet/fix-mod-name
fix: mod name major version suffix v2
2024-05-18 15:59:10 -07:00
Toby
e0e75c4630 wip: BBR experimental changes 2024-05-18 15:01:16 -07:00
Haruue
1742f83b8e
ci: create release tags for core/ and extras/ 2024-05-18 17:14:15 +08:00
Haruue
0c198abd2e
fix: mod name major version suffix v2
ref: https://go.dev/ref/mod#major-version-suffixes
2024-05-18 11:28:47 +08:00
Toby
15e58468a7
Merge pull request #1088 from apernet/wip-shutdown
feat: graceful client shutdown
2024-05-17 19:50:14 -07:00
Toby
b216c4f128 feat: graceful client shutdown 2024-05-17 18:02:58 -07:00
Toby
4c0bd74094
Merge pull request #1087 from apernet/fix-memleak
fix: quic-go memory leak
2024-05-17 17:12:19 -07:00
Toby
2701a6e23f fix: quic-go memory leak 2024-05-17 17:10:59 -07:00
Toby
a3c4cfa4b5
Merge pull request #1075 from HynoR/feat/online
feat: Add getOnline feature
2024-05-11 14:16:32 -07:00
Toby
9d4b3e608a chore: small changes to TrafficLogger function names & update all mocks to mockery v2.43.0 2024-05-11 13:55:55 -07:00
Haruue
6a34a9e7a0
test: fix unit tests
mock files regenerated with mockery v2.43.0
2024-05-11 15:08:44 +08:00
Haruue
ba9b3cdebb
refactor(online): track count instead of raddr 2024-05-11 11:23:20 +08:00
HynoR
88eef7617f refactor getOnline feature 2024-05-09 14:05:45 +08:00
HynoR
2366882bd6 add getOnline feature 2024-05-09 10:10:20 +08:00
HynoR
415ef42b5a add getOnline feature 2024-05-09 09:42:14 +08:00
Toby
c831b987cd
Merge pull request #1067 from apernet/fix-udp
fix: update in quic-go (http3) broke UDP functionality
2024-04-28 20:32:37 -07:00
Toby
b79c43171a fix: update in quic-go (http3) broke UDP functionality 2024-04-28 20:22:11 -07:00
Toby
d2805577ff
Merge pull request #1066 from apernet/ci-go122
ci: update to go 1.22
2024-04-27 21:00:43 -07:00
Toby
8412ec3ab3 ci: update to go 1.22 2024-04-27 21:00:21 -07:00
Toby
59f16d0792
Merge pull request #1064 from apernet/bump-quic-go
feat: quic-go v0.43.0
2024-04-27 20:50:35 -07:00
Toby
00813c4622 feat: quic-go v0.43.0 2024-04-27 13:04:51 -07:00
Haruue
b8b8122ecf
Merge pull request #1062 from apernet/fix-scripts-selinux
fix(scripts): chcon error on CentOS 7
2024-04-26 15:01:02 +08:00
Haruue
e7d7dbbf8f
fix(scripts): chcon error on CentOS 7 2024-04-26 14:52:34 +08:00
Toby
f586d513bc
Merge pull request #1050 from apernet/bump-xnet
chore(deps): bump golang.org/x/net from 0.21.0 to 0.24.0
2024-04-19 14:42:38 -07:00
Toby
c392b0338b chore(deps): bump golang.org/x/net from 0.21.0 to 0.24.0 2024-04-19 14:42:06 -07:00
Toby
3409904294
Merge pull request #1042 from apernet/sync-readme
chore: sync README
2024-04-15 15:06:55 -07:00
Toby
1b78b2ec90 chore: sync README 2024-04-15 15:06:16 -07:00
Toby
bf1cc0847e
Merge pull request #1041 from apernet/fix-cert-check
fix: check if cert-key is loadable on server start
2024-04-15 14:58:32 -07:00
Toby
dc1f58414a chore: improve comments 2024-04-15 14:58:09 -07:00
Toby
2fcbde08d8
Merge pull request #1038 from apernet/wip-pacer
feat: pacer code improvements
2024-04-15 14:47:53 -07:00
Haruue
9752347073
fix: check if cert-key is loadable on server start
close: #1040
2024-04-15 19:31:23 +08:00
Toby
2408301c98 feat: pacer code improvements 2024-04-14 15:07:43 -07:00
Toby
234dc4508b
Merge pull request #1016 from xchacha20-poly1305/dev-android-protect
feat: support Android protect path
2024-04-12 23:32:38 -07:00
Toby
6e00aa3114
Merge pull request #1006 from xmapst/master
实现HTTP/SOCKS5混合端口
2024-04-12 19:36:07 -07:00
Toby
a656a2042d Merge branch 'master' into xmapst 2024-04-12 13:09:17 -07:00
Toby
e1d8901c16 chore: adjust import format 2024-04-12 10:49:56 -07:00
Haruue
8e886b6e05
test(proxymux): reduce wait in the tests 2024-04-12 14:55:17 +08:00
Haruue
044620a5db
chore(proxymux): make subListener dereg immediate
Now you can call ListenHTTP() again immediately after previous closed.
2024-04-12 14:47:12 +08:00
Haruue
6d9c4fd4e5
test(proxymux): add unit test 2024-04-11 23:21:32 +08:00
Haruue
8d9b10a259
fix(proxymux): close of closed channel
when call listener.Close() twice
2024-04-11 23:07:44 +08:00
Haruue
34574e0339
refactor: proxymux
This commit rewrites proxymux package to provide following functions:

+ proxymux.ListenSOCKS(address string)
+ proxymux.ListenHTTP(address string)

both are drop-in replacements for net.Listen("tcp", address)

The above functions can be called with the same address to take
advantage of the mux feature.

Tests are not included, but we will have them very soon.

This commit should be in PR #1006, but I ended up with it in a separate
branch here. Please rebase if you want to merge it.
2024-04-11 21:16:17 +08:00
Toby
d9346f6c24
Merge pull request #1030 from apernet/fix-script-selinux
fix(scripts): set secontext for systemd unit
2024-04-09 12:38:03 -07:00
Haruue
44b36f56ac
fix(scripts): set secontext for systemd unit 2024-04-09 19:58:34 +08:00
Toby
6b5486fc09 feat: add test for sockopts config fields 2024-04-05 16:15:29 -07:00
Haruue
e6da1f348c
fix(sockopts): error handling in applyToUDPConn
it is just no reason to use named err retval here
2024-04-05 13:20:17 +08:00
Haruue
5bebfd5732
fix(sockopts): error handling in applyToUDPConn 2024-04-05 13:17:21 +08:00
HystericalDragon
297d64e48f
chore: format code 2024-04-05 11:26:22 +08:00
Haruue
e1d7ce4640
chore: a better fix for 32-bit unix.Timeval
Why there is no decltype() in Golang?

At least we got generics now.

ref: 9520d84094
2024-04-05 10:49:03 +08:00
HystericalDragon
9520d84094
fix: timeval in different arch
Signed-off-by: HystericalDragon <HystericalDragons@proton.me>
2024-04-05 09:57:45 +08:00
HystericalDragon
13586df2ba
fix: invalid const usage
Signed-off-by: HystericalDragon <HystericalDragons@proton.me>
2024-04-05 08:36:04 +08:00
Haruue
65f5e9caa5
chore: go mod tidy 2024-04-05 02:30:52 +08:00
Haruue
3e34da1aa8
refactor: protect => quic.sockopts
Android's VpnService.protect() itself is confusing, so we rename the
"protect" feature with the name `fdControlUnixSocket` and make it a
sub-option under `quic.sockopts`.

A unit test is added to make sure the protect feature works.

I also added two other common options to `quic.sockopts` that I copied
from my other projects but did not fully test here.
2024-04-05 02:20:45 +08:00
HystericalDragon
a05383c2a1
fix: use reflect to get fd
conn.File() not returns real file.

Signed-off-by: HystericalDragon <HystericalDragons@proton.me>
2024-04-03 18:40:25 +08:00
HystericalDragon
03c8b5e6b9
feat: support Android protect path
about: 1ac9d4956b

Signed-off-by: HystericalDragon <HystericalDragons@proton.me>
2024-04-03 18:09:40 +08:00
Toby
f91efbeded
Merge pull request #1014 from apernet/wip-install-script-apt-update
chore(scripts): run apt update on apt based distro
2024-03-30 16:29:45 -07:00
Haruue
3de65357d4
chore(scripts): run apt update on apt based distro
Running apt update to avoid "package not found" error on some
pre-installed Ubuntu / Debian.

I have tested that other supported Linux distributions do not need this.

dnf/yum/zypper: update metadata regularly by default, and checked when
                installing any package
pacman: run with -Sy so metadata is always updated

cherry-picked from:
apernet/tcp-brutal@efcc08b936
2024-03-30 23:49:57 +08:00
Toby
0f388396a4
Merge pull request #1008 from apernet/update-readme
chore: update README
2024-03-25 18:46:46 -07:00
Toby
2cb0662075 chore: update README 2024-03-25 18:45:28 -07:00
Haruue
d34ff757c3
chore: dos2unix client_test.yaml
NOTE: squash this commit with previous one before merge
2024-03-25 11:06:09 +08:00
xmapst
de7d7dc51e 增强: HTTP/SOCKS5混合端口 2024-03-25 10:17:08 +08:00
xmapst
02fa2cde0a 增强: HTTP/SOCKS5混合端口 2024-03-25 10:15:11 +08:00
Toby
2d4dd66c0e
Merge pull request #1004 from apernet/wip-quic
feat: quic-go v0.42.0
2024-03-23 15:05:56 -07:00
Toby
7aa0becd84 feat: quic-go v0.42.0 2024-03-23 15:05:10 -07:00
Toby
bbf4231091
Merge pull request #1003 from apernet/fix-test
fix: flaky tests caused by occasionally closing channel multiple times
2024-03-23 11:24:19 -07:00
Toby
89a99a08bf fix: flaky tests caused by occasionally closing channel multiple times 2024-03-23 11:17:51 -07:00
Toby
a037880f88
Merge pull request #998 from HynoR/master
degrade the log level adjustment for tcpError and udpError
2024-03-23 10:59:07 -07:00
Toby
2d7d67bf27 feat: also change client side errors to warns 2024-03-23 10:58:11 -07:00
Toby
5eb04bb46d
Merge pull request #1000 from apernet/update-singtun-v025
chore(deps): bump sing-tun from v0.2.4 to v0.2.5
2024-03-23 10:19:37 -07:00
Haruue
9dfb5808e0
chore(deps): bump sing-tun from v0.2.4 to v0.2.5 2024-03-23 21:13:09 +08:00
HynoR
ddb5b511fc Optimize the log level adjustment for tcpError and udpError by shifting from error to warning. 2024-03-23 14:19:50 +08:00
Toby
bdd4114654
Merge pull request #996 from apernet/wip-hy2-tun
Add TUN inbound for client
2024-03-22 22:40:51 -07:00
Haruue
6374ea11c4
feat(tun): allow omit pfxlen in full len pfx route 2024-03-23 11:13:43 +08:00
Toby
aab104ae2e feat: update config test 2024-03-22 16:20:03 -07:00
Toby
dc8fe45a1a chore: adjust imports 2024-03-22 15:50:58 -07:00
Toby
87bbf17bc5 chore: go mod tidy 2024-03-22 13:32:24 -07:00
Haruue
b287020daa
chore(tun): show error on unsupported platform 2024-03-20 22:09:03 +08:00
Haruue
2e93c12cdc
feat(tun): export sing-tun auto route config 2024-03-20 13:45:12 +08:00
Haruue
91406ab0f9
chore(tun): use /126 length in default prefix6 2024-03-19 20:35:42 +08:00
Haruue
92ed8f5e6a
chore(tun): enable ForwarderBindInterface 2024-03-19 19:38:43 +08:00
Haruue
38d9248acd
rm(tun): debug.PrintStack() in logger 2024-03-19 16:56:26 +08:00
Haruue
0cde4f405f
feat(tun): use time.Duration for timeout config
matches timeout config of other inbounds
2024-03-19 15:49:36 +08:00
Haruue
4aec8166b3
chore: switch to apernet sing-tun fork 2024-03-19 15:15:54 +08:00
Haruue
f10805dc13
init: tun support with sing-tun 2024-03-19 02:13:50 +08:00
Toby
804e3f6df9
Merge pull request #987 from mritd/master
feat(acme): support acme listen host
2024-03-17 13:09:52 -07:00
kovacs
57e6e47f19
feat(acme): support acme listen host
support acme listen host

ref #978

Signed-off-by: kovacs <mritd@linux.com>
2024-03-14 11:01:36 +08:00
Toby
5c423d16fe
Merge pull request #986 from apernet/fix-protocol-typo
fix: typo in PROTOCOL.md
2024-03-13 19:40:11 -07:00
Toby
45593c02fc fix: typo in PROTOCOL.md 2024-03-13 19:39:55 -07:00
Toby
caf6c66599
Merge pull request #985 from apernet/bump-protobuf
chore(deps): bump google.golang.org/protobuf from 1.28.1 to 1.33.0
2024-03-13 19:36:56 -07:00
Toby
1f05791a4e chore(deps): bump google.golang.org/protobuf from 1.28.1 to 1.33.0 2024-03-13 19:36:32 -07:00
Toby
55beaff012
Merge pull request #975 from HynoR/master
Support range format ProtoPort
2024-03-12 20:26:56 -07:00
Toby
b07b12a651 chore: trivial fixes 2024-03-12 20:26:13 -07:00
HynoR
b5c1980202 simplify compile_test code 2024-03-13 11:22:18 +08:00
Toby
15b94d5c40 chore: adjust comments 2024-03-12 20:04:06 -07:00
Toby
9a80fe589a fix: format 2024-03-12 19:54:18 -07:00
HynoR
fda93579f0 fix typo 2024-03-13 10:51:36 +08:00
Toby
8b46cc08f0
Merge pull request #974 from apernet/dependabot/github_actions/softprops/action-gh-release-2
chore(deps): bump softprops/action-gh-release from 1 to 2
2024-03-11 21:08:06 -07:00
HynoR
9349f0a1a3 refactor the method that support range format ProtoPort 2024-03-12 11:00:47 +08:00
TAKO
2780dc2766
Merge branch 'apernet:master' into master 2024-03-12 10:17:57 +08:00
Toby
16ec4550c3
Merge pull request #973 from apernet/fix-cwnd-undersize
fix: cwnd undersize in extremely-low rtt scenarios
2024-03-11 14:47:08 -07:00
HynoR
3216814440 remove useless code 2024-03-11 15:54:30 +08:00
HynoR
ee056deaad support range format ProtoPort 2024-03-11 15:35:12 +08:00
dependabot[bot]
78aa85d35c
chore(deps): bump softprops/action-gh-release from 1 to 2
Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release) from 1 to 2.
- [Release notes](https://github.com/softprops/action-gh-release/releases)
- [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md)
- [Commits](https://github.com/softprops/action-gh-release/compare/v1...v2)

---
updated-dependencies:
- dependency-name: softprops/action-gh-release
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-11 06:13:44 +00:00
Haruue
9c51995cc4
fix: cwnd undersize in extremely-low rtt scenarios
Prevent the congestion window from falling below the size of single
packet in scenarios with extremely low RTT, which previously led to
transmission stalls.
2024-03-10 23:06:38 +08:00
Toby
02baab148a
Merge pull request #970 from apernet/wip-speedtest
feat: built-in speed test client & server
2024-03-09 22:29:35 -08:00
Toby
d82d76743f chore: use @ instead of _ for speed test dest 2024-03-09 21:39:30 -08:00
Toby
e99ac076da chore: "server may not support speed test" hint when it's a dial error 2024-03-09 21:25:49 -08:00
Toby
a0bd58063b feat: built-in speed test client & server 2024-03-09 20:38:30 -08:00
Toby
84d72ef0b3
Merge pull request #961 from apernet/wip-freebsd-fix
fix: FreeBSD IPv4-mapped IPv6 listening addr fix
2024-02-29 19:54:05 -08:00
Toby
0c2b0234fa fix: FreeBSD IPv4-mapped IPv6 listening addr fix 2024-02-29 16:38:42 -08:00
Toby
982be5498b
Merge pull request #953 from apernet/wip-udphop-listenudpfunc
feat: allow set ListenUDP impl for udphop conn
2024-02-29 16:17:40 -08:00
Haruue
1ac9d4956b
feat: allow set ListenUDP impl for udphop conn
Third-party clients can use this to set options on created sockets.
e.g. calling VpnService.protect() on Android.
2024-02-27 21:05:53 +08:00
Toby
ea66299d0f
Merge pull request #945 from apernet/fix-geo-dl
fix: fail to load GeoIP or GeoSite if previous download was interrupted by network error
2024-02-21 18:14:15 -08:00
Toby
a531542723
Merge pull request #946 from apernet/wip-obsocks5err
chore: human-readable outbounds socks5 error msg
2024-02-21 11:28:42 -08:00
Haruue Icymoon
842b0ab3f7
feat: load previous download when download fail 2024-02-22 01:41:08 +08:00
Haruue Icymoon
6dea0adb19
feat: re-download geo db when autoDL && load fail 2024-02-21 17:25:42 +08:00
Haruue Icymoon
e22aa0630b
fix: geo db load fail after download error
now geo db are downloaded to a temp file, have a integrity check by a
loading test, and then moved to where it should be.

fix: #944
2024-02-21 17:24:35 +08:00
Haruue Icymoon
f0d59ebee1
chore: human-readable outbounds socks5 error msg
ref: #932
2024-02-03 20:58:35 +08:00
WoaShieShei
bb99579bb9
test: correct TestStringToBps after 6d6a26b (#928) 2024-01-31 19:48:58 -08:00
Toby
80bc3b3a44
Merge pull request #917 from apernet/fix-reconnect
fix: incorrect reconnect logic that causes blocking when dialing connections
2024-01-26 18:56:07 -08:00
Toby
ae402d9d91 chore: code improvements 2024-01-26 13:19:02 -08:00
Toby
84b54eb702 fix: incorrect reconnect logic that causes blocking when dialing connections 2024-01-26 11:49:19 -08:00
Toby
e648321b96 feat: quic-go v0.41.0 2024-01-21 16:58:22 -08:00
Toby
c4993f8dd1 feat: allow runtime TLS cert updates 2023-12-29 15:06:19 -08:00
Toby
f0c7af50a5
Merge pull request #879 from unknowndevQwQ/master
chore(go.sum): thoroughly clean up unneeded fields
2023-12-29 10:34:40 -08:00
Toby
e5ef67ecf9 chore: go mod tidy adds back "github.com/prometheus/client_model" 2023-12-29 10:33:58 -08:00
Toby
f3d675145f
Merge pull request #884 from apernet/fix-lazy
fix: lazy mode should defer config evaluation
2023-12-29 10:24:41 -08:00
Toby
b7dff17fd3 Merge branch 'master' of https://github.com/apernet/hysteria 2023-12-28 15:17:43 -08:00
Toby
4a502b4b5d chore(deps): bump golang.org/x/crypto from 0.14.0 to 0.17.0 2023-12-28 15:17:29 -08:00
Toby
8969bbe25c
Merge pull request #868 from apernet/dependabot/github_actions/actions/upload-artifact-4
chore(deps): bump actions/upload-artifact from 3 to 4
2023-12-28 15:14:43 -08:00
Toby
d73edff71e fix: lazy mode should defer config evaluation 2023-12-28 15:10:21 -08:00
unknowndevQwQ
800ed73069
chore(go.sum): thoroughly clean up unneeded fields
我不清楚这是不是仍旧有用的,因为这些更改可能是 #539 遗落的
2023-12-21 09:36:21 +08:00
dependabot[bot]
6cfef8ce73
chore(deps): bump actions/upload-artifact from 3 to 4
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3 to 4.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-15 06:27:54 +00:00
Toby
405572dc6e
Merge pull request #857 from apernet/dependabot/github_actions/actions/setup-go-5
chore(deps): bump actions/setup-go from 4 to 5
2023-12-08 12:27:14 -08:00
Toby
03a76b2746
Merge pull request #858 from apernet/dependabot/github_actions/actions/setup-python-5
chore(deps): bump actions/setup-python from 4 to 5
2023-12-08 12:26:56 -08:00
dependabot[bot]
a412af48b9
chore(deps): bump actions/setup-python from 4 to 5
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4 to 5.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-07 06:14:43 +00:00
dependabot[bot]
8f787b4b73
chore(deps): bump actions/setup-go from 4 to 5
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 4 to 5.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](https://github.com/actions/setup-go/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-07 06:14:40 +00:00
Toby
21cd348c8b
Merge pull request #842 from apernet/fix-wildcard-listen
fix: ipv{4,6}-only listen on wildcard address
2023-11-26 21:05:58 -08:00
Toby
bb3b83f4de chore: reformat code 2 2023-11-26 20:57:35 -08:00
Haruue Icymoon
9476976950
chore: reformat code 2023-11-27 11:35:15 +08:00
Haruue Icymoon
e70838cd98
fix: ipv{4,6}-only listen on wildcard address
fix: #797

when listening on a wildcard address like "0.0.0.0" or "[::]", hysteria
actually listened on both IPv4 and IPv6. this is a well-known bug of the
golang net package.

this commit introduces a fix for that, the intended behavior will be:

0.0.0.0:443 => listen on IPv4 only
[::]:443    => listen on IPv6 only
:443        => listen on both IPv4 and IPv6
2023-11-26 16:09:01 +08:00
Toby
f48a5edd39
Merge pull request #832 from apernet/wip-suffix-match
feat: domain suffix match
2023-11-22 20:45:05 -08:00
Toby
c341aea5d0 feat: domain suffix match 2023-11-22 20:21:08 -08:00
Toby
4cf253efec fix: broken reconnect logic introduced in c62dc51 2023-11-22 15:59:56 -08:00
Toby
3a77d4756e
Merge pull request #825 from apernet/wip-hsinfo
feat: client handshake info
2023-11-18 21:04:38 -08:00
Toby
faeef50fc0 chore: use local var for info 2023-11-18 21:02:21 -08:00
Toby
ee3a23fb3e
Merge pull request #826 from apernet/wip-fix-bpsconv
fix: bps conv (should be 1000 not 1024)
2023-11-18 20:58:41 -08:00
Toby
6d6a26b399 fix: bps conv (should be 1000 not 1024) 2023-11-18 16:20:07 -08:00
Toby
0a77ce4d64 feat: client handshake info 2023-11-18 16:19:08 -08:00
Toby
cccb9558c0
Merge pull request #815 from apernet/geo-update
feat: geoUpdateInterval
2023-11-15 16:19:42 -08:00
Toby
e052f767db feat: geoUpdateInterval 2023-11-13 20:27:08 -08:00
Toby
c62dc51017 feat: quic-go v0.40.0 2023-11-12 15:42:46 -08:00
Toby
9940ea9dd7
Merge pull request #811 from HynoR/master
Add hysteria listening address logging output when starting up
2023-11-10 18:05:46 -08:00
TAKO
0305037694
Merge branch 'apernet:master' into master 2023-11-11 09:21:28 +08:00
Toby
6872bb0263 improve code 2023-11-10 17:16:34 -08:00
Toby
cb8e6eeb93 feat: add linux/riscv64 build 2023-11-10 16:48:45 -08:00
HynoR
a1bd044467 Improve log output 2023-11-09 16:57:21 +08:00
HynoR
7b68bbf84a Improve log output 2023-11-09 16:43:14 +08:00
Haruue Icymoon
14e3211226
fix(script): version check broken 2023-11-05 16:17:06 +08:00
Toby
a4a2f662bf ci: disable broken NDK local cache 2023-10-29 22:18:06 -07:00
Toby
9ff8020803 feat: traffic stats API secret auth 2023-10-29 21:10:28 -07:00
Toby
a633d3e320 ci: try to fix android builds 2023-10-29 15:49:03 -07:00
Toby
e6cb3df546 feat: quic-go v0.39.3 2023-10-29 15:17:57 -07:00
Toby
b2d4bac556 feat: ACL IDN (punycode domains) support 2023-10-29 14:44:29 -07:00
Toby
affe092336
Merge pull request #782 from apernet/wip-geosite
feat: GeoSite support & reworked GeoIP
2023-10-29 11:41:51 -07:00
Toby
fcc3dd4988 feat: altSvcHijackResponseWriter now optionally implements http.Hijacker to support WebSockets 2023-10-28 14:44:20 -07:00
Toby
e604c12f7e feat: full geoip/geosite support 2023-10-28 13:55:20 -07:00
Toby
bcacc46f1d feat: geoip/geosite load functions 2023-10-26 20:00:31 -07:00
Toby
ef6a231787 feat: add v2ray geoip/geosite protobuf 2023-10-25 19:54:09 -07:00
Toby
ee6ae941f4 ci: fix s3 upload 2 2023-10-19 21:45:16 -07:00
Toby
c72884f30c ci: fix s3 upload 2023-10-19 21:27:25 -07:00
Toby
13c63cdfaf ci: upload releases to download.hysteria.network 2023-10-19 20:07:30 -07:00
Toby
dfa95811e8 feat: quic-go v0.39.1 2023-10-19 19:53:51 -07:00
Toby
f854c38870
Merge pull request #760 from HynoR/master
fix: Fix slice out-of-bounds issues in ParseUDPMessage.
2023-10-19 19:31:37 -07:00
Toby
131306b72b fix: tweak 2023-10-19 19:30:45 -07:00
tako
d513ae115b fix: Fix slice out-of-bounds issues in ParseUDPMessage. 2023-10-20 09:54:41 +08:00
Toby
e57eeb986b feat: disable mousetrap for Windows users 2023-10-12 19:48:26 -07:00
Toby
a6da40df11 chore(deps): bump golang.org/x/net from 0.12.0 to 0.17.0 2023-10-11 22:19:21 -07:00
Toby
6b5c791416
Merge pull request #742 from apernet/http-outbound
feat: HTTP/HTTPS proxy outbound
2023-10-11 22:15:49 -07:00
Toby
ca53344fed
Merge pull request #738 from apernet/masq-string
feat: masquerade string mode
2023-10-11 21:59:32 -07:00
Toby
61a68a18b9 fix: 233 is reserved for Hysteria authentication 2023-10-11 20:42:09 -07:00
Toby
594fde1ff8 feat: HTTP/HTTPS proxy outbound 2023-10-11 19:54:47 -07:00
Toby
197e913dce feat: masquerade string mode 2023-10-11 14:53:46 -07:00
Toby
4ebc765f43 feat: bump quic-go (packets info optimization) 2023-10-10 20:53:27 -07:00
Toby
994cef32ea feat: increase brutal congestion window multiplier to 2 2023-10-10 19:56:17 -07:00
Toby
7c46e845a6 fix: BBR memory leak 2023-10-10 19:54:43 -07:00
Toby
5597b482a9 feat: add RTT to brutal sender debug 2023-10-06 20:26:51 -07:00
Toby
89429598bf fix: BBR bandwidth estimation edge case 2023-10-06 18:27:30 -07:00
Toby
282ec2a0c5
Merge pull request #729 from apernet/brutal-debug
feat: HYSTERIA_BRUTAL_DEBUG
2023-10-05 19:32:57 -07:00
Toby
86c8b3845f feat: HYSTERIA_BRUTAL_DEBUG 2023-10-05 15:38:45 -07:00
Toby
bd03e59a77 fix: quic-go sconn remoteAddr race condition 2023-10-05 14:53:31 -07:00
Toby
f8482a3ddb ci: add race detector flag to hyperbole & fix a race condition in UDPTunnel 2023-10-05 14:22:17 -07:00
Toby
6f1807a376 feat: brutal cc fixes & tweaks 2023-10-05 13:53:59 -07:00
Toby
7ba9fb266f
Merge pull request #718 from apernet/bbr-fix
fix: reworked BBR to replace the broken old one
2023-09-29 22:31:57 -07:00
Toby
922edce1d0
Merge pull request #714 from mritd/master
feat(server): add ZeroSSL EAB
2023-09-29 22:31:28 -07:00
Toby
39518268f0 chore: format 2023-09-29 22:29:23 -07:00
Toby
844e94d6ca fix: reworked BBR to replace the broken old one 2023-09-29 22:18:24 -07:00
kovacs
8a065b1368
feat(server): add ZeroSSL EAB
add ZeroSSL EAB

Signed-off-by: kovacs <mritd@linux.com>
2023-09-27 15:39:03 +08:00
Toby
8faaf3b2e8 feat: quic-go v0.39.0 2023-09-24 15:46:11 -07:00
Toby
fd6bef4c7e feat: bump quic-go (GSO fix 2) 2023-09-21 16:35:35 -07:00
Toby
63dd6e83d8 chore: zh issue templates 2023-09-21 15:48:49 -07:00
Toby
d484849882
chore: issue templates 2023-09-21 15:42:23 -07:00
Haruue Icymoon
7135f04fa2
chore(scripts): use WorkingDirectory=~
as introduced in systemd v227 [1], all modern linux distro should
support this now.

[1]: 5f5d8eab1f
2023-09-16 21:32:50 +08:00
Haruue Icymoon
1173252f62
Revert "feat(scripts): HYSTERIA_ACME_DIR in systemd unit"
This reverts commit f6fecba6c7.

ref: #692

there are still some permission issues due to writing to workdir by default.
2023-09-16 21:13:15 +08:00
Toby
1d0560dd34
Merge pull request #681 from apernet/dependabot/github_actions/docker/login-action-3
chore(deps): bump docker/login-action from 2 to 3
2023-09-15 19:47:59 -07:00
Toby
62f7bb9160
Merge pull request #682 from apernet/dependabot/github_actions/docker/setup-buildx-action-3
chore(deps): bump docker/setup-buildx-action from 2 to 3
2023-09-15 19:47:50 -07:00
Toby
d109d882f6
Merge pull request #683 from apernet/dependabot/github_actions/docker/setup-qemu-action-3
chore(deps): bump docker/setup-qemu-action from 2 to 3
2023-09-15 19:47:37 -07:00
Toby
7972121686
Merge pull request #684 from apernet/dependabot/github_actions/docker/build-push-action-5
chore(deps): bump docker/build-push-action from 4 to 5
2023-09-15 19:47:28 -07:00
Toby
6425098215
Merge pull request #688 from apernet/wip-masq-tcp
feat: HTTP/HTTPS masq servers
2023-09-15 19:47:16 -07:00
Toby
00841504b7 chore: comment fix 2023-09-15 16:42:32 -07:00
Toby
31dca9476d feat: bump quic-go (GSO fix) 2023-09-15 12:57:55 -07:00
Haruue Icymoon
1965535e69
fix: default config file selection
close: #689
2023-09-15 15:48:29 +08:00
Toby
056c46f4d0 feat: HTTP/HTTPS masq servers 2023-09-14 17:27:47 -07:00
Toby
c73570f582
Merge pull request #687 from xishang0128/master
feat: add android build
2023-09-14 15:41:30 -07:00
Toby
5a7dfd8a3b chore: minor tweaks to the android build 2023-09-14 15:40:03 -07:00
xishang0128
a28234a21a feat: add android build 2023-09-14 18:29:09 +08:00
Haruue Icymoon
7ae977866a
feat(scripts): check latest version from hy2 api 2023-09-14 14:51:39 +08:00
dependabot[bot]
1ab983e61f
chore(deps): bump docker/build-push-action from 4 to 5
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 4 to 5.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v4...v5)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-13 06:51:38 +00:00
dependabot[bot]
3ccb0a9ac5
chore(deps): bump docker/setup-qemu-action from 2 to 3
Bumps [docker/setup-qemu-action](https://github.com/docker/setup-qemu-action) from 2 to 3.
- [Release notes](https://github.com/docker/setup-qemu-action/releases)
- [Commits](https://github.com/docker/setup-qemu-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: docker/setup-qemu-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-13 06:51:35 +00:00
dependabot[bot]
55bf6a6d71
chore(deps): bump docker/setup-buildx-action from 2 to 3
Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 2 to 3.
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](https://github.com/docker/setup-buildx-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-13 06:51:33 +00:00
dependabot[bot]
a13b303f65
chore(deps): bump docker/login-action from 2 to 3
Bumps [docker/login-action](https://github.com/docker/login-action) from 2 to 3.
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](https://github.com/docker/login-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: docker/login-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-13 06:51:30 +00:00
Haruue Icymoon
f6fecba6c7
feat(scripts): HYSTERIA_ACME_DIR in systemd unit 2023-09-12 13:21:01 +08:00
Toby
9e9a820b68
Merge pull request #680 from apernet/wip-masq-log
feat: log (debug) masquerade requests
2023-09-11 20:57:14 -07:00
Toby
7580c0c641 feat: log (debug) masquerade requests 2023-09-11 18:20:29 -07:00
Toby
d4afd2f474
Merge pull request #677 from apernet/wip-redirect
feat: TCP redirect mode
2023-09-11 17:58:35 -07:00
Toby
5c72b383ce
Merge pull request #679 from apernet/dependabot/github_actions/actions/checkout-4
chore(deps): bump actions/checkout from 3 to 4
2023-09-11 17:56:41 -07:00
Haruue Icymoon
0fe42d41d6
fix(scripts): bash also uses /proc/self/fd
... instead of /dev/fd for <(...)

ref: https://github.com/apernet/hysteria/issues/678
2023-09-11 14:46:48 +08:00
dependabot[bot]
6d4a843fd2
chore(deps): bump actions/checkout from 3 to 4
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-11 06:25:35 +00:00
Toby
9b8f914eab
Merge pull request #662 from apernet/dependabot/github_actions/actions/checkout-4
chore(deps): bump actions/checkout from 3 to 4
2023-09-10 17:38:57 -07:00
Toby
83a6e5f9a9 feat: TCP redirect mode 2023-09-10 17:32:30 -07:00
Toby
1736e6026e chore: make the app description consistent with everywhere else 2023-09-09 11:33:21 -07:00
Toby
1f1b071ca8 feat: provide HYSTERIA_ACME_DIR to control acme data directory 2023-09-08 18:41:15 -07:00
Toby
1abddbff19 ci: fixes 2 2023-09-06 15:15:10 -07:00
Toby
e177b3563f ci: fixes 2023-09-06 14:55:58 -07:00
Toby
7fe0139016 Merge branch 'master' of https://github.com/apernet/hysteria 2023-09-06 13:51:24 -07:00
Toby
a8640d312f ci: docker image 2023-09-06 13:51:18 -07:00
Toby
296e2ecd23
chore: update donation link 2023-09-06 13:02:33 -07:00
Toby
a2347ad75f fix(script): grammar 2023-09-05 21:29:36 -07:00
Toby
764bb081af chore: add star history to README 2023-09-05 20:53:32 -07:00
Toby
6de749b1f1 ci: give the script publishing ci a name 2023-09-05 20:42:46 -07:00
Haruue Icymoon
5379655798
fix(script): auto sudo when run from stdin 2023-09-06 11:35:24 +08:00
Haruue Icymoon
ec91aa592a
fix: confdir in systemd unit in install_server.sh
caused by 3eeab8a349
2023-09-05 16:23:02 +08:00
dependabot[bot]
f19bf08c35
chore(deps): bump actions/checkout from 3 to 4
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-05 06:42:53 +00:00
Haruue Icymoon
bd2d4c9b8e
chore: rand pass for config in install_server.sh 2023-09-04 23:19:01 +08:00
Haruue Icymoon
3eeab8a349
fix: use homedir as workdir in systemd unit
as default acme storage is $workdir/acme instead of $homedir/.config/...
2023-09-04 22:58:06 +08:00
Haruue Icymoon
099faa93a4
chore: fix version check in install_server.sh 2023-09-04 20:55:34 +08:00
Toby
08372d972c ci: hyperbole should import requests only when needed 2023-09-03 15:09:55 -07:00
Toby
4aafb5e2da scripts: add redirect for cloudflare pages 2023-09-03 11:48:20 -07:00
Toby
dcecc25537 ci: fix publish scripts 2023-09-03 11:44:35 -07:00
Toby
9136a1db19 ci: publish scripts 2023-09-03 11:42:06 -07:00
Haruue Icymoon
c7545cc870
chore: minor update user msg in install_server.sh 2023-09-02 18:52:55 +08:00
Haruue Icymoon
9d361555ef
add: install_server.sh 2023-09-02 15:39:40 +08:00
Toby
e11762a196 feat: quic-go v0.38.1 2023-09-01 19:32:49 -07:00
Toby
f9bab4657c chore: media kit 2023-09-01 18:09:56 -07:00
Toby
299791d7e5 chore: more README tweaks 2023-09-01 18:01:37 -07:00
Toby
fc276ea826 chore: fix README buttons 2023-09-01 17:58:08 -07:00
Toby
dadf6bf0ab chore: update README 2023-09-01 17:51:44 -07:00
Toby
dc7d62f6f8 ci: fix python dep 2023-09-01 17:39:51 -07:00
Toby
d6c5ef2a0a ci: publish to API support 2023-09-01 17:37:11 -07:00
Toby
45b71f2386 ci: tweaks & add new release action 2023-09-01 16:55:55 -07:00
Toby
4cc365d9d2 chore: add license 2023-09-01 13:44:12 -07:00
Toby
ee70476030 fix: udp hop returning bogus close errors 2023-09-01 02:29:05 -07:00
Toby
6bcb00a0cc ci: test subcommand for hyperbole 2023-08-31 15:24:23 -07:00
Toby
81a98e1e5a chore: improve udphop conn 2023-08-31 14:39:10 -07:00
Toby
5efd0f8f44 chore: small tweaks 2023-08-30 20:12:21 -07:00
Toby
3e5eccd6e3 feat: udp port hopping 2023-08-30 20:02:18 -07:00
Toby
1ea7c515ae feat: add side to update checker 2023-08-29 22:16:38 -07:00
Toby
26fdba6049 ci: build all platforms 2023-08-29 20:15:27 -07:00
Toby
353aacfd62 feat: options to disable update check & fix client lazy mode 2023-08-24 14:10:51 -07:00
Toby
09355c4e21 feat: wip update checker 2023-08-23 22:56:15 -07:00
Toby
332d2ea32d chore: move code around 2023-08-23 16:26:38 -07:00
Toby
3c3c2a51a8 feat: client TLS cert SHA256 pinning (pinSHA256) 2023-08-23 15:53:22 -07:00
Toby
b12bd74ac7 feat: quic-go v0.38.0 2023-08-22 14:19:34 -07:00
Toby
e602ec6169 feat: HTTP traffic stats server 2023-08-19 17:19:36 -07:00
Toby
a47285896a fix: ACL IP rules not working for domain requests if resolver not set 2023-08-19 15:31:36 -07:00
Toby
acfb10efc0 feat: SOCKS5 outbound 2023-08-18 16:30:31 -07:00
Toby
c27e6fb8d9 doc: PROTOCOL.md 2023-08-16 21:34:37 -07:00
Toby
f5183ca564 fix: add missing field in test 2023-08-14 19:03:42 -07:00
Toby
a7d74a9ec1 feat: ACL 2023-08-14 19:00:56 -07:00
Toby
6fa958815b feat: TextRule line num 2023-08-14 13:24:23 -07:00
Toby
cd2524c767 feat: WIP ACL 2023-08-13 22:04:21 -07:00
Toby
cab753718d feat: DNS over HTTPS resolver 2023-08-13 13:32:11 -07:00
Toby
b64f0a764c ci: hyperbole arch aliases 2023-08-12 18:00:24 -07:00
Toby
2749f7262d chore: tidy stuff 2023-08-12 13:29:34 -07:00
Toby
25b8eef959 feat: command auth 2023-08-12 13:12:36 -07:00
Toby
d3db1e4a1d feat: HTTP auth 2023-08-11 19:14:07 -07:00
Toby
cbfb1998a5 fix: TProxy UDP error log 2023-08-10 22:15:55 -07:00
Toby
ceb3c7f6a8 feat: TProxy 2023-08-10 22:06:46 -07:00
Toby
4060bcb806 feat: quic-go v0.37.4 & hyperbole tidy 2023-08-09 14:26:59 -07:00
Toby
449d98ac47 feat: quic-go v0.37.3 2023-08-08 19:03:57 -07:00
Toby
cc0d0181e1 feat: ignoreClientBandwidth 2023-08-07 16:34:35 -07:00
Toby
f95a31120d ci: explicitly disable CGO 2023-08-06 19:31:47 -07:00
Toby
7307eea2a8 feat: userpass auth 2023-08-06 12:11:46 -07:00
Toby
601ad6b61c feat: lazy option for client 2023-08-05 17:50:03 -07:00
tobyxdd
2c7db03243 feat: pprof for run command 2023-08-05 15:17:18 -07:00
tobyxdd
531b23baa4 feat: pprof 2023-08-05 12:07:22 -07:00
Toby
3b4af8035b chore: some code fixes 2023-08-04 17:48:07 -07:00
Toby
45c3fc54bd feat: BBR 2023-08-04 17:29:15 -07:00
Toby
02fca02ddc feat: update to quic-go v0.37.2 & enable PMTUD on macOS 2023-08-04 15:34:05 -07:00
Toby
13debaa0ad feat: server outbounds config 2023-08-04 14:53:29 -07:00
Toby
6ad44d183e feat: DNS over TLS resolver 2023-08-04 14:03:23 -07:00
Toby
7c94b072ed feat: server resolver config options 2023-08-04 13:37:19 -07:00
Toby
be76f0650e feat: PluggableOutbound standardResolver 2023-08-01 21:34:45 -07:00
Toby
d10398a11f feat: hyperbole mockgen subcommand 2023-07-31 19:21:41 -07:00
Toby
723612c297 feat: quic-go v0.37.1-mod update 2023-07-31 19:06:49 -07:00
Toby
c64b36b8f4 feat: update to quic-go v0.37.1, module renamed to github.com/apernet/quic-go 2023-07-31 17:27:23 -07:00
Toby
b62ef83206 chore: add udpIdleTimeout to server example 2023-07-31 13:41:31 -07:00
Toby
a59111faad feat: reconnect 2023-07-28 16:09:23 -07:00
Toby
62fddff137 feat: DirectOutbound bind IP 2023-07-28 13:44:33 -07:00
Toby
e381c2eae8 feat: fix outbound 2023-07-27 19:24:43 -07:00
Toby
d4e3833641 feat: rework udp stuff 2023-07-27 18:51:33 -07:00
Toby
fd4d095dcd feat: add UDPIdleTimeout to server config 2023-07-27 14:30:35 -07:00
Toby
fb7e6ed915 feat(wip): test reworks for app 2023-07-27 13:13:07 -07:00
Toby
ddc7fa8456 feat: traffic logger tests 2023-07-26 21:30:48 -07:00
Toby
7a3c23032b fix: TestPluggableOutboundAdapter 2023-07-26 19:20:46 -07:00
Toby
1629f0fc8e feat: add 2 new shutdown tests 2023-07-26 19:12:30 -07:00
Toby
37385f623f feat(wip): more test reworks 2023-07-26 16:35:25 -07:00
Toby
6172f2ac53 feat(wip): test reworks (need to add back traffic logger tests) 2023-07-26 15:51:48 -07:00
Toby
dd836b4496 feat(wip): test reworks 2023-07-26 13:48:08 -07:00
Toby
55fb903192 feat(wip): test reworks 2023-07-25 16:42:37 -07:00
Toby
1c7cb23389 feat(wip): test reworks 2023-07-25 16:11:11 -07:00
Toby
e48bb98024 chore: trivial test fix 2023-07-24 20:43:40 -07:00
Toby
27460960ab feat(wip): udp rework client side tests & server tests update 2023-07-24 20:12:48 -07:00
Toby
f0ad2f77ca chore: code adjustments 2023-07-24 17:08:19 -07:00
Toby
cbedb27f0f feat(wip): udp rework client side 2023-07-24 16:32:25 -07:00
Toby
f142a24047 chore: more naming adjustments 2023-07-23 12:27:27 -07:00
Toby
1f499f07c7 chore: naming adjustments 2023-07-23 12:10:10 -07:00
Toby
a2fbcc6507 feat(wip): udp rework server side 2023-07-23 11:42:52 -07:00
tobyxdd
6245f83262 feat(wip): DirectOutbound bind to device 2023-07-21 17:28:39 -07:00
tobyxdd
b25fb63d5b feat(wip): DirectOutbound (PluggableOutbound) 2023-07-19 17:38:34 -07:00
Toby
20a57e180d feat(wip): PluggableOutbound framework 2023-07-18 15:49:12 -07:00
tobyxdd
07b7f14bef feat: client config URI support 2023-07-14 16:47:10 -07:00
tobyxdd
0dbd6af683 Merge branch 'wip-hy2' of https://github.com/apernet/hysteria into wip-hy2 2023-07-14 15:44:47 -07:00
tobyxdd
6aa60e12d1 chore: move print QR func to utils 2023-07-14 15:44:37 -07:00
Haruue Icymoon
4b2140f589
chore: x-bit & python3 for hyperbole.py
ref: 617

i have no idea why there is still debian 11 with python-is-python2
installed, though.
2023-07-13 19:57:26 +08:00
tobyxdd
e21e5c67a8 feat: rework config handling code & add QR 2023-07-10 19:46:58 -07:00
tobyxdd
4c24edaac1 feat: salamander obfs 2023-07-09 16:37:18 -07:00
tobyxdd
baee5689c1 doc: update README 2023-07-07 13:41:27 -07:00
tobyxdd
1b3a718ac8 feat: add a hysteria prefix to env vars to avoid conflicts 2023-07-07 13:40:05 -07:00
tobyxdd
458382dd3d feat: logging environment variables 2023-07-04 13:06:52 -07:00
tobyxdd
7e177a22f7 feat: port forwarding 2023-07-02 15:40:16 -07:00
tobyxdd
8ca414e548 feat: config parsing tests 2023-07-02 12:11:59 -07:00
tobyxdd
e97a81a8a9 chore: change "validate" to "load" 2023-06-30 17:10:51 -07:00
tobyxdd
eb7e91e5ce feat: rework config parsing to use viper unmarshal 2023-06-30 13:16:01 -07:00
tobyxdd
8342827339 chore: update go.work.sum 2023-06-28 20:09:36 -07:00
tobyxdd
16a2294cd1 ci: add build workflow, other GitHub configs, etc. 2023-06-28 19:23:04 -07:00
tobyxdd
cc8a889503 feat: quic close error code 2023-06-27 22:39:16 -07:00
tobyxdd
1317c599b8 feat: bump quic-go version to v0.36.0 2023-06-26 21:46:27 -07:00
tobyxdd
bacc8ff5ed feat: add a 10 sec timeout to default outbound dialer 2023-06-15 20:02:55 -07:00
tobyxdd
1209aa9e11 chore: remove debug print from http test 2023-06-11 16:37:01 -07:00
tobyxdd
b27628607a fix: socks5 udp domain handling bug & add test case for it 2023-06-11 16:34:45 -07:00
tobyxdd
fefabaf739 fix: mode str 2023-06-10 19:10:01 -07:00
tobyxdd
fcb8965987 feat: client http proxy 2023-06-10 19:08:00 -07:00
tobyxdd
4334d8afb8 feat: traffic logger with disconnect 2023-06-08 20:55:08 -07:00
tobyxdd
5b54edd09a feat: traffic logger (wip, disconnect not done) 2023-06-07 22:37:09 -07:00
tobyxdd
901e0480f2 feat: add socks5 server test 2023-06-05 16:27:06 -07:00
tobyxdd
ea29efc298 fix: various python compatibility issues 2023-06-04 22:13:08 -07:00
tobyxdd
635ad9782a feat: add masquerade options & update README 2023-06-04 14:56:35 -07:00
tobyxdd
cefe5d9f76 feat: hyperbole build script 2023-06-04 12:37:17 -07:00
tobyxdd
393e0d00f2 feat: bump quic-go version to v0.35.1 (mod merge done) 2023-06-02 21:30:07 -07:00
tobyxdd
5586303825 feat: bump quic-go version to v0.35.1 (mod wip), change client config format for sni 2023-06-02 16:51:17 -07:00
tobyxdd
41f10a22c4 fix: use random chars for padding to avoid unwanted header compression 2023-05-31 22:11:52 -07:00
tobyxdd
ebb9b3217e feat: add padding to requests & responses 2023-05-31 21:53:15 -07:00
tobyxdd
9f54aade8f hysteria 2 prototype first public release 2023-05-25 20:24:24 -07:00
tobyxdd
c0ab06e961 feat: update quic-go to v0.34.0 2023-05-07 17:19:37 -07:00
tobyxdd
bab6089f0e ci: trigger 2023-04-30 19:45:57 -07:00
tobyxdd
355a5949e2 ci: try fixing CodeQL 2023-04-30 19:39:40 -07:00
tobyxdd
8f310fb798 ci: bump everything to go 1.20 2023-04-30 19:27:26 -07:00
Haruue Icymoon
cbc29ea4e5
ci: fix yaml 2023-05-01 10:01:37 +08:00
Haruue Icymoon
12b27ea1b1
ci: bump go1.20 2023-05-01 09:55:49 +08:00
Haruue Icymoon
17c35f11f8
chore: bump gvisor & tun2socks 2023-04-29 14:50:58 +08:00
Toby
ca07cf6f18
Merge pull request #586 from apernet/dependabot/github_actions/actions/setup-go-4
chore(deps): bump actions/setup-go from 3 to 4
2023-03-17 16:21:10 -07:00
dependabot[bot]
e6b0f0b76d
chore(deps): bump actions/setup-go from 3 to 4
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 3 to 4.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](https://github.com/actions/setup-go/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-16 07:04:05 +00:00
tobyxdd
b94f8a1eaf docs: 1.3.4 changelog 2023-03-14 19:47:58 -07:00
Haruue Icymoon
779e962d49
fix(redirect_tcp): client got reset under i386
it seems like syscall.Syscall6(SYS_SOCKETCALL, SYS_GETSOCKOPT, ...)
always failed with EFAULT.

so we call syscall.socketcall() instead.

close: #583
2023-03-15 00:21:27 +08:00
tobyxdd
1b3b038728 chore: bump gvisor 2023-03-13 14:18:26 -07:00
tobyxdd
fb2a0da88f feat: update quic-go to v0.33.0, fix go work dependency conflicts 2023-02-26 12:45:43 -08:00
Toby
12cff70aac
Merge pull request #566 from yinyue200/removeUnusedDnsLookup
Remove unnecessary DNS queries in case of SOCKS5 outbound
2023-02-19 12:32:03 -08:00
tobyxdd
8c99fe3754 chore: bump golang.org/x/* versions 2023-02-18 21:08:09 -08:00
Toby
13d46da998
Merge pull request #572 from shadow750d6/master
Add `lazy_start` option.
2023-02-18 20:42:40 -08:00
tobyxdd
20898f2990 chore: change info string 2023-02-18 20:01:01 -08:00
Siyuan Ren
604d4fc652 Add lazy_start option.
When on, the client will not attempt to connect to the server at
startup, only when a connection is initiated.
2023-02-19 11:18:56 +08:00
tobyxdd
1d9fa029c2 fix: set serverAddrs to nil when closing an ObfsUDPHopClientPacketConn to prevent memory leaks 2023-02-14 21:30:45 -08:00
yinyue200
23f1546591 Remove unnecessary DNS queries in case of SOCKS5 outbound 2023-02-13 00:03:03 +08:00
tobyxdd
a48d6ddb7c docs: 1.3.3 changelog 2023-02-07 22:11:37 -08:00
Haruue Icymoon
30e17a40c0
fix: slices mis-reused in socks5UDPConn.ReadFrom
fix: #561
2023-02-07 23:47:11 +08:00
Haruue Icymoon
810bfd7022
fix: ipv4 addr convention in socks5_outbound
fix: #561
2023-02-07 23:30:23 +08:00
Haruue Icymoon
b4dfbaa3f2
fix: udp assoc req malformed in socks5_outbound
fix: #561
2023-02-07 16:45:13 +08:00
tobyxdd
a7c159eeb3 chore: remove routedns replace since upstream merged our PR 2023-02-05 15:21:12 -08:00
Toby
da574f6654
Merge pull request #553 from apernet/dependabot/github_actions/docker/build-push-action-4.0.0
chore(deps): bump docker/build-push-action from 3.3.0 to 4.0.0
2023-02-04 14:07:24 -08:00
tobyxdd
cb4daac18d feat: update quic-go to v0.32.0, fix dependencies 2023-02-01 23:23:12 -08:00
dependabot[bot]
2f1b266a52
chore(deps): bump docker/build-push-action from 3.3.0 to 4.0.0
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 3.3.0 to 4.0.0.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v3.3.0...v4.0.0)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-31 06:08:50 +00:00
Toby
8a1f4e4c04
Merge pull request #548 from apernet/dependabot/github_actions/docker/build-push-action-3.3.0
chore(deps): bump docker/build-push-action from 3.2.0 to 3.3.0
2023-01-24 19:47:06 -08:00
dependabot[bot]
f0cfbb2653
chore(deps): bump docker/build-push-action from 3.2.0 to 3.3.0
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 3.2.0 to 3.3.0.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v3.2.0...v3.3.0)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-16 06:17:20 +00:00
Toby
3e1d2a8c92
Merge pull request #547 from apernet/wip-exclusive-acme-cert
feat: make acme and cert options mutually exclusive to avoid user confusion
2023-01-15 19:36:42 -08:00
tobyxdd
517c5a4bc4 feat: make acme and cert options mutually exclusive to avoid user confusion 2023-01-15 12:14:21 -08:00
Toby
02e987e639
Merge pull request #539 from apernet/wip-traffic-counter
feat: provide a TrafficCounter interface on server, remove prometheus client dependency from core
2023-01-07 22:32:14 -08:00
tobyxdd
f7dffd027f feat: provide a TrafficCounter interface on server, remove prometheus client dependency from core 2023-01-07 13:59:30 -08:00
Haruue Icymoon
29459d768d
chore: set default value of retry_interval to 1
the prior default value 0 would make hysteria retry very fast
(2000 times / sec) when network is not ready (no default route).

user can still set it to 0 explicitly for a "flood retry" mode.
2022-12-28 23:00:38 +08:00
Haruue Icymoon
a5647379b1
Revert "feat(install_server.sh): auto detect amd64-avx"
some vps have avx in their /proc/cpuinfo but actually not support it

This reverts commit f203ab901e.
2022-12-12 13:28:22 +08:00
mritd
042f42b655
Merge pull request #531 from mritd/master
chore(go-task): supported amd64-v* & s390x
2022-12-12 12:19:58 +08:00
kovacs
568c905344 chore(go-task): supported amd64-v* && s390x
supported amd64-v* && s390x

Signed-off-by: kovacs <mritd@linux.com>
2022-12-12 12:10:08 +08:00
Haruue Icymoon
6e3a3f5388
feat(install_server.sh): customized hysteria user
it seems like some linux newbies might try to manage the cert & key by
themselves or thirdparty software (such as caddy), and complain about
hysteria start failure due to permission denied.

and it is actually really pretty hard to teach them how to edit systemd
units, or place their certs & key files into a suitable directory and
set proper permission.

which this commit, we can easily tell them just re-run the install
script with the following command:

HYSTERIA_USER=root ./install_server.sh -f

this script can also detect the correct user from the installed systemd
units, so it still works properly even if the user forgets to specify
HYSTERIA_USER= in the subsequent runs.
2022-12-11 23:27:08 +08:00
Haruue Icymoon
f203ab901e
feat(install_server.sh): auto detect amd64-avx 2022-12-11 22:04:53 +08:00
tobyxdd
dd4c17972f ci: fix build scripts to handle multi-tags 2022-12-10 18:14:17 -08:00
tobyxdd
7430f37b21 docs: 1.3.2 changelog 2022-12-10 17:07:02 -08:00
tobyxdd
14043d9b50 ci: limit release actions to run on master/main/release branches only 2022-12-10 16:53:55 -08:00
tobyxdd
9cec566384 ci: add windows/arm64 2022-12-10 16:46:26 -08:00
tobyxdd
f90dd47811 ci: add amd64-avx, armv5 & mipsle-sf builds 2022-12-10 16:03:24 -08:00
Toby
4c8871070c
Merge pull request #530 from apernet/wip-build-script
ci: update build scripts to handle microarchitectures
2022-12-10 00:40:30 -08:00
Haruue Icymoon
432a29ff9a
refactor: build.sh
+ fix command exit status check under set -e
+ fix crashes when $HY_APP_PLATFORMS contains invalid values
+ fix final binary size report error under UTF-8 locales
+ reduce global variables
2022-12-10 12:38:17 +08:00
tobyxdd
455f36734c ci: update build scripts to handle microarchitectures 2022-12-09 13:44:35 -08:00
tobyxdd
e832b4896e ci: release tagging script 2022-12-09 11:11:38 -08:00
mritd
a95dcf0e39
Merge pull request #529 from mritd/master
chore(go-task): support freebsd & windows build
2022-12-09 18:03:30 +08:00
Haruue Icymoon
e6cb3507ca
ci: disable build-master on nested module tags 2022-12-09 17:52:29 +08:00
kovacs
01c3eef825 chore(go-task): fix windows build, update amd64 v4
fix windows build, update amd64 v4

Signed-off-by: kovacs <mritd@linux.com>
2022-12-09 14:37:53 +08:00
kovacs
067f3b5c6c chore(go-task): support freebsd、windows build
support freebsd、windows build

Signed-off-by: kovacs <mritd@linux.com>
2022-12-09 14:20:48 +08:00
Toby
cceba2ab79
Merge pull request #525 from apernet/fix-frag
fix: handle the case where MsgID == 0
2022-12-08 18:09:51 -08:00
Toby
c29eba1416 fix: handle the case where MsgID == 0 2022-12-08 19:43:59 +00:00
Toby
392cde1120 chore: fix typo (ErrMessageToLarge -> ErrMessageTooLarge) 2022-12-07 17:35:34 -08:00
Toby
fc28c01980 fix(RPT-03-003): add socket dial timeouts to SOCKS5Client 2022-11-30 23:10:30 -08:00
Haruue Icymoon
fcc2f06bc1
Merge branch 'wip-refactor-install-server-script'
Rewrite install_server.sh

close: #517
2022-11-29 12:50:30 +08:00
Haruue Icymoon
986c163040
feat(install_server.sh): version number format
validate user specified version number format should begin with 'v'
2022-11-29 12:37:38 +08:00
Haruue Icymoon
dbe9f3414c
fix(install_server.sh): centos 7 supports
there is no systemd-sysusers on centos 7, and
its bash does not support $(("1" - "2"))
2022-11-28 15:15:34 +08:00
Haruue Icymoon
608810ceac
fix(install_server.sh): systemd unit desc 2022-11-28 13:36:26 +08:00
Haruue Icymoon
173d3a5a1d
fix(install_server.sh): sudo with $@ 2022-11-28 13:22:39 +08:00
Haruue Icymoon
e2cc0dff48
fix(install_server.sh): curl missing -f 2022-11-28 12:15:35 +08:00
Haruue Icymoon
960a380521
fix(install_server.sh): userdel missing -r 2022-11-28 12:11:16 +08:00
Haruue Icymoon
249af28506
chore(install_server.sh): minor code fix
rm a redundant assign
2022-11-28 02:39:19 +08:00
Haruue Icymoon
2e6cb1c838
refactor: install_server.sh
rewrite this script entirely, and solve all historical issues.

close: #513
close: #514
2022-11-28 02:06:16 +08:00
Toby
7a7fda67f2 docs: 1.3.1 changelog 2022-11-26 00:51:58 -08:00
Toby
2d8425e736 chore: bump quic-go (merged opt-fs changes) 2022-11-26 00:31:57 -08:00
Toby
59b15f8313
Merge pull request #508 from apernet/wip-reorg-pkgs
refactor: re-org packages
2022-11-24 23:54:49 -08:00
Toby
7163b8ce9b
Merge pull request #509 from mritd/master
chore(docker): Compatible with nerdctl build
2022-11-24 23:54:37 -08:00
kovacs
80779d76c0 chore(docker): Compatible with nerdctl build
Compatible with nerdctl build

Signed-off-by: kovacs <mritd@linux.com>
2022-11-25 14:41:20 +08:00
Toby
73df9973d0 fix: Taskfile build path 2022-11-24 11:40:03 -08:00
Haruue Icymoon
ed14540d26
chore: split go modules & create go workspace 2022-11-24 17:14:21 +08:00
Toby
3184c42956 refactor: re-org packages 2022-11-24 00:22:44 -08:00
Toby
e338ed60cb
Merge pull request #507 from apernet/wip-fastopen
feat: fast open
2022-11-23 23:47:31 -08:00
Toby
745d84e3c7 fix: bug in goproxy that caused connections to not disconnect 2022-11-23 21:23:22 -08:00
Toby
80faa4aaf8 feat: fast open 2022-11-23 21:19:52 +00:00
Toby
536fa24595 chore: allow nil quicReconnectFunc 2022-11-23 20:41:32 +00:00
Haruue Icymoon
7481a859b6
fix(tun): udp not work when timeout not specified 2022-11-23 23:32:47 +08:00
Toby
9eb0ea4367 chore: add explaination comment to pmtud flag 2022-11-23 00:15:17 -08:00
Toby
26d557a6c4 fix: incorrect udp addr in check.py 2022-11-22 20:48:15 +00:00
Toby
bef694727d chore: new socks5 script to combine both tcp & udp checks 2022-11-22 20:06:55 +00:00
Toby
423c551306 chore: bump goproxy version & fix http proxy basic auth realm 2022-11-22 19:49:47 +00:00
Toby
21f4fa7d86 chore: disable certmagic's noisy default logger 2022-11-19 17:58:14 -08:00
Toby
6c6a804736 perf: set buffers support for udp hop conns 2022-11-19 16:13:13 -08:00
Toby
00ec7e5ad9 chore: move pktconns out of transport pkg 2022-11-19 13:48:57 -08:00
Toby
cdbfa0fca2 chore: minor code adjustments 2022-11-19 13:34:40 -08:00
Toby
a2bc061e74 chore: upgrade to hashicorp/golang-lru v2 (closes #500) 2022-11-19 13:01:15 -08:00
Toby
b386bfbeef feat: update quic-go to v0.31.0 2022-11-19 00:35:46 -08:00
Toby
c7a87b2c43 perf: adjust default receive window sizes 2022-11-18 19:59:19 -08:00
Toby
589f4a8256 chore: use nowpayments donation link 2022-11-18 18:04:24 -08:00
Toby
7ce4bf7dbe chore: update module name 2022-11-16 22:57:35 -08:00
Toby
4a0b66e9b3 chore: add AperNet logo to README 2022-11-16 17:22:33 -08:00
Toby
fa7b90b041
Merge pull request #492 from HyNetwork/dependabot/go_modules/github.com/prometheus/client_golang-1.14.0
chore(deps): bump github.com/prometheus/client_golang from 1.13.1 to 1.14.0
2022-11-16 10:34:20 -08:00
Toby
466cc35d90 fix: accidental removal of golang-lru from go.mod 2022-11-15 21:19:39 +00:00
Toby
18b46566ca
Merge pull request #495 from HyNetwork/dependabot/go_modules/github.com/hashicorp/golang-lru-1.0.0
chore(deps): bump github.com/hashicorp/golang-lru from 0.5.4 to 1.0.0
2022-11-14 23:51:47 -08:00
dependabot[bot]
4a272ba704
chore(deps): bump github.com/hashicorp/golang-lru from 0.5.4 to 1.0.0
Bumps [github.com/hashicorp/golang-lru](https://github.com/hashicorp/golang-lru) from 0.5.4 to 1.0.0.
- [Release notes](https://github.com/hashicorp/golang-lru/releases)
- [Commits](https://github.com/hashicorp/golang-lru/compare/v0.5.4...v1.0.0)

---
updated-dependencies:
- dependency-name: github.com/hashicorp/golang-lru
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-15 06:02:44 +00:00
dependabot[bot]
099750df05
chore(deps): bump github.com/prometheus/client_golang
Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.13.1 to 1.14.0.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.13.1...v1.14.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-09 06:02:18 +00:00
Toby
55cdd20345
Merge pull request #489 from HyNetwork/dependabot/go_modules/github.com/spf13/viper-1.14.0
chore(deps): bump github.com/spf13/viper from 1.13.0 to 1.14.0
2022-11-08 15:55:19 -08:00
dependabot[bot]
c2bc6a224d
chore(deps): bump github.com/spf13/viper from 1.13.0 to 1.14.0
Bumps [github.com/spf13/viper](https://github.com/spf13/viper) from 1.13.0 to 1.14.0.
- [Release notes](https://github.com/spf13/viper/releases)
- [Commits](https://github.com/spf13/viper/compare/v1.13.0...v1.14.0)

---
updated-dependencies:
- dependency-name: github.com/spf13/viper
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-08 06:04:43 +00:00
Toby
385c2d6845 docs: 1.3.0 changelog 2022-11-07 20:54:23 -08:00
Toby
9ece6c89e9 Merge branch 'wip-udp-hop' 2022-11-07 20:41:12 -08:00
Toby
31a569cd66 Merge branch 'master' of https://github.com/HyNetwork/hysteria 2022-11-06 22:01:53 -08:00
Toby
052380d65a ci: disable cgo in build scripts 2022-11-06 22:01:44 -08:00
Toby
a5bca3bf38
Merge pull request #488 from mritd/master
chore(ci): fix docker build failed
2022-11-06 21:47:15 -08:00
kovacs
00d1520e44 chore(ci): fix docker build failed
fix docker build failed

Signed-off-by: kovacs <mritd@linux.com>
2022-11-07 13:42:25 +08:00
Toby
20de0ca335 fix: quic-go ipv6 server name handling 2022-11-05 11:11:25 -07:00
Toby
fbe0cf4156 chore: larger text for doc links 2022-11-04 16:15:44 -07:00
Toby
0cf7d90f7b
Create FUNDING.yml 2022-11-04 16:08:16 -07:00
Toby
ff399e98fe docs: update doc URLs 2022-11-04 15:51:45 -07:00
Toby
d72866d61e chore: remove logging in udp hop, remove WriteTo addr check 2022-11-04 13:37:08 -07:00
Toby
325869bdb5 feat: add hop interval to client config, default 10s 2022-11-04 13:27:49 -07:00
Toby
2e80334841 feat: rework multiport address format to support ranges, drop server support (use iptables DNAT instead) 2022-11-04 11:47:24 -07:00
Toby
263ac8d313 Merge branch 'master' into wip-udp-hop 2022-11-04 10:38:19 -07:00
Toby
508ff69ea9 feat: better version handling for update check 2022-11-03 19:50:42 +00:00
Toby
a7675b2f5b
Merge pull request #482 from HyNetwork/dependabot/go_modules/github.com/prometheus/client_golang-1.13.1
chore(deps): bump github.com/prometheus/client_golang from 1.13.0 to 1.13.1
2022-11-03 10:36:20 -07:00
Toby
e329e8a2e9 feat: remove separate udp-hop protocol, auto detect by address format 2022-11-02 23:55:07 -07:00
dependabot[bot]
0ea0978906
chore(deps): bump github.com/prometheus/client_golang
Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.13.0 to 1.13.1.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/v1.13.1/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.13.0...v1.13.1)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-03 06:02:25 +00:00
Toby
a5985c5b6f chore: reduce udp buffer sizes to 4k & pipe buffer size to 32k 2022-11-02 22:47:38 -07:00
Toby
0119024392 chore: move common stuff to common.go 2022-11-02 21:23:16 -07:00
Toby
6ac5e0e455 Merge branch 'master' into wip-udp-hop 2022-11-02 19:40:14 -07:00
Toby
1c7880e2f6
Merge pull request #481 from HyNetwork/wip-config-rework
refactor: fill default values directly to configs
2022-11-02 18:20:32 -07:00
Toby
10282e0ffd ci: use our own build script 2022-11-02 18:00:37 -07:00
Toby
4a08e5226b feat: build scripts auto get app version & commit from git 2022-11-02 23:45:01 +00:00
Toby
904a197af9 feat: improve build scripts 2022-11-02 23:33:30 +00:00
Toby
7cc5e9e41a chore: windows build script 2022-11-02 20:08:04 +00:00
Toby
17ba89ea03 chore: linux build script 2022-11-02 19:29:50 +00:00
Toby
4f14601896 fix: prevent client double close 2022-11-02 19:10:03 +00:00
Toby
555c71e61a chore: fix error msg inconsistency 2022-11-02 18:44:38 +00:00
Toby
2e84ca6ebe refactor: fill default values directly to configs 2022-11-02 18:23:54 +00:00
Toby
a3f53e9761 fix: update addrMap even when queue is full 2022-11-01 22:00:52 -07:00
Toby
f0f900c2dc chore: minor code adjustments 2022-11-01 16:42:45 -07:00
Toby
a4da230517 wip feat: experimental udp port hopping support 2022-11-01 16:09:38 -07:00
Toby
21b2830289 feat: dynamic client IP for server logs (connection migration) 2022-10-31 17:03:14 -07:00
Toby
72b9ddcfa4 feat: update quic-go (connection migration) 2022-10-30 23:28:14 -07:00
Toby
fbcfc7dfc2
Update README.md 2022-10-27 20:50:35 -07:00
Toby
e187be50de
Update README.md 2022-10-27 20:48:09 -07:00
Toby
ee1fd45030
Merge pull request #473 from HyNetwork/dependabot/go_modules/github.com/spf13/cobra-1.6.1
chore(deps): bump github.com/spf13/cobra from 1.6.0 to 1.6.1
2022-10-25 10:47:53 -07:00
Haruue Icymoon (usamimi-wsl)
0e55506002 chore(deps): bump go-tproxy
fix initialize failed on non-IPv6 kernel
close: #472
2022-10-26 00:41:41 +09:00
dependabot[bot]
58912ce169
chore(deps): bump github.com/spf13/cobra from 1.6.0 to 1.6.1
Bumps [github.com/spf13/cobra](https://github.com/spf13/cobra) from 1.6.0 to 1.6.1.
- [Release notes](https://github.com/spf13/cobra/releases)
- [Commits](https://github.com/spf13/cobra/compare/v1.6.0...v1.6.1)

---
updated-dependencies:
- dependency-name: github.com/spf13/cobra
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-25 06:17:34 +00:00
Toby
8b0a157e0b chore: hy client should not force UDP addr for quic Dial 2022-10-24 22:47:12 -07:00
Toby
3d54cb43af chore: update CHANGELOG for 1.2.2 2022-10-23 16:54:45 -07:00
Toby
f92c2cdda7 fix: nil TLSConfig for DoTClientOptions 2022-10-23 16:50:39 -07:00
Toby
919fbb7152 chore: rename wrappedQUICStream -> qStream 2022-10-23 16:31:30 -07:00
Toby
b247919a03 chore: renames (HyTCPConn, HyUDPConn) 2022-10-23 16:19:57 -07:00
Toby
d9d80ecbb1 chore: move auth funcs to a separate file 2022-10-23 16:00:45 -07:00
Toby
9e521a7615 chore: use just smoothed RTT in brutal CC 2022-10-23 15:32:20 -07:00
Toby
cf970f09e4 chore: various renames, server packet conn adjustment 2022-10-23 11:07:54 -07:00
Toby
83764ba9de chore: renames 2022-10-23 10:10:04 -07:00
Toby
ce86fd918a feat: update quic-go to v0.30.0 2022-10-22 23:12:51 -07:00
Toby
c98c7eca4e chore: better quic close error codes 2022-10-22 12:17:10 -07:00
Toby
b1d9ab6c6a chore: rename "cs" to "cc" (client session -> client connection) 2022-10-22 12:02:41 -07:00
Toby
223a9a4203 cleanup: drop legacy v2 protocol support 2022-10-22 11:59:15 -07:00
Toby
e3c3088596 wip: core client & server rework 2022-10-22 11:45:46 -07:00
Toby
ca3de154ba chore: remove congestion factory 2022-10-21 15:48:00 -07:00
Toby
7126425499 feat: disable keep alive on server (should be client's responsibility only) & use a default idle timeout of 60 seconds 2022-10-20 17:05:17 -07:00
Toby
c018eb11a9 feat: rework config options added in f9f6686 2022-10-19 20:49:20 -07:00
Toby
342a9be127
Merge pull request #465 from HyNetwork/dependabot/github_actions/docker/build-push-action-3.2.0
chore(deps): bump docker/build-push-action from 3.1.1 to 3.2.0
2022-10-19 10:58:02 -07:00
Toby
7754ed0371
Merge pull request #464 from HyNetwork/dependabot/github_actions/docker/login-action-2.1.0
chore(deps): bump docker/login-action from 2.0.0 to 2.1.0
2022-10-19 10:57:52 -07:00
Toby
a681283921
Merge pull request #463 from HyNetwork/dependabot/go_modules/github.com/fsnotify/fsnotify-1.6.0
chore(deps): bump github.com/fsnotify/fsnotify from 1.5.4 to 1.6.0
2022-10-19 10:57:29 -07:00
Toby
b2b47022b5
Merge pull request #461 from HyNetwork/dependabot/go_modules/github.com/spf13/cobra-1.6.0
chore(deps): bump github.com/spf13/cobra from 1.5.0 to 1.6.0
2022-10-19 10:56:54 -07:00
Toby
8b93cf5f08
Update en_newbie.yml 2022-10-19 10:50:54 -07:00
Toby
2bef487bbb
Update en_feature_request.yaml 2022-10-19 10:35:42 -07:00
Toby
9ad19fdc9f chore: retry / retry interval are optional too 2022-10-18 21:22:26 -07:00
dependabot[bot]
bda076694a
chore(deps): bump docker/build-push-action from 3.1.1 to 3.2.0
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 3.1.1 to 3.2.0.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v3.1.1...v3.2.0)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-13 06:09:53 +00:00
dependabot[bot]
eb966ec162
chore(deps): bump docker/login-action from 2.0.0 to 2.1.0
Bumps [docker/login-action](https://github.com/docker/login-action) from 2.0.0 to 2.1.0.
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](https://github.com/docker/login-action/compare/v2.0.0...v2.1.0)

---
updated-dependencies:
- dependency-name: docker/login-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-13 06:09:51 +00:00
dependabot[bot]
35c9a76230
chore(deps): bump github.com/fsnotify/fsnotify from 1.5.4 to 1.6.0
Bumps [github.com/fsnotify/fsnotify](https://github.com/fsnotify/fsnotify) from 1.5.4 to 1.6.0.
- [Release notes](https://github.com/fsnotify/fsnotify/releases)
- [Changelog](https://github.com/fsnotify/fsnotify/blob/main/CHANGELOG.md)
- [Commits](https://github.com/fsnotify/fsnotify/compare/v1.5.4...v1.6.0)

---
updated-dependencies:
- dependency-name: github.com/fsnotify/fsnotify
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-13 06:09:42 +00:00
dependabot[bot]
3c80671405
chore(deps): bump github.com/spf13/cobra from 1.5.0 to 1.6.0
Bumps [github.com/spf13/cobra](https://github.com/spf13/cobra) from 1.5.0 to 1.6.0.
- [Release notes](https://github.com/spf13/cobra/releases)
- [Commits](https://github.com/spf13/cobra/compare/v1.5.0...v1.6.0)

---
updated-dependencies:
- dependency-name: github.com/spf13/cobra
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-12 06:09:10 +00:00
Toby
f9f668644b
Merge pull request #421 from HyNetwork/wip-disable-auto-reconnect
Allow users disable the auto reconnect behavior and related timeout
2022-10-08 23:24:04 -07:00
Toby
57590900ac chore: change all <= to < in config checks 2022-10-08 23:23:51 -07:00
Toby
4b2fd55060 chore: minor code tweaks 2022-10-08 15:47:24 -07:00
Toby
870cf6ed01 chore: update README 2022-10-07 13:54:41 -07:00
Toby
42d58c97e6
Merge pull request #452 from HyNetwork/dependabot/go_modules/github.com/caddyserver/certmagic-0.17.2
chore(deps): bump github.com/caddyserver/certmagic from 0.17.1 to 0.17.2
2022-10-04 14:12:18 -07:00
dependabot[bot]
ad2d46259e
chore(deps): bump github.com/caddyserver/certmagic from 0.17.1 to 0.17.2
Bumps [github.com/caddyserver/certmagic](https://github.com/caddyserver/certmagic) from 0.17.1 to 0.17.2.
- [Release notes](https://github.com/caddyserver/certmagic/releases)
- [Commits](https://github.com/caddyserver/certmagic/compare/v0.17.1...v0.17.2)

---
updated-dependencies:
- dependency-name: github.com/caddyserver/certmagic
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-03 06:17:12 +00:00
Toby
ab845d9a8c
Merge pull request #434 from HyNetwork/dependabot/go_modules/github.com/docker/go-units-0.5.0
chore(deps): bump github.com/docker/go-units from 0.4.0 to 0.5.0
2022-09-18 22:11:28 -07:00
Haruue Icymoon
e67f2d6c7e
fix(tproxy): client crash for ipv6 udp requests
close: #435

ipv6 udp is broken in the upstream go-tproxy, switch to our own fork to
fix it.
2022-09-16 16:53:02 +08:00
dependabot[bot]
2d5ed53d8c
chore(deps): bump github.com/docker/go-units from 0.4.0 to 0.5.0
Bumps [github.com/docker/go-units](https://github.com/docker/go-units) from 0.4.0 to 0.5.0.
- [Release notes](https://github.com/docker/go-units/releases)
- [Commits](https://github.com/docker/go-units/compare/v0.4.0...v0.5.0)

---
updated-dependencies:
- dependency-name: github.com/docker/go-units
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-09-12 06:31:46 +00:00
Toby
03e397b152 chore: update CHANGELOG for 1.2.1 & minor code formatting update 2022-09-09 18:24:12 -07:00
Toby
1d756528a8
Merge pull request #424 from DumAdudus/master
Fix wechat protocol is not working if no obfs string is configured
2022-09-09 18:12:44 -07:00
Toby
f476ad3f67 minor code changes 2022-09-09 18:10:02 -07:00
Toby
0f1108bd48
Merge pull request #428 from HyNetwork/dependabot/go_modules/github.com/caddyserver/certmagic-0.17.1
chore(deps): bump github.com/caddyserver/certmagic from 0.16.3 to 0.17.1
2022-09-09 17:51:08 -07:00
Toby
249fb061d4
Merge pull request #430 from HyNetwork/dependabot/go_modules/github.com/spf13/viper-1.13.0
chore(deps): bump github.com/spf13/viper from 1.12.0 to 1.13.0
2022-09-09 17:50:52 -07:00
Toby
4d6bfe8fa8 chore: change dashes to underscores in tun options for consistent config naming convention 2022-09-09 17:45:01 -07:00
dependabot[bot]
29ad5d8781
chore(deps): bump github.com/spf13/viper from 1.12.0 to 1.13.0
Bumps [github.com/spf13/viper](https://github.com/spf13/viper) from 1.12.0 to 1.13.0.
- [Release notes](https://github.com/spf13/viper/releases)
- [Commits](https://github.com/spf13/viper/compare/v1.12.0...v1.13.0)

---
updated-dependencies:
- dependency-name: github.com/spf13/viper
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-09-07 06:08:21 +00:00
dependabot[bot]
26b5c2c9ee
chore(deps): bump github.com/caddyserver/certmagic from 0.16.3 to 0.17.1
Bumps [github.com/caddyserver/certmagic](https://github.com/caddyserver/certmagic) from 0.16.3 to 0.17.1.
- [Release notes](https://github.com/caddyserver/certmagic/releases)
- [Commits](https://github.com/caddyserver/certmagic/compare/v0.16.3...v0.17.1)

---
updated-dependencies:
- dependency-name: github.com/caddyserver/certmagic
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-09-06 06:10:31 +00:00
Brian Ma
f22705be2c Fix wechat protocol is not working if no obfs string is configured 2022-09-02 11:09:38 +08:00
Haruue Icymoon
4cd18e6685
feat: add quic_settings into client config
fix: #420

allow user to disable auto reconnect when quic disconnected, along with
quic handshake & idle timeout.

an extra failed request would be required to make the client exit in
case of quic disconnected, but i don't think this would be a problem in
the common usage.
2022-08-31 16:34:51 +08:00
Haruue Icymoon
f7de18fd43
chore: a better approach for http proxy error log 2022-08-25 00:53:52 +08:00
Haruue Icymoon
2fb70bdb58
feat: log http proxy error
goproxy actually discard all upstream errors, you can find its error
handling here [1], the upstream error from proxy.connectDial() is always
hidden in the two if branches, and never got logged. we need to log
hysteria layer errors by ourselves.

[1] 8ea89ba920/https.go (L321-L328)

according to some bug reports (such like #404 and the resolve_preference
one report via telegram private message), some users use http proxy, got a
http 502 error without any useful logs.
2022-08-25 00:42:36 +08:00
Haruue Icymoon
7c9fbf22dd
feat: tcp buffer size options for tun mode
close: #407
2022-08-24 23:26:56 +08:00
Toby
a31f826a1e fix: use bootstrap address in routedns resolvers to avoid loopback (closes #408) 2022-08-21 19:40:47 -07:00
Toby
a10abd473f
Merge pull request #409 from HyNetwork/dependabot/go_modules/github.com/caddyserver/certmagic-0.16.3
chore(deps): bump github.com/caddyserver/certmagic from 0.16.2 to 0.16.3
2022-08-20 15:01:05 -07:00
Toby
8960aefca3 chore: update module names (hysteria & quic-go fork) 2022-08-20 11:44:12 -07:00
dependabot[bot]
ac8a27df6e
chore(deps): bump github.com/caddyserver/certmagic from 0.16.2 to 0.16.3
Bumps [github.com/caddyserver/certmagic](https://github.com/caddyserver/certmagic) from 0.16.2 to 0.16.3.
- [Release notes](https://github.com/caddyserver/certmagic/releases)
- [Commits](https://github.com/caddyserver/certmagic/compare/v0.16.2...v0.16.3)

---
updated-dependencies:
- dependency-name: github.com/caddyserver/certmagic
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-19 06:08:20 +00:00
Toby
aad4c44b3d chore: update CHANGELOG for 1.2.0 2022-08-13 18:58:23 -07:00
Toby
944c0ecf64 fix: resolve_preference should only assign each ip once 2 2022-08-13 11:48:09 -07:00
Toby
88099ee72d fix: resolve_preference should only assign each ip once 2022-08-13 11:39:40 -07:00
Toby
1462cadfdc format: gofumpt 2022-08-13 11:04:28 -07:00
Haruue Icymoon
4747be198e
fix: resolve_preference not work 2022-08-13 22:05:07 +08:00
Toby
1b2eb49da1
Merge pull request #398 from HyNetwork/wip-log-ipmask
feat: IP masks
2022-08-12 18:03:50 -07:00
Toby
fbfd933fac feat: ip mask for client side 2022-08-11 21:25:47 -07:00
Toby
ab2ad4aa6d chore: fix license badge 2022-08-10 22:00:11 -07:00
Toby
ad095e4545 feat: ip mask (wip, server only atm) 2022-08-10 21:56:47 -07:00
Toby
12c20211b0
Merge pull request #392 from HyNetwork/dependabot/go_modules/github.com/oschwald/geoip2-golang-1.8.0
chore(deps): bump github.com/oschwald/geoip2-golang from 1.7.0 to 1.8.0
2022-08-10 21:54:31 -07:00
Toby
e5e45720bd
Merge branch 'master' into dependabot/go_modules/github.com/oschwald/geoip2-golang-1.8.0 2022-08-10 21:45:26 -07:00
Toby
8f5ec1aac2
Merge pull request #393 from HyNetwork/dependabot/github_actions/docker/build-push-action-3.1.1
chore(deps): bump docker/build-push-action from 3.1.0 to 3.1.1
2022-08-10 21:44:42 -07:00
Toby
cdc874a608
Merge pull request #391 from HyNetwork/dependabot/go_modules/github.com/prometheus/client_golang-1.13.0
chore(deps): bump github.com/prometheus/client_golang from 1.12.2 to 1.13.0
2022-08-10 21:44:30 -07:00
dependabot[bot]
634eb26a4b
chore(deps): bump github.com/oschwald/geoip2-golang from 1.7.0 to 1.8.0
Bumps [github.com/oschwald/geoip2-golang](https://github.com/oschwald/geoip2-golang) from 1.7.0 to 1.8.0.
- [Release notes](https://github.com/oschwald/geoip2-golang/releases)
- [Commits](https://github.com/oschwald/geoip2-golang/compare/v1.7.0...v1.8.0)

---
updated-dependencies:
- dependency-name: github.com/oschwald/geoip2-golang
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-11 03:53:07 +00:00
dependabot[bot]
943603eb20
chore(deps): bump github.com/prometheus/client_golang
Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.12.2 to 1.13.0.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.12.2...v1.13.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-11 03:53:05 +00:00
Toby
bd9f3e5846
Merge pull request #395 from HyNetwork/wip-newtun-license
Switch tun2socks implementation to xjasonlyu/tun2socks for TUN mode
2022-08-10 20:52:11 -07:00
Toby
45eacaf886 ci: remove xgo usage (as we no longer need cgo) 2022-08-10 20:30:49 -07:00
Toby
b3608956be chore: minor change to log text 2022-08-10 20:30:26 -07:00
Haruue Icymoon
0ba4c36bc6
Merge remote-tracking branch 'origin/master' into wip-newtun-license 2022-08-10 18:05:45 +08:00
Haruue Icymoon
0bd4574988
ci: release build changes for newtun
remove notun and GOFLAGS="-tags=gpl"
2022-08-10 17:45:35 +08:00
Haruue Icymoon
4947af7fa8
docs: update LICENSE.md 2022-08-10 12:45:39 +08:00
Haruue Icymoon
720b97da67
chore: solve license conflict against tun2socks 2022-08-10 12:24:06 +08:00
Haruue Icymoon
80b0c87654
chore: log tun2socks internal warn as info 2022-08-10 11:39:29 +08:00
Haruue Icymoon
4abb30620a
fix: tun device not closed when killed 2022-08-10 11:39:10 +08:00
Toby
a4c61e285e chore: minor log format change 2022-08-09 20:23:22 -07:00
Haruue Icymoon
f3f604b59a
refactor(tun): switch to xjasonlyu/tun2socks
fix: #306, #394, #185, #161

break changes:

we won't create or maintain the interface now, so it is user's duty to
create the tun interface, for example, with command like
  ip tuntap add dev hytun mode tun
(or maybe we can use songgao/water to keep this behavior unchanged).

correspondingly, the "address", "gateway", "mask", "dns", "persist"
options in the "tun" config have been removed.

in addition, please note xjasonlyu/tun2socks is licensed under GPLv3 and
hysteria is licensed under MIT, I don't ensure is it legal to use it as
a go mod, but there are too many requests related on it so whatever...
2022-08-10 02:43:07 +08:00
dependabot[bot]
a5b7bc7707
chore(deps): bump docker/build-push-action from 3.1.0 to 3.1.1
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 3.1.0 to 3.1.1.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v3.1.0...v3.1.1)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-08 06:10:18 +00:00
Toby
af2e0e9676
Merge pull request #390 from HyNetwork/resolver-rework
feat: rework resolver support
2022-08-07 12:08:11 -07:00
Toby
562d8402f5 ci: bump go version to 1.19 2022-08-07 11:58:22 -07:00
Toby
3e63cede8a chore: use upstream routedns since they merged my changes 2022-08-06 20:06:37 -07:00
Toby
3f0953ffdd feat: rework resolver support 2022-08-06 19:58:05 -07:00
Toby
a2ab9e0425 ci: xgo does not support freebsd targets 2022-08-06 11:57:10 -07:00
Toby
21382fe39c ci: add freebsd build targets 2022-08-06 11:19:37 -07:00
Toby
345836abc4
Update README.md 2022-08-04 16:00:11 -07:00
Toby
b84b4b77af
Merge pull request #386 from HyNetwork/dependabot/go_modules/github.com/caddyserver/certmagic-0.16.2
chore(deps): bump github.com/caddyserver/certmagic from 0.16.1 to 0.16.2
2022-08-03 11:21:29 -07:00
dependabot[bot]
e0d7a297a6
chore(deps): bump github.com/caddyserver/certmagic from 0.16.1 to 0.16.2
Bumps [github.com/caddyserver/certmagic](https://github.com/caddyserver/certmagic) from 0.16.1 to 0.16.2.
- [Release notes](https://github.com/caddyserver/certmagic/releases)
- [Commits](https://github.com/caddyserver/certmagic/compare/v0.16.1...v0.16.2)

---
updated-dependencies:
- dependency-name: github.com/caddyserver/certmagic
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-03 06:09:37 +00:00
Toby
b9d0108af3
Merge pull request #378 from HyNetwork/dependabot/github_actions/crazy-max/ghaction-xgo-2.1.0
chore(deps): bump crazy-max/ghaction-xgo from 2.0.0 to 2.1.0
2022-07-22 10:51:21 -07:00
Toby
7051e229d8
Merge pull request #379 from HyNetwork/dependabot/go_modules/github.com/sirupsen/logrus-1.9.0
chore(deps): bump github.com/sirupsen/logrus from 1.8.1 to 1.9.0
2022-07-22 10:51:10 -07:00
Toby
056643f343
Merge pull request #380 from HyNetwork/dependabot/github_actions/docker/build-push-action-3.1.0
chore(deps): bump docker/build-push-action from 3.0.0 to 3.1.0
2022-07-22 10:50:57 -07:00
dependabot[bot]
9fb43fbc43
chore(deps): bump docker/build-push-action from 3.0.0 to 3.1.0
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 3.0.0 to 3.1.0.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v3.0.0...v3.1.0)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-20 06:15:17 +00:00
dependabot[bot]
a83494da78
chore(deps): bump github.com/sirupsen/logrus from 1.8.1 to 1.9.0
Bumps [github.com/sirupsen/logrus](https://github.com/sirupsen/logrus) from 1.8.1 to 1.9.0.
- [Release notes](https://github.com/sirupsen/logrus/releases)
- [Changelog](https://github.com/sirupsen/logrus/blob/master/CHANGELOG.md)
- [Commits](https://github.com/sirupsen/logrus/compare/v1.8.1...v1.9.0)

---
updated-dependencies:
- dependency-name: github.com/sirupsen/logrus
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-20 06:14:53 +00:00
dependabot[bot]
9b94d80baa
chore(deps): bump crazy-max/ghaction-xgo from 2.0.0 to 2.1.0
Bumps [crazy-max/ghaction-xgo](https://github.com/crazy-max/ghaction-xgo) from 2.0.0 to 2.1.0.
- [Release notes](https://github.com/crazy-max/ghaction-xgo/releases)
- [Changelog](https://github.com/crazy-max/ghaction-xgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/crazy-max/ghaction-xgo/compare/v2.0.0...v2.1.0)

---
updated-dependencies:
- dependency-name: crazy-max/ghaction-xgo
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-18 06:14:07 +00:00
Haruue Icymoon
9f40653191
docs: update issue template 2022-07-12 00:55:57 +08:00
Haruue Icymoon
87676d41bd
docs: translate issue templates into english 2022-07-10 19:46:56 +08:00
Haruue Icymoon
53cd363955
docs: add issue template for feature request 2022-07-10 19:46:56 +08:00
Haruue Icymoon
390a7fe556
docs: fix issue template format 2022-07-10 19:46:56 +08:00
Haruue Icymoon
1931fe76d8
docs: fix yaml 2022-07-10 17:51:27 +08:00
Haruue Icymoon
a6a33e9145
docs: fix yaml 2022-07-10 17:50:29 +08:00
Haruue Icymoon
aa55669be8
docs: fix yaml 2022-07-10 17:49:08 +08:00
Haruue Icymoon
9597f7b31d
docs: fix yaml 2022-07-10 17:45:29 +08:00
Haruue Icymoon
3d746075ab
docs: add issue template for newbie users 2022-07-10 17:40:28 +08:00
Toby
160145f712 chore: update CHANGELOG for 1.1.0 2022-07-06 18:26:11 -07:00
Toby
5f3fb2dc2d tool: socks5 tcping latency test 2022-07-06 14:38:24 -07:00
Toby
4a3e996c9a feat: update quic-go 2022-07-06 14:18:52 -07:00
Toby
03b562713b feat: update quic-go 2022-06-26 11:10:02 -07:00
Toby
e7e762c022 chore: ignore local build directory 2022-06-26 11:06:17 -07:00
Toby
3762b07428
Merge pull request #362 from HyNetwork/dependabot/go_modules/github.com/spf13/cobra-1.5.0
chore(deps): bump github.com/spf13/cobra from 1.4.0 to 1.5.0
2022-06-21 10:07:34 -07:00
dependabot[bot]
879fb04b1a
chore(deps): bump github.com/spf13/cobra from 1.4.0 to 1.5.0
Bumps [github.com/spf13/cobra](https://github.com/spf13/cobra) from 1.4.0 to 1.5.0.
- [Release notes](https://github.com/spf13/cobra/releases)
- [Commits](https://github.com/spf13/cobra/compare/v1.4.0...v1.5.0)

---
updated-dependencies:
- dependency-name: github.com/spf13/cobra
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-21 06:20:09 +00:00
Toby
da16c8862d chore: update README & CHANGELOG for 1.0.5 2022-06-10 20:57:56 -07:00
Toby
c8eaa2bce4 chore: fix go mod 2 2022-06-08 21:42:05 -07:00
Toby
7dd2d582b4 Merge branch 'master' of https://github.com/HyNetwork/hysteria 2022-06-08 21:41:35 -07:00
Toby
5f9b1bffb9 chore: fix go mod 2022-06-08 21:41:23 -07:00
Toby
595d1bda8a
Merge pull request #338 from hellodword/bind_to_device
feat: bind socket to a particular device
2022-06-08 20:49:36 -07:00
Toby
5e4773a117
Merge branch 'master' into bind_to_device 2022-06-08 20:45:19 -07:00
Toby
8a64099a96 fix: build failure on linux 386 2022-06-07 12:44:38 -07:00
Toby
d1e7d4c7cb
chore: update README 2022-06-07 00:20:03 -07:00
Toby
5aa96cdc93
Merge pull request #354 from HyNetwork/redir
feat: TCP redirect implementation
2022-06-06 22:00:15 -07:00
Toby
575de280ff feat: TCP redirect implementation 2022-06-06 18:09:34 -07:00
Toby
6d8e79170e chore: code optimizations 2022-06-06 16:06:30 -07:00
Toby
3cd20f6cdb
Merge pull request #346 from HyNetwork/dependabot/github_actions/crazy-max/ghaction-xgo-2.0.0
chore(deps): bump crazy-max/ghaction-xgo from 1.8.0 to 2.0.0
2022-05-30 19:04:13 -07:00
Toby
6d7f7016fb
Merge pull request #345 from HyNetwork/dependabot/go_modules/github.com/spf13/viper-1.12.0
chore(deps): bump github.com/spf13/viper from 1.11.0 to 1.12.0
2022-05-30 19:04:01 -07:00
dependabot[bot]
d8b782c984
chore(deps): bump crazy-max/ghaction-xgo from 1.8.0 to 2.0.0
Bumps [crazy-max/ghaction-xgo](https://github.com/crazy-max/ghaction-xgo) from 1.8.0 to 2.0.0.
- [Release notes](https://github.com/crazy-max/ghaction-xgo/releases)
- [Changelog](https://github.com/crazy-max/ghaction-xgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/crazy-max/ghaction-xgo/compare/v1.8.0...v2.0.0)

---
updated-dependencies:
- dependency-name: crazy-max/ghaction-xgo
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-27 06:09:57 +00:00
dependabot[bot]
1a1c69e6ad
chore(deps): bump github.com/spf13/viper from 1.11.0 to 1.12.0
Bumps [github.com/spf13/viper](https://github.com/spf13/viper) from 1.11.0 to 1.12.0.
- [Release notes](https://github.com/spf13/viper/releases)
- [Commits](https://github.com/spf13/viper/compare/v1.11.0...v1.12.0)

---
updated-dependencies:
- dependency-name: github.com/spf13/viper
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-27 06:09:47 +00:00
hellodword
32f35894cc feat: bind socket to a particular device 2022-05-23 22:33:37 +08:00
Toby
31d34e5269
Merge pull request #331 from mritd/master
chore(build): add taskfile
2022-05-17 15:16:30 -07:00
kovacs
119f2a8bcb
chore(build): add taskfile
add taskfile

Signed-off-by: kovacs <mritd@linux.com>
2022-05-17 15:02:24 +08:00
Toby
eb7de74355
Merge pull request #328 from HyNetwork/dependabot/go_modules/github.com/prometheus/client_golang-1.12.2
chore(deps): bump github.com/prometheus/client_golang from 1.12.1 to 1.12.2
2022-05-16 14:13:36 -07:00
dependabot[bot]
74276ddab1
chore(deps): bump github.com/prometheus/client_golang
Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.12.1 to 1.12.2.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.12.1...v1.12.2)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-16 06:29:14 +00:00
Toby
b36a4d0cd4 feat: update quic-go 2022-05-15 17:10:00 -07:00
Toby
8c7f063a87
Merge pull request #311 from HyNetwork/dependabot/github_actions/docker/setup-buildx-action-2
chore(deps): bump docker/setup-buildx-action from 1 to 2
2022-05-12 22:49:43 -07:00
Toby
4dee70c832
Merge pull request #310 from HyNetwork/dependabot/github_actions/docker/login-action-2.0.0
chore(deps): bump docker/login-action from 1.14.1 to 2.0.0
2022-05-12 22:49:35 -07:00
Toby
e0a237f720
Merge pull request #312 from HyNetwork/dependabot/github_actions/docker/build-push-action-3.0.0
chore(deps): bump docker/build-push-action from 2.10.0 to 3.0.0
2022-05-12 22:49:26 -07:00
Toby
57d4e58ae2
Merge pull request #313 from HyNetwork/dependabot/github_actions/docker/setup-qemu-action-2
chore(deps): bump docker/setup-qemu-action from 1 to 2
2022-05-12 22:49:10 -07:00
Toby
ee4b8e6483 chore: 1.0.4 changelog 2022-05-11 22:11:57 -07:00
Toby
ecf6b8b706 feat: update quic-go 2022-05-11 21:03:03 -07:00
Toby
f3b999bce0 chore: change minAckRate to 0.8 2022-05-11 18:20:46 -07:00
Toby
6d628e1e8c
Merge pull request #322 from HyNetwork/acl-ext
ACL protocol & port support
2022-05-11 17:48:50 -07:00
Toby
343bfc3e0a feat: protocol port aliases 2022-05-11 17:43:25 -07:00
Toby
e9974b0398 ACL protocol & port support 2022-05-11 17:26:39 -07:00
Toby
7a0977023e ci: bump go version to 1.18 2022-05-06 19:29:39 -07:00
Toby
28b6210ce5 perf: reduce time.Now overhead 2 2022-05-06 19:11:35 -07:00
Toby
6e42cb4586
Merge pull request #309 from HyNetwork/dependabot/github_actions/crazy-max/ghaction-xgo-1.8.0
chore(deps): bump crazy-max/ghaction-xgo from 1.7.0 to 1.8.0
2022-05-06 00:12:32 -07:00
Toby
95d8ea49cc perf: reduce time.Now overhead 2022-05-06 00:11:07 -07:00
dependabot[bot]
77a0063621
chore(deps): bump docker/setup-qemu-action from 1 to 2
Bumps [docker/setup-qemu-action](https://github.com/docker/setup-qemu-action) from 1 to 2.
- [Release notes](https://github.com/docker/setup-qemu-action/releases)
- [Commits](https://github.com/docker/setup-qemu-action/compare/v1...v2)

---
updated-dependencies:
- dependency-name: docker/setup-qemu-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-06 06:12:17 +00:00
dependabot[bot]
029eee25bf
chore(deps): bump docker/build-push-action from 2.10.0 to 3.0.0
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 2.10.0 to 3.0.0.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v2.10.0...v3.0.0)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-06 06:12:14 +00:00
dependabot[bot]
e0fe316326
chore(deps): bump docker/setup-buildx-action from 1 to 2
Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 1 to 2.
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](https://github.com/docker/setup-buildx-action/compare/v1...v2)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-06 06:12:11 +00:00
dependabot[bot]
ab5eded6d6
chore(deps): bump docker/login-action from 1.14.1 to 2.0.0
Bumps [docker/login-action](https://github.com/docker/login-action) from 1.14.1 to 2.0.0.
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](https://github.com/docker/login-action/compare/v1.14.1...v2.0.0)

---
updated-dependencies:
- dependency-name: docker/login-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-06 06:12:09 +00:00
dependabot[bot]
75b640f19c
chore(deps): bump crazy-max/ghaction-xgo from 1.7.0 to 1.8.0
Bumps [crazy-max/ghaction-xgo](https://github.com/crazy-max/ghaction-xgo) from 1.7.0 to 1.8.0.
- [Release notes](https://github.com/crazy-max/ghaction-xgo/releases)
- [Changelog](https://github.com/crazy-max/ghaction-xgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/crazy-max/ghaction-xgo/compare/v1.7.0...v1.8.0)

---
updated-dependencies:
- dependency-name: crazy-max/ghaction-xgo
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-02 06:11:43 +00:00
Toby
65fcdd51bc
Merge pull request #303 from HyNetwork/dependabot/go_modules/github.com/fsnotify/fsnotify-1.5.4
chore(deps): bump github.com/fsnotify/fsnotify from 1.5.3 to 1.5.4
2022-04-30 22:25:54 -07:00
Toby
5d98f7f5c3
Merge pull request #307 from HyNetwork/fix-tun-timeout-check
fix tun timeout check
2022-04-30 22:25:39 -07:00
Toby
56825c5525 fix tun timeout check 2022-04-30 12:00:13 -07:00
dependabot[bot]
3dce74cb0f
chore(deps): bump github.com/fsnotify/fsnotify from 1.5.3 to 1.5.4
Bumps [github.com/fsnotify/fsnotify](https://github.com/fsnotify/fsnotify) from 1.5.3 to 1.5.4.
- [Release notes](https://github.com/fsnotify/fsnotify/releases)
- [Changelog](https://github.com/fsnotify/fsnotify/blob/main/CHANGELOG.md)
- [Commits](https://github.com/fsnotify/fsnotify/compare/v1.5.3...v1.5.4)

---
updated-dependencies:
- dependency-name: github.com/fsnotify/fsnotify
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-27 06:18:48 +00:00
Toby
5b90ac21fa
Merge pull request #298 from HyNetwork/dependabot/go_modules/github.com/fsnotify/fsnotify-1.5.3
chore(deps): bump github.com/fsnotify/fsnotify from 1.5.1 to 1.5.3
2022-04-26 11:26:42 -07:00
Toby
63c93c1f3a
Merge pull request #300 from HyNetwork/dependabot/go_modules/github.com/caddyserver/certmagic-0.16.1
chore(deps): bump github.com/caddyserver/certmagic from 0.16.0 to 0.16.1
2022-04-26 11:26:23 -07:00
Toby
c53f9ecf5b
Merge pull request #301 from HyNetwork/dependabot/github_actions/crazy-max/ghaction-xgo-1.7.0
chore(deps): bump crazy-max/ghaction-xgo from 1.6.1 to 1.7.0
2022-04-26 11:26:10 -07:00
Toby
b363e9d0ba
Merge pull request #302 from HyNetwork/dependabot/github_actions/github/codeql-action-2
chore(deps): bump github/codeql-action from 1 to 2
2022-04-26 11:25:53 -07:00
dependabot[bot]
f343546c49
chore(deps): bump github/codeql-action from 1 to 2
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 1 to 2.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/v1...v2)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-26 06:12:42 +00:00
dependabot[bot]
d28d534092
chore(deps): bump crazy-max/ghaction-xgo from 1.6.1 to 1.7.0
Bumps [crazy-max/ghaction-xgo](https://github.com/crazy-max/ghaction-xgo) from 1.6.1 to 1.7.0.
- [Release notes](https://github.com/crazy-max/ghaction-xgo/releases)
- [Changelog](https://github.com/crazy-max/ghaction-xgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/crazy-max/ghaction-xgo/compare/v1.6.1...v1.7.0)

---
updated-dependencies:
- dependency-name: crazy-max/ghaction-xgo
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-25 06:11:09 +00:00
dependabot[bot]
9dedd533d6
chore(deps): bump github.com/caddyserver/certmagic from 0.16.0 to 0.16.1
Bumps [github.com/caddyserver/certmagic](https://github.com/caddyserver/certmagic) from 0.16.0 to 0.16.1.
- [Release notes](https://github.com/caddyserver/certmagic/releases)
- [Commits](https://github.com/caddyserver/certmagic/compare/v0.16.0...v0.16.1)

---
updated-dependencies:
- dependency-name: github.com/caddyserver/certmagic
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-25 06:10:45 +00:00
Haruue Icymoon
8a56ed5795
fix: missing non-tun release for s390x 2022-04-23 16:41:15 +08:00
dependabot[bot]
6366e54001
chore(deps): bump github.com/fsnotify/fsnotify from 1.5.1 to 1.5.3
Bumps [github.com/fsnotify/fsnotify](https://github.com/fsnotify/fsnotify) from 1.5.1 to 1.5.3.
- [Release notes](https://github.com/fsnotify/fsnotify/releases)
- [Changelog](https://github.com/fsnotify/fsnotify/blob/main/CHANGELOG.md)
- [Commits](https://github.com/fsnotify/fsnotify/compare/v1.5.1...v1.5.3)

---
updated-dependencies:
- dependency-name: github.com/fsnotify/fsnotify
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-22 06:10:58 +00:00
Toby
94a4c2d570 chore: 1.0.3 changelog 2022-04-14 20:59:26 -07:00
Toby
ba47130990 fix: stringToBps 2022-04-14 19:53:07 -07:00
Toby
877affec42 feat: update quic-go to 0.27.0 2022-04-14 19:51:08 -07:00
Toby
a9ad3e42c9
Merge pull request #290 from HyNetwork/dependabot/go_modules/github.com/spf13/viper-1.11.0
chore(deps): bump github.com/spf13/viper from 1.10.1 to 1.11.0
2022-04-14 00:22:54 -07:00
Toby
02937081bb
Merge pull request #291 from HyNetwork/domain-passthrough
feat: server SOCKS5 outbound domain passthrough
2022-04-14 00:21:45 -07:00
Toby
fba6cf7a1c feat: server SOCKS5 outbound domain passthrough 2022-04-14 00:11:44 -07:00
dependabot[bot]
8d019bd24d
chore(deps): bump github.com/spf13/viper from 1.10.1 to 1.11.0
Bumps [github.com/spf13/viper](https://github.com/spf13/viper) from 1.10.1 to 1.11.0.
- [Release notes](https://github.com/spf13/viper/releases)
- [Commits](https://github.com/spf13/viper/compare/v1.10.1...v1.11.0)

---
updated-dependencies:
- dependency-name: github.com/spf13/viper
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-14 06:12:08 +00:00
Toby
30619b393e
Merge pull request #287 from HyNetwork/dependabot/github_actions/actions/upload-artifact-3
chore(deps): bump actions/upload-artifact from 2 to 3
2022-04-12 09:53:41 -07:00
dependabot[bot]
2a9eefcfd4
chore(deps): bump actions/upload-artifact from 2 to 3
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 2 to 3.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-11 06:17:03 +00:00
Toby
e72d296518 feat: add linux s390x build to release 2022-04-08 17:36:14 -07:00
Toby
d0dbfdd72d
Merge pull request #230 from misakano7545/master
Add IBM s390x support
2022-04-08 17:33:46 -07:00
Toby
8054d87f12
Merge pull request #276 from HyNetwork/dependabot/go_modules/github.com/oschwald/geoip2-golang-1.7.0
chore(deps): bump github.com/oschwald/geoip2-golang from 1.6.1 to 1.7.0
2022-04-03 20:31:02 -07:00
Toby
dea850e34d
Merge pull request #280 from HyNetwork/better-speed-options
feat: new string-based speed (up/down) options
2022-04-03 20:30:21 -07:00
Toby
53c61ac0f4 feat: new string-based speed (up/down) options 2022-04-03 20:26:25 -07:00
dependabot[bot]
12f4ee4642
chore(deps): bump github.com/oschwald/geoip2-golang from 1.6.1 to 1.7.0
Bumps [github.com/oschwald/geoip2-golang](https://github.com/oschwald/geoip2-golang) from 1.6.1 to 1.7.0.
- [Release notes](https://github.com/oschwald/geoip2-golang/releases)
- [Commits](https://github.com/oschwald/geoip2-golang/compare/v1.6.1...v1.7.0)

---
updated-dependencies:
- dependency-name: github.com/oschwald/geoip2-golang
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-30 05:11:53 +00:00
Toby
f311d9f56a
Merge pull request #275 from HyNetwork/dependabot/go_modules/github.com/caddyserver/certmagic-0.16.0
chore(deps): bump github.com/caddyserver/certmagic from 0.15.4 to 0.16.0
2022-03-29 22:11:03 -07:00
dependabot[bot]
6824e7463a
chore(deps): bump github.com/caddyserver/certmagic from 0.15.4 to 0.16.0
Bumps [github.com/caddyserver/certmagic](https://github.com/caddyserver/certmagic) from 0.15.4 to 0.16.0.
- [Release notes](https://github.com/caddyserver/certmagic/releases)
- [Commits](https://github.com/caddyserver/certmagic/compare/v0.15.4...v0.16.0)

---
updated-dependencies:
- dependency-name: github.com/caddyserver/certmagic
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-28 06:10:52 +00:00
Toby
0d741a0d79 release: add hashes.txt 2022-03-27 15:36:02 -07:00
Toby
917d349d81 chore: 1.0.2 changelog 2022-03-27 15:17:49 -07:00
Toby
614faf75a8
Merge pull request #274 from HyNetwork/resolve-preference
feat: resolve preference
2022-03-27 15:15:20 -07:00
Toby
f0209dc096
Merge pull request #260 from HyNetwork/dependabot/go_modules/github.com/spf13/cobra-1.4.0
chore(deps): bump github.com/spf13/cobra from 1.3.0 to 1.4.0
2022-03-27 15:15:08 -07:00
Toby
f98eec69f2 feat: resolve preference 2022-03-27 15:10:16 -07:00
Toby
9c7a06bc79
Merge pull request #265 from HyNetwork/dependabot/github_actions/docker/build-push-action-2.10.0
chore(deps): bump docker/build-push-action from 2.9.0 to 2.10.0
2022-03-17 19:07:58 -07:00
dependabot[bot]
4961fefdde
chore(deps): bump docker/build-push-action from 2.9.0 to 2.10.0
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 2.9.0 to 2.10.0.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v2.9.0...v2.10.0)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-15 06:09:29 +00:00
dependabot[bot]
2ddff2692b
chore(deps): bump github.com/spf13/cobra from 1.3.0 to 1.4.0
Bumps [github.com/spf13/cobra](https://github.com/spf13/cobra) from 1.3.0 to 1.4.0.
- [Release notes](https://github.com/spf13/cobra/releases)
- [Changelog](https://github.com/spf13/cobra/blob/master/CHANGELOG.md)
- [Commits](https://github.com/spf13/cobra/compare/v1.3.0...v1.4.0)

---
updated-dependencies:
- dependency-name: github.com/spf13/cobra
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-11 06:09:59 +00:00
Toby
2f9f27ce89
Merge pull request #249 from HyNetwork/dependabot/github_actions/actions/checkout-3
chore(deps): bump actions/checkout from 2.4.0 to 3
2022-03-08 13:06:22 -08:00
Toby
82cbd80342
Merge pull request #250 from HyNetwork/dependabot/github_actions/docker/login-action-1.14.1
chore(deps): bump docker/login-action from 1.13.0 to 1.14.1
2022-03-08 13:06:01 -08:00
Toby
1785859faf
Merge pull request #257 from HyNetwork/dependabot/go_modules/github.com/caddyserver/certmagic-0.15.4
chore(deps): bump github.com/caddyserver/certmagic from 0.15.3 to 0.15.4
2022-03-08 13:05:46 -08:00
dependabot[bot]
2175a040fd
chore(deps): bump github.com/caddyserver/certmagic from 0.15.3 to 0.15.4
Bumps [github.com/caddyserver/certmagic](https://github.com/caddyserver/certmagic) from 0.15.3 to 0.15.4.
- [Release notes](https://github.com/caddyserver/certmagic/releases)
- [Commits](https://github.com/caddyserver/certmagic/compare/v0.15.3...v0.15.4)

---
updated-dependencies:
- dependency-name: github.com/caddyserver/certmagic
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-08 06:08:13 +00:00
dependabot[bot]
2fca059502
chore(deps): bump docker/login-action from 1.13.0 to 1.14.1
Bumps [docker/login-action](https://github.com/docker/login-action) from 1.13.0 to 1.14.1.
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](https://github.com/docker/login-action/compare/v1.13.0...v1.14.1)

---
updated-dependencies:
- dependency-name: docker/login-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-02 06:40:06 +00:00
dependabot[bot]
5cf320723d
chore(deps): bump actions/checkout from 2.4.0 to 3
Bumps [actions/checkout](https://github.com/actions/checkout) from 2.4.0 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2.4.0...v3)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-02 06:40:04 +00:00
Toby
7876232265 chore: 1.0.1 changelog 2022-02-28 14:30:42 -08:00
Toby
d4117504eb fix: incorrect UDP frag sendErr handling 2022-02-28 14:26:52 -08:00
Haruue Icymoon
ecf84ee07e
chore: remove python req in the install_server.sh 2022-02-28 21:33:52 +08:00
Toby
2385959936 fix: SOCKS5 outbound bugs 2022-02-27 23:01:34 -08:00
Toby
6383409644 chore: 1.0.0 changelog 2022-02-27 18:58:58 -08:00
Toby
0d93790ec4 chore: bump elazarl/goproxy version 2022-02-27 14:33:14 -08:00
Toby
452402039e
Merge pull request #246 from HyNetwork/socks5-outbound
SOCKS5 outbound
2022-02-27 14:02:03 -08:00
Toby
a94009ed4b chore: code improvements 2022-02-27 13:53:37 -08:00
Toby
97ef033b65 feat: server SOCKS5 outbound 2022-02-26 20:45:20 -08:00
Toby
6b880ba22d feat wip: SOCKS5 client DialTCP 2022-02-26 13:05:52 -08:00
Toby
836b9b6a54 chore: bump txthinking/socks5 version 2022-02-25 18:18:41 -08:00
Toby
c0f53ea712 feat: v2 compatibility 2022-02-25 17:59:01 -08:00
Toby
a5e27385c8 chore: disable update check error msg 2022-02-25 17:30:42 -08:00
Toby
af530f8943
Merge pull request #244 from HyNetwork/wip-udp-frag
UDP fragmentation support
2022-02-25 17:29:38 -08:00
Toby
1789db9ade feat: full frag support 2022-02-25 17:08:54 -08:00
Toby
6efa976a56 feat wip: bump protocol version & quic-go version, frag & defrag implementation 2022-02-25 00:14:22 -08:00
Toby
52bcc1d57b chore: move "disable TCP timeout for SOCKS5 UDP holder" out of the loop 2022-02-20 23:48:34 -08:00
Toby
cea6052309 fix: disable TCP timeout for SOCKS5 UDP holder 2022-02-20 23:42:35 -08:00
Toby
0134b05bb0
Merge pull request #232 from HyNetwork/dependabot/github_actions/docker/login-action-1.13.0
chore(deps): bump docker/login-action from 1.12.0 to 1.13.0
2022-02-19 23:49:53 -08:00
Toby
28d843d52a chore: 0.9.7 changelog 2022-02-19 23:46:59 -08:00
Toby
be45ab1344
Merge pull request #239 from HyNetwork/fix-pmtud
feat: re-enable PMTUD on Windows & Linux
2022-02-19 23:44:30 -08:00
Toby
7466b69cce feat: re-enable PMTUD on Windows & Linux 2022-02-19 23:21:13 -08:00
Toby
2ed60ba402 fix: udp stub 2022-02-19 19:15:51 -08:00
Toby
d92ac5df6e
Merge pull request #236 from HyNetwork/fix-tproxy-udp
fix: incorrect TProxy UDP implementation
2022-02-19 19:09:51 -08:00
Toby
d6b549cea4 fix: incorrect TProxy UDP implementation (228) 2022-02-19 17:42:02 -08:00
dependabot[bot]
6c8c21ce62
chore(deps): bump docker/login-action from 1.12.0 to 1.13.0
Bumps [docker/login-action](https://github.com/docker/login-action) from 1.12.0 to 1.13.0.
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](https://github.com/docker/login-action/compare/v1.12.0...v1.13.0)

---
updated-dependencies:
- dependency-name: docker/login-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-18 06:12:16 +00:00
Misaka No
6f97138056
Update build-master.yml 2022-02-15 11:06:31 +08:00
Toby
41bb9d817e
Merge pull request #227 from mritd/feat/cobra
refactor(cmd): refactor cmd code, support custom mmdb-url
2022-02-13 23:25:05 -08:00
mritd
cb994c47a9
feat(cmd): remove warn log, disable cmd sorting
remove warn log, disable cmd sorting

Signed-off-by: mritd <mritd@linux.com>
2022-02-14 14:43:25 +08:00
mritd
870e13ed4c
feat(cmd): compatible windows double click
compatible windows double click

Signed-off-by: mritd <mritd@linux.com>
2022-02-14 14:25:52 +08:00
mritd
e1c36405c2
docs(cmd): update doc
update doc

Signed-off-by: mritd <mritd@linux.com>
2022-02-10 11:57:36 +08:00
mritd
187cc2a97d
feat(cmd): compatible with old flag format
compatible with old flag format

Signed-off-by: mritd <mritd@linux.com>
2022-02-10 11:50:44 +08:00
Toby
00ea3c9df3 chore: smaller logo 2022-02-09 19:09:31 -08:00
mritd
f6de3a8fdf
feat(cmd): run in client mode by default
run in client mode by default

Signed-off-by: mritd <mritd@linux.com>
2022-02-10 10:54:16 +08:00
Toby
1ac9598d1b chore: rename install.sh to install_server.sh 2022-02-06 19:25:43 -08:00
Toby
7c79a12942
Merge pull request #222 from Mr-Sheep/master
Bash script for installing Hysteria with systemd
2022-02-06 19:23:53 -08:00
mritd
d783ded672
style(cmd): update banner
update banner

Signed-off-by: mritd <mritd@linux.com>
2022-02-07 09:01:44 +08:00
mritd
01dc2beb71
feat(cmd): allow custom mmdb download url
allow custom mmdb download url

Signed-off-by: mritd <mritd@linux.com>
2022-02-06 16:54:40 +08:00
mritd
8e6a9be5f7
feat(cmd): support env
support env

Signed-off-by: mritd <mritd@linux.com>
2022-02-06 16:19:04 +08:00
mritd
fd2e0100c6
feat(cmd): use cobra
use cobra

Signed-off-by: mritd <mritd@linux.com>
2022-02-06 15:33:15 +08:00
Snorlax
d3ab4b10e9 fix typo 2022-02-06 14:28:52 +08:00
Snorlax
e69b9b1faa fix install.sh 2022-02-06 14:07:09 +08:00
mritd
907959b92e
chore(docker): update compose
update compose

Signed-off-by: mritd <mritd@linux.com>
2022-02-06 11:33:28 +08:00
Snorlax
c1b380fc56 Bash script for installing Hysteria with systemd 2022-02-05 20:32:23 +08:00
Toby
03a1bf1dd8 chore: 0.9.6 changelog 2022-02-03 21:46:05 -08:00
Toby
9b78d1cad7
Merge pull request #219 from HyNetwork/wip-client-retry
feat: client retry
2022-02-03 21:42:32 -08:00
Toby
0bb74fcd8d feat: client retry 2022-02-03 21:37:25 -08:00
Toby
349ac5e41e
Merge pull request #218 from HyNetwork/wip-disable-pmtud
Disable PMTUD
2022-02-03 20:55:18 -08:00
Toby
a4a4130ba1 fix: zero initMaxDatagramSize in brutal CC (wtf...) 2022-02-03 20:54:30 -08:00
Toby
b593df44b7 feat: disable quic-go PMTUD due to broken implementation 2022-02-03 20:37:08 -08:00
Toby
28c202431c
Merge pull request #215 from HyNetwork/dependabot/go_modules/github.com/caddyserver/certmagic-0.15.3
chore(deps): bump github.com/caddyserver/certmagic from 0.15.2 to 0.15.3
2022-02-01 23:01:10 -08:00
Toby
0c0433a2e0
Merge pull request #216 from HyNetwork/dependabot/github_actions/docker/build-push-action-2.9.0
chore(deps): bump docker/build-push-action from 2.8.0 to 2.9.0
2022-02-01 23:00:53 -08:00
dependabot[bot]
d35dd2e194
chore(deps): bump docker/build-push-action from 2.8.0 to 2.9.0
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 2.8.0 to 2.9.0.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v2.8.0...v2.9.0)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-02 06:14:30 +00:00
dependabot[bot]
ad0f61391b
chore(deps): bump github.com/caddyserver/certmagic from 0.15.2 to 0.15.3
Bumps [github.com/caddyserver/certmagic](https://github.com/caddyserver/certmagic) from 0.15.2 to 0.15.3.
- [Release notes](https://github.com/caddyserver/certmagic/releases)
- [Commits](https://github.com/caddyserver/certmagic/compare/v0.15.2...v0.15.3)

---
updated-dependencies:
- dependency-name: github.com/caddyserver/certmagic
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-02 06:13:55 +00:00
Toby
e7caf3d645
Merge pull request #214 from HyNetwork/dependabot/go_modules/github.com/prometheus/client_golang-1.12.1
chore(deps): bump github.com/prometheus/client_golang from 1.12.0 to 1.12.1
2022-01-31 00:24:30 -08:00
dependabot[bot]
a76eb04d41
chore(deps): bump github.com/prometheus/client_golang
Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.12.0 to 1.12.1.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.12.0...v1.12.1)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-31 06:09:40 +00:00
Toby
31445adc2f
Merge pull request #213 from HyNetwork/dependabot/go_modules/github.com/oschwald/geoip2-golang-1.6.1
chore(deps): bump github.com/oschwald/geoip2-golang from 1.5.0 to 1.6.1
2022-01-28 20:55:40 -08:00
dependabot[bot]
75d87fc362
chore(deps): bump github.com/oschwald/geoip2-golang from 1.5.0 to 1.6.1
Bumps [github.com/oschwald/geoip2-golang](https://github.com/oschwald/geoip2-golang) from 1.5.0 to 1.6.1.
- [Release notes](https://github.com/oschwald/geoip2-golang/releases)
- [Commits](https://github.com/oschwald/geoip2-golang/compare/v1.5.0...v1.6.1)

---
updated-dependencies:
- dependency-name: github.com/oschwald/geoip2-golang
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-28 06:14:15 +00:00
Toby
e91682fd16 chore: 0.9.5 changelog 2022-01-24 17:54:54 -08:00
Toby
1430c81f90
Merge pull request #211 from HyNetwork/wip-more-auth
feat: multi-password & cmd auth
2022-01-24 17:27:08 -08:00
Toby
c28cbcfcaa feat: multi-password & cmd auth 2022-01-24 17:26:33 -08:00
Toby
48358a7642 feat: no auth or obfs warning 2022-01-24 16:00:26 -08:00
Toby
d56f24c557
Merge pull request #210 from HyNetwork/wip-transport-refactorization
Transport refactorization
2022-01-24 15:52:10 -08:00
Toby
858d36cf30 chore: remove useless laddr from ListenUDP 2022-01-23 17:40:59 -08:00
Toby
841810d6ca feat: transport refactorization 2022-01-23 17:00:02 -08:00
Toby
013e44a9c5 feat: client connect & disconnect log for server 2022-01-21 17:21:56 -08:00
Toby
80b1ce33a2 Merge branch 'master' of https://github.com/HyNetwork/hysteria 2022-01-21 17:17:36 -08:00
Toby
d5424cf8a0 chore: bump notun release build to Go 1.17 2022-01-21 17:17:29 -08:00
Toby
2c84a157e1
Merge pull request #205 from HyNetwork/dependabot/go_modules/github.com/prometheus/client_golang-1.12.0
chore(deps): bump github.com/prometheus/client_golang from 1.11.0 to 1.12.0
2022-01-20 18:23:16 -08:00
dependabot[bot]
dce4ff22e6
chore(deps): bump github.com/prometheus/client_golang
Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.11.0 to 1.12.0.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.11.0...v1.12.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-20 06:12:53 +00:00
Toby
4462e39c98
docs: fix README 2022-01-19 17:15:04 -08:00
Toby
21a2c9c895 Merge branch 'master' of https://github.com/HyNetwork/hysteria 2022-01-19 16:41:29 -08:00
Toby
0790bfd770 docs: docs moved to our wiki 2022-01-19 16:41:21 -08:00
Toby
0aa41950ba
Merge pull request #202 from HyNetwork/dependabot/github_actions/docker/build-push-action-2.8.0
chore(deps): bump docker/build-push-action from 2.7.0 to 2.8.0
2022-01-19 15:48:31 -08:00
Toby
99a4ac3060 docs: add discussions badge to README 2022-01-19 15:46:51 -08:00
dependabot[bot]
a0511648ab
chore(deps): bump docker/build-push-action from 2.7.0 to 2.8.0
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 2.7.0 to 2.8.0.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v2.7.0...v2.8.0)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-19 06:12:54 +00:00
Toby
bd67d017c0 chore: 0.9.4 changelog 2022-01-09 19:49:43 -08:00
Toby
1e6328936c
Merge pull request #197 from HyNetwork/wip-geoip
ACL GeoIP Country
2022-01-09 19:47:14 -08:00
Toby
fb5b21a880 docs: update README 2022-01-09 18:28:13 -08:00
Toby
c13edfb56f docs: update ACL country support 2022-01-09 18:22:58 -08:00
Toby
89452dd9c5 feat: ACL country support 2022-01-09 18:11:52 -08:00
Toby
c3b76a5b44 feat: use fsnotify-based keypair reloading 2022-01-09 14:26:09 -08:00
Toby
291ff7b8cf
Merge pull request #195 from HyNetwork/revert-186-patch-1
Revert "Multi-instance docker-compose"
2022-01-06 21:52:48 -08:00
Toby
482d64fa04
Revert "Multi-instance docker-compose" 2022-01-06 21:52:41 -08:00
Toby
242d35b142
Merge pull request #186 from Error996/patch-1
Multi-instance docker-compose
2022-01-06 21:11:36 -08:00
Toby
25989110b1 docs: update SagerNet hysteria-plugin link 2022-01-05 22:58:06 -08:00
Toby
b4a4d9e78f chore: fix README 2022-01-04 19:37:39 -08:00
Toby
33901413bf chore: tun/notun swap 2022-01-04 19:08:51 -08:00
Toby
233c434411 chore: merge tun & notun build 2022-01-04 18:42:36 -08:00
Toby
dbff7645ed chore: 0.9.3 changelog 2022-01-03 22:36:34 -08:00
Toby
0fb0b4e6ec docs: wechat-video 2022-01-03 22:34:32 -08:00
Toby
44adf006cc
Merge pull request #190 from HyNetwork/wip-wechat
feat: wechat-video protocol
2022-01-03 22:26:08 -08:00
Toby
069bcde2ac feat: wechat-video 2022-01-03 22:25:27 -08:00
Toby
55d8ccf61e
Merge pull request #189 from HyNetwork/wip-cc-optimizations
CC optimizations
2022-01-03 22:23:28 -08:00
Toby
23ed99ad05 feat: minAckRate = 0.75 2022-01-03 21:58:08 -08:00
Error996
219f6380fb
Multi-instance docker-compose
Multi-instance docker-compose, for physical servers with multiple NICs or IPs
2022-01-03 01:15:20 +08:00
Toby
8e1f43093a feat: better ack rate mechanism for brutal CC 2021-12-29 22:52:34 -08:00
Toby
99ace70150 docs: minor README updates 2021-12-29 16:40:46 -08:00
Toby
1c06b66cdc feat: transport & obfs refactoring 2021-12-27 18:07:01 -08:00
Toby
e32191a967 chore: PipeBufferSize should be 65535 not 65536 2021-12-27 16:48:34 -08:00
Toby
4cb4ca5e96 feat: make quic-go happy about buffer stuff 2021-12-27 16:42:10 -08:00
Toby
1484c3585b
Merge pull request #176 from HyNetwork/dependabot/github_actions/docker/login-action-1.12.0
chore(deps): bump docker/login-action from 1.10.0 to 1.12.0
2021-12-25 13:59:22 -08:00
Toby
9bb3070978 docs: update SagerNet hysteria-plugin link 2021-12-25 13:57:22 -08:00
Toby
58d659f2c2 chore: 0.9.2 changelog 2021-12-23 17:38:26 -08:00
Toby
9e5483c11b feat: reduce obfs gc overhead by reusing buffers 2021-12-23 17:25:11 -08:00
Toby
8bd5573c93 docs: URI Scheme 2021-12-22 21:41:27 -08:00
dependabot[bot]
8af6ceec9e
chore(deps): bump docker/login-action from 1.10.0 to 1.12.0
Bumps [docker/login-action](https://github.com/docker/login-action) from 1.10.0 to 1.12.0.
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](https://github.com/docker/login-action/compare/v1.10.0...v1.12.0)

---
updated-dependencies:
- dependency-name: docker/login-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-12-21 06:15:36 +00:00
Toby
029ede79d3 bump quic-go to v0.24.0 2021-12-16 17:26:24 -08:00
Toby
cd8a10ffc4 chore: missing file fix 2021-12-16 14:06:34 -08:00
Toby
ccbd959007 chore: setResolver 2021-12-16 14:06:13 -08:00
Toby
c41d81886c docs: fix resolver address 2021-12-16 13:53:21 -08:00
Toby
6f3a62e1c3 docs: update SagerNet hysteria-plugin link 2021-12-16 02:20:45 -08:00
Toby
ce9d817f80 chore: fix incorrect title size 2021-12-16 02:03:03 -08:00
Toby
bbc23c0ebb chore: 0.9.1 changelog 2021-12-16 01:46:48 -08:00
Toby
3d87d193ff fix: use a more stable release action 2021-12-16 01:04:58 -08:00
Toby
1688ca5edd
Merge pull request #174 from HyNetwork/wip-tcpraw
feat: experimental faketcp implementation
2021-12-15 22:35:44 -08:00
Toby
d9802de484 docs: README for resolver 2021-12-15 22:17:23 -08:00
Toby
c09edb6e53 feat: custom resolver 2021-12-15 21:32:26 -08:00
Toby
b68af5cbe2 docs: README for faketcp 2021-12-15 17:14:29 -08:00
Toby
4872004a5c feat: experimental faketcp implementation 2021-12-15 16:46:20 -08:00
Toby
5c8e349a3b docs: update SagerNet hysteria-plugin link 2021-12-10 14:43:11 -08:00
Toby
0870de7708 chore: 0.9.0 changelog 2021-12-10 01:31:22 -08:00
Toby
3f598b837b
Merge pull request #170 from HyNetwork/wip-ipv6-only-mode
ipv6 only mode
2021-12-10 01:23:28 -08:00
Haruue Icymoon
a6c73b6854
docs: add ipv6_only 2021-12-09 21:05:03 +08:00
Haruue Icymoon
476e045451
feat(server): IPv6 only mode
fix #168
2021-12-09 21:04:59 +08:00
Toby
d7bda39f9e
Merge pull request #165 from cxjava/pr-multiple-relay
multiple relay
2021-12-09 00:11:51 -08:00
Toby
075f4b1ddb chore: update README 2021-12-08 02:05:10 -08:00
Toby
2c4bd83ae1 chore: code improvements 2021-12-08 02:02:55 -08:00
Toby
6be0e6597c
Merge pull request #166 from cxjava/pr-shell-costom-ca
how to generate CA
2021-12-06 01:11:20 -08:00
charles
7d9edaba3c how to generate CA 2021-12-05 20:53:32 +08:00
charles
cca314a938 support multiple tcp and udp relays 2021-12-05 19:12:37 +08:00
charles
af9130480f extract relay type 2021-12-05 18:55:04 +08:00
charles
367dc3c334 ignore vscode folder 2021-12-05 18:51:33 +08:00
Toby
50bee6c694 feat: use local address from TCP connection for SOCKS5 UDP 2021-12-03 23:00:27 -08:00
Toby
c811b8e558 feat: make sure SOCKS5 listen address has a specified IP (for UDP to work) 2021-12-03 21:50:07 -08:00
Toby
fb189c5411 docs: update SagerNet plugin version 2021-11-26 20:45:55 -08:00
Toby
e60601834d docs: add shadowrocket 2021-11-26 20:44:53 -08:00
Toby
f6aa00de63
Merge pull request #157 from HyNetwork/wip-kp-reload
Reload server keypair every 10 minutes
2021-11-25 14:56:25 -08:00
Toby
d4f5a04865 feat: reload server keypair every 10 minutes 2021-11-25 14:53:54 -08:00
Toby
71427f23e2 chore: v0.8.6 changelog 2021-11-25 00:05:25 -08:00
Toby
2c4287fb54 docs: improve README 2021-11-24 23:56:44 -08:00
Toby
7861ad8bc0
Merge pull request #156 from HyNetwork/wip-alpn
Customizable ALPN
2021-11-24 23:45:15 -08:00
Toby
d607b47626 docs: update README 2021-11-24 23:44:28 -08:00
Toby
4140927003 feat: customizable ALPN 2021-11-24 23:35:37 -08:00
Toby
db01b7000e
Merge pull request #144 from HyNetwork/dependabot/go_modules/github.com/caddyserver/certmagic-0.15.2
Bump github.com/caddyserver/certmagic from 0.15.1 to 0.15.2
2021-11-24 23:16:23 -08:00
Toby
14deb88126
Merge pull request #143 from HyNetwork/dependabot/github_actions/actions/checkout-2.4.0
Bump actions/checkout from 2.3.5 to 2.4.0
2021-11-24 23:16:08 -08:00
Toby
5724ff3025
Merge pull request #145 from mritd/master
chore(docker): add build flag
2021-11-24 23:15:57 -08:00
Toby
f0c5922cb0 docs: update README 2021-11-24 23:07:28 -08:00
Toby
6eb49eef12 feat: remove ACL from TPROXY & TUN 2021-11-24 23:04:34 -08:00
mritd
5cd6195f76
docs(docker): update docker doc
update docker doc

Signed-off-by: mritd <mritd@linux.com>
2021-11-09 17:50:06 +08:00
mritd
6942ae271c
chore(docker): add build flag
add build flag

Signed-off-by: mritd <mritd@linux.com>
2021-11-09 17:49:34 +08:00
dependabot[bot]
108c9b49c7
Bump github.com/caddyserver/certmagic from 0.15.1 to 0.15.2
Bumps [github.com/caddyserver/certmagic](https://github.com/caddyserver/certmagic) from 0.15.1 to 0.15.2.
- [Release notes](https://github.com/caddyserver/certmagic/releases)
- [Commits](https://github.com/caddyserver/certmagic/compare/v0.15.1...v0.15.2)

---
updated-dependencies:
- dependency-name: github.com/caddyserver/certmagic
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-09 06:21:42 +00:00
dependabot[bot]
4194503d37
Bump actions/checkout from 2.3.5 to 2.4.0
Bumps [actions/checkout](https://github.com/actions/checkout) from 2.3.5 to 2.4.0.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2.3.5...v2.4.0)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-03 06:12:38 +00:00
Toby
a1515b1943 Merge branch 'master' of https://github.com/HyNetwork/hysteria 2021-10-24 13:09:09 -07:00
Toby
de4274975b docs(docker): typo fix 2021-10-24 13:08:42 -07:00
Toby
e23845d42d
Merge pull request #140 from HyNetwork/dependabot/go_modules/github.com/caddyserver/certmagic-0.15.1
Bump github.com/caddyserver/certmagic from 0.15.0 to 0.15.1
2021-10-24 12:39:31 -07:00
Toby
a6707b8722
Merge pull request #141 from HyNetwork/dependabot/github_actions/actions/checkout-2.3.5
Bump actions/checkout from 2.3.4 to 2.3.5
2021-10-24 12:39:17 -07:00
dependabot[bot]
42d4affbec
Bump actions/checkout from 2.3.4 to 2.3.5
Bumps [actions/checkout](https://github.com/actions/checkout) from 2.3.4 to 2.3.5.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2.3.4...v2.3.5)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-18 06:11:09 +00:00
dependabot[bot]
a08ccc228c
Bump github.com/caddyserver/certmagic from 0.15.0 to 0.15.1
Bumps [github.com/caddyserver/certmagic](https://github.com/caddyserver/certmagic) from 0.15.0 to 0.15.1.
- [Release notes](https://github.com/caddyserver/certmagic/releases)
- [Commits](https://github.com/caddyserver/certmagic/compare/v0.15.0...v0.15.1)

---
updated-dependencies:
- dependency-name: github.com/caddyserver/certmagic
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-13 06:23:29 +00:00
Toby
4c83fe4ae9 fix: certmagic API change 2021-10-08 20:50:10 -07:00
Toby
8dfeeaded7
Merge pull request #137 from HyNetwork/dependabot/go_modules/github.com/caddyserver/certmagic-0.15.0
Bump github.com/caddyserver/certmagic from 0.14.5 to 0.15.0
2021-10-08 15:35:50 -07:00
dependabot[bot]
d53f2a22db
Bump github.com/caddyserver/certmagic from 0.14.5 to 0.15.0
Bumps [github.com/caddyserver/certmagic](https://github.com/caddyserver/certmagic) from 0.14.5 to 0.15.0.
- [Release notes](https://github.com/caddyserver/certmagic/releases)
- [Commits](https://github.com/caddyserver/certmagic/compare/v0.14.5...v0.15.0)

---
updated-dependencies:
- dependency-name: github.com/caddyserver/certmagic
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-01 06:19:51 +00:00
Toby
70028c2fa5
Merge pull request #134 from mritd/master
docs(docker): add docker docs
2021-09-18 02:38:59 -07:00
mritd
700f101aa1
docs(README): add docker doc link
add docker doc link

Signed-off-by: mritd <mritd@linux.com>
2021-09-18 17:35:49 +08:00
mritd
0eb640252c
docs(docker): add docker docs
add docker docs

Signed-off-by: mritd <mritd@linux.com>
2021-09-18 17:05:30 +08:00
Toby
66f9cc9e83 Add OpenWrt LuCI app to README 2021-09-17 15:27:59 -07:00
Toby
5e7be1e487
Merge pull request #126 from HyNetwork/dependabot/go_modules/github.com/caddyserver/certmagic-0.14.5
Bump github.com/caddyserver/certmagic from 0.14.4 to 0.14.5
2021-09-15 16:21:14 -07:00
dependabot[bot]
2d252b5ba8
Bump github.com/caddyserver/certmagic from 0.14.4 to 0.14.5
Bumps [github.com/caddyserver/certmagic](https://github.com/caddyserver/certmagic) from 0.14.4 to 0.14.5.
- [Release notes](https://github.com/caddyserver/certmagic/releases)
- [Commits](https://github.com/caddyserver/certmagic/compare/v0.14.4...v0.14.5)

---
updated-dependencies:
- dependency-name: github.com/caddyserver/certmagic
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-06 06:22:53 +00:00
Toby
a9ec37fee8
Merge pull request #118 from HyNetwork/dependabot/github_actions/docker/build-push-action-2.7.0
Bump docker/build-push-action from 2.6.1 to 2.7.0
2021-09-03 15:29:27 -07:00
Toby
6b587ae965
Merge pull request #124 from HyNetwork/dependabot/go_modules/github.com/caddyserver/certmagic-0.14.4
Bump github.com/caddyserver/certmagic from 0.14.1 to 0.14.4
2021-09-03 15:29:11 -07:00
dependabot[bot]
2127dd08ba
Bump github.com/caddyserver/certmagic from 0.14.1 to 0.14.4
Bumps [github.com/caddyserver/certmagic](https://github.com/caddyserver/certmagic) from 0.14.1 to 0.14.4.
- [Release notes](https://github.com/caddyserver/certmagic/releases)
- [Commits](https://github.com/caddyserver/certmagic/compare/v0.14.1...v0.14.4)

---
updated-dependencies:
- dependency-name: github.com/caddyserver/certmagic
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-31 06:17:35 +00:00
Toby
6e5c7a947f Update SagerNet plugin URL 2021-08-23 22:21:38 -07:00
Toby
5ed51479e3 v0.8.5 changelog 2021-08-23 14:51:39 -07:00
Toby
b37f2f5256
Merge pull request #120 from HyNetwork/wip-mtu-option
Option to disable MTU discovery
2021-08-23 14:47:43 -07:00
Toby
abd2a5d58c README for disable_mtu_discovery 2021-08-23 14:42:56 -07:00
Toby
32b3dc65a0 Add an option to disable MTU discovery 2021-08-23 14:38:10 -07:00
dependabot[bot]
17a00e9951
Bump docker/build-push-action from 2.6.1 to 2.7.0
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 2.6.1 to 2.7.0.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v2.6.1...v2.7.0)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-23 06:09:36 +00:00
Toby
ca8b1ba2fa
Merge pull request #112 from mritd/chore/docker
chore(docker): set up nsswitch.conf for Go's "netgo" implementation
2021-08-15 14:08:28 -07:00
mritd
c4ed9fe58b
chore(docker): update GOPATH dir
update GOPATH dir

Signed-off-by: mritd <mritd@linux.com>
2021-08-13 16:25:51 +08:00
mritd
6c16721445
chore(docker): set up nsswitch.conf for Go's "netgo" implementation
set up nsswitch.conf for Go's "netgo" implementation

Signed-off-by: mritd <mritd@linux.com>
2021-08-13 16:04:31 +08:00
Toby
9ad8471aa1
Merge pull request #101 from HyNetwork/dependabot/go_modules/github.com/lucas-clemente/quic-go-0.22.0
Bump github.com/lucas-clemente/quic-go from 0.20.1 to 0.22.0
2021-08-12 10:34:25 -07:00
Toby
db181d5849 More minor README updates 2021-08-12 10:32:44 -07:00
Toby
9cf435f535 Minor README updates & change ipdeny URLs to HTTP to bypass cert issues 2021-08-12 10:22:07 -07:00
Toby
481abdf41d Better build naming & notun README 2021-08-08 16:31:20 -07:00
Toby
837ead24cc Remove unnecessary non-Linux no-tun builds 2021-08-08 16:19:18 -07:00
Toby
6cf638de2b tun & non-tun versions 2021-08-08 10:39:26 -07:00
Toby
781f91fe7d Update README 2021-08-03 02:22:48 -07:00
Toby
154f1148d3 Typo fix 2021-08-02 23:54:26 -07:00
Toby
4f2ffe976b hysteria-plugin link 2021-08-02 23:32:42 -07:00
Toby
075867c3df SagerNet 2021-08-02 23:00:41 -07:00
Toby
97c83dc935 wrappedQUICStream to handle stream close properly 2021-08-02 22:42:25 -07:00
Toby
5d29fb954d TODO: Change fixed dstAddr 2021-08-02 21:49:36 -07:00
dependabot[bot]
825ecff5cf
Bump github.com/lucas-clemente/quic-go from 0.20.1 to 0.22.0
Bumps [github.com/lucas-clemente/quic-go](https://github.com/lucas-clemente/quic-go) from 0.20.1 to 0.22.0.
- [Release notes](https://github.com/lucas-clemente/quic-go/releases)
- [Changelog](https://github.com/lucas-clemente/quic-go/blob/master/Changelog.md)
- [Commits](https://github.com/lucas-clemente/quic-go/compare/v0.20.1...v0.22.0)

---
updated-dependencies:
- dependency-name: github.com/lucas-clemente/quic-go
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-29 04:33:50 +00:00
Toby
c32ac17f62 Bump quic-go to v0.22.0 & remove SetDontFragment (as it's implemented in quic-go already) 2021-07-28 21:18:43 -07:00
Toby
d6aba2e1d0
Merge pull request #99 from HyNetwork/dependabot/go_modules/github.com/caddyserver/certmagic-0.14.1
Bump github.com/caddyserver/certmagic from 0.14.0 to 0.14.1
2021-07-28 21:06:27 -07:00
dependabot[bot]
eb57aaf2ad
Bump github.com/caddyserver/certmagic from 0.14.0 to 0.14.1
Bumps [github.com/caddyserver/certmagic](https://github.com/caddyserver/certmagic) from 0.14.0 to 0.14.1.
- [Release notes](https://github.com/caddyserver/certmagic/releases)
- [Commits](https://github.com/caddyserver/certmagic/compare/v0.14.0...v0.14.1)

---
updated-dependencies:
- dependency-name: github.com/caddyserver/certmagic
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-12 06:16:36 +00:00
Toby
d866f474bf
Merge pull request #98 from HyNetwork/wip-no-cgo
Allow build with CGO_ENABLED=0 by disable TUN Mode
2021-07-08 09:51:01 -07:00
Haruue Icymoon
9c3597bd11
Allow build with CGO_ENABLED=0 by disable TUN Mode
Run hysteria on your favorite OpenWRT router.
2021-07-08 21:19:13 +08:00
Toby
9e67db0c9c
Merge pull request #92 from HyNetwork/dependabot/go_modules/github.com/prometheus/client_golang-1.11.0
Bump github.com/prometheus/client_golang from 1.10.0 to 1.11.0
2021-07-05 20:15:16 -07:00
Toby
7d8ae08634
Merge pull request #95 from HyNetwork/dependabot/github_actions/docker/login-action-1.10.0
Bump docker/login-action from 1.9.0 to 1.10.0
2021-07-05 20:14:57 -07:00
Toby
0f7b202849
Merge pull request #96 from HyNetwork/dependabot/github_actions/docker/build-push-action-2.6.1
Bump docker/build-push-action from 2.5.0 to 2.6.1
2021-07-05 20:14:45 -07:00
dependabot[bot]
d9a07e2101
Bump docker/build-push-action from 2.5.0 to 2.6.1
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 2.5.0 to 2.6.1.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v2.5.0...v2.6.1)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-02 06:09:55 +00:00
dependabot[bot]
197ba604c9
Bump docker/login-action from 1.9.0 to 1.10.0
Bumps [docker/login-action](https://github.com/docker/login-action) from 1.9.0 to 1.10.0.
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](https://github.com/docker/login-action/compare/v1.9.0...v1.10.0)

---
updated-dependencies:
- dependency-name: docker/login-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-24 06:11:22 +00:00
dependabot[bot]
73aa3e5e20
Bump github.com/prometheus/client_golang from 1.10.0 to 1.11.0
Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.10.0 to 1.11.0.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/master/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.10.0...v1.11.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-16 07:34:19 +00:00
Toby
2f34577d8b
Merge pull request #93 from HyNetwork/dependabot/go_modules/github.com/caddyserver/certmagic-0.14.0
Bump github.com/caddyserver/certmagic from 0.13.1 to 0.14.0
2021-06-15 23:56:14 -07:00
dependabot[bot]
6ac1517e72
Bump github.com/caddyserver/certmagic from 0.13.1 to 0.14.0
Bumps [github.com/caddyserver/certmagic](https://github.com/caddyserver/certmagic) from 0.13.1 to 0.14.0.
- [Release notes](https://github.com/caddyserver/certmagic/releases)
- [Commits](https://github.com/caddyserver/certmagic/compare/v0.13.1...v0.14.0)

---
updated-dependencies:
- dependency-name: github.com/caddyserver/certmagic
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-14 08:24:52 +00:00
Toby
7bed1bc7da
Merge pull request #90 from HyNetwork/dependabot/github_actions/docker/build-push-action-2.5.0
Bump docker/build-push-action from 2.4.0 to 2.5.0
2021-05-27 18:20:10 -07:00
dependabot[bot]
2f2d50ab36
Bump docker/build-push-action from 2.4.0 to 2.5.0
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 2.4.0 to 2.5.0.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v2.4.0...v2.5.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-27 07:04:31 +00:00
Toby
bfed3cb62d
Merge pull request #82 from HyNetwork/dependabot/github_actions/crazy-max/ghaction-xgo-1.6.1
Bump crazy-max/ghaction-xgo from 1 to 1.6.1
2021-05-13 15:19:47 -07:00
Toby
8a78bfc41b
Merge pull request #83 from HyNetwork/dependabot/github_actions/actions/checkout-2.3.4
Bump actions/checkout from 2 to 2.3.4
2021-05-13 15:19:40 -07:00
Toby
8cf9aca455
Merge pull request #84 from HyNetwork/dependabot/github_actions/meeDamian/github-release-2.0.3
Bump meeDamian/github-release from 2.0 to 2.0.3
2021-05-13 15:19:31 -07:00
Toby
cb50fae05e
Merge pull request #85 from HyNetwork/dependabot/github_actions/docker/login-action-1.9.0
Bump docker/login-action from 1 to 1.9.0
2021-05-13 15:19:24 -07:00
Toby
3bd28a168f
Merge pull request #86 from HyNetwork/dependabot/github_actions/docker/build-push-action-2.4.0
Bump docker/build-push-action from 2 to 2.4.0
2021-05-13 15:19:15 -07:00
dependabot[bot]
b5d606a7b3
Bump docker/build-push-action from 2 to 2.4.0
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 2 to 2.4.0.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v2...v2.4.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-12 06:28:37 +00:00
dependabot[bot]
05d1a3fc56
Bump docker/login-action from 1 to 1.9.0
Bumps [docker/login-action](https://github.com/docker/login-action) from 1 to 1.9.0.
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](https://github.com/docker/login-action/compare/v1...v1.9.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-12 06:28:35 +00:00
dependabot[bot]
944dacc0df
Bump meeDamian/github-release from 2.0 to 2.0.3
Bumps [meeDamian/github-release](https://github.com/meeDamian/github-release) from 2.0 to 2.0.3.
- [Release notes](https://github.com/meeDamian/github-release/releases)
- [Commits](https://github.com/meeDamian/github-release/compare/2.0...v2.0.3)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-12 06:28:32 +00:00
dependabot[bot]
5620cdfae5
Bump actions/checkout from 2 to 2.3.4
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 2.3.4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v2.3.4)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-12 06:28:30 +00:00
dependabot[bot]
8a77935092
Bump crazy-max/ghaction-xgo from 1 to 1.6.1
Bumps [crazy-max/ghaction-xgo](https://github.com/crazy-max/ghaction-xgo) from 1 to 1.6.1.
- [Release notes](https://github.com/crazy-max/ghaction-xgo/releases)
- [Changelog](https://github.com/crazy-max/ghaction-xgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/crazy-max/ghaction-xgo/compare/v1...v1.6.1)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-12 06:28:28 +00:00
Toby
35e285ff62 Log level DEBUG by default 2021-05-09 15:16:03 -07:00
Toby
faabd094fd Fix UDP TPROXY incorrect src addr bug & build master action 2021-05-09 14:53:30 -07:00
Toby
0719e8980e TUN/TAP disambiguation 2021-05-08 22:20:01 -07:00
Toby
090be58f50 Add build-base for CGO 2021-05-08 21:25:27 -07:00
Toby
c4b05c5a95 Fix targets 2021-05-08 21:24:17 -07:00
Toby
74130877dd Fix typo 2021-05-08 21:06:08 -07:00
Toby
22675c740e Switch to crazy-max/ghaction-xgo 2021-05-08 21:02:40 -07:00
Toby
65a1b7b5f4 Enable CGO (for tun) 2021-05-08 20:58:04 -07:00
Toby
81b26da313 Update README 2021-05-08 19:52:21 -07:00
Toby
3055fec7d3 Add GitHub Actions to Dependabot 2021-05-08 18:11:06 -07:00
Toby
078f860174
Merge pull request #75 from HyNetwork/wip-tun
TUN
2021-05-08 18:09:53 -07:00
Toby
54b525d559 Improve config error text 2021-05-08 18:04:22 -07:00
Toby
34b453b997
Merge pull request #79 from HyNetwork/wip-servername
Add TLS server name option for client
2021-05-08 16:44:03 -07:00
Toby
2934f376d1 Add TLS server name option for client 2021-05-08 16:39:25 -07:00
Toby
bf1dbe2f83
Merge pull request #77 from HyNetwork/wip-cli
Better CLI
2021-05-08 16:19:22 -07:00
Toby
060948188e Tweaks to the CLI to ensure consistent behavior with previous versions 2021-05-08 16:07:04 -07:00
Toby
3f5bd76480
Merge pull request #71 from mritd/master
feat(cmd): add POSIX command line style support
2021-05-06 18:07:08 -07:00
Toby
912fb07cda
Merge branch 'wip-cli' into master 2021-05-06 18:06:54 -07:00
Toby
d41f2ebdf9
Merge pull request #74 from HyNetwork/dependabot/go_modules/github.com/caddyserver/certmagic-0.13.1
Bump github.com/caddyserver/certmagic from 0.13.0 to 0.13.1
2021-05-06 15:14:40 -07:00
dependabot[bot]
04b142ef29
Bump github.com/caddyserver/certmagic from 0.13.0 to 0.13.1
Bumps [github.com/caddyserver/certmagic](https://github.com/caddyserver/certmagic) from 0.13.0 to 0.13.1.
- [Release notes](https://github.com/caddyserver/certmagic/releases)
- [Commits](https://github.com/caddyserver/certmagic/compare/v0.13.0...v0.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-06 08:30:24 +00:00
Toby
fe5e88580a Merge branch 'master' of https://github.com/HyNetwork/hysteria 2021-05-05 01:21:57 -07:00
Toby
f7f28a9e54 Update bench 2021-05-05 01:18:24 -07:00
Toby
c55ff2ef0b
Merge pull request #72 from HyNetwork/dependabot/go_modules/github.com/caddyserver/certmagic-0.13.1
Bump github.com/caddyserver/certmagic from 0.13.0 to 0.13.1
2021-05-04 15:45:11 -07:00
dependabot[bot]
348fb09ccb
Bump github.com/caddyserver/certmagic from 0.13.0 to 0.13.1
Bumps [github.com/caddyserver/certmagic](https://github.com/caddyserver/certmagic) from 0.13.0 to 0.13.1.
- [Release notes](https://github.com/caddyserver/certmagic/releases)
- [Commits](https://github.com/caddyserver/certmagic/compare/v0.13.0...v0.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-04 08:34:21 +00:00
mritd
77392ccf98
feat(cmd): add POSIX command line style support
add POSIX command line style support

Signed-off-by: mritd <mritd@linux.com>
2021-05-03 20:44:26 +08:00
Haruue Icymoon
68d8cd4043
Fix TCP timeout not works in TUN server 2021-05-03 15:43:45 +08:00
Haruue Icymoon
abfacebd40
Fix acl engine not set in TUN server 2021-05-03 11:22:46 +08:00
Haruue Icymoon
284efce6db
Set default timeout to 300s for TUN 2021-05-03 11:22:46 +08:00
Haruue Icymoon
81128a7626
ACL for TUN 2021-05-03 11:22:46 +08:00
Haruue Icymoon
13ec19cbfe
Implement TUN, no ACL support yet 2021-05-03 11:22:43 +08:00
Toby
89b9ec2acf
Create codeql-analysis.yml 2021-05-02 14:03:20 -07:00
Toby
00868b6c63 Update benchmark image 2021-05-01 23:38:29 -07:00
Toby
46990ee0a4 Enable dependabot 2021-05-01 22:41:44 -07:00
Toby
3a195ef38d
Merge pull request #70 from HyNetwork/wip-better-default-params
Better default params to reduce flow control blocks
2021-04-30 22:24:46 -07:00
Toby
fa929b10ae Optimization tips for routers and other embedded devices 2021-04-30 22:23:37 -07:00
Toby
3955d98aa2 Better default params to reduce flow control blocks & add README for optimizing for extreme transfer speeds 2021-04-30 21:29:18 -07:00
Toby
c0e46ee937 Remove obsolete test 2021-04-28 16:42:08 -07:00
Toby
9f564a997e
Merge pull request #68 from HyNetwork/wip-update-checker
Update checker
2021-04-28 16:37:01 -07:00
Toby
d12d3aa9ee Update checker 2021-04-28 16:22:37 -07:00
Toby
0c887e0634 Update dependencies & use better log formatter 2021-04-28 15:55:14 -07:00
Toby
c9ab6d03cb
Merge pull request #62 from HyNetwork/wip-acme
ACME implementation
2021-04-28 01:53:07 -07:00
Toby
d1e9daea49 ACME implementation 2021-04-28 00:45:59 -07:00
Toby
214f1cf72c Fix ConnGauge nil crash 2021-04-27 23:10:09 -07:00
Toby
ac1233a6f9 Bump quic-go to v0.20.1 2021-04-27 22:24:38 -07:00
Toby
39a33aec94
Merge pull request #60 from HyNetwork/wip-conn-gauge
Prometheus Active Conn Gauge
2021-04-27 20:44:48 -07:00
Toby
71701581ac Update READMEs 2021-04-27 20:44:02 -07:00
Toby
8c5b701a4b Prometheus Active Conn Gauge 2021-04-27 20:38:43 -07:00
Toby
56f35d94cc Revert "bump DefaultMaxIncomingStreams to 4096"
This reverts commit 7ba81612f8.
2021-04-27 20:24:48 -07:00
Toby
144f26bc2f
Merge pull request #58 from HyNetwork/wip-dialer
Transport
2021-04-27 20:24:02 -07:00
Toby
bbfbb3d6c2
Merge pull request #56 from HyNetwork/wip-tproxy
TProxy
2021-04-27 20:23:52 -07:00
Toby
03d530776c Fix stubs 2021-04-27 20:21:01 -07:00
Toby
3667778ca7 Fix import cycles 2021-04-27 20:18:43 -07:00
Toby
5ac95d987a Use core.Transport 2021-04-27 20:14:43 -07:00
Toby
4da73888f4 Transport WIP 2021-04-26 17:34:08 -07:00
Toby
b3d149a72f UDP TProxy ACL & Fix SOCKS5 hijack bug 2021-04-25 23:45:45 -07:00
Toby
7ba81612f8 bump DefaultMaxIncomingStreams to 4096 2021-04-25 20:41:39 -07:00
Toby
a28d5a5677 Update READMEs 2021-04-25 03:08:30 -07:00
Toby
7b3e1a5b41 UDP TProxy implementation, no ACL support yet 2021-04-25 00:38:07 -07:00
Toby
2b4e660324 Remove pointless udpMinTimeout 2021-04-24 18:13:30 -07:00
Toby
3b7aefb10d Improve UDP Relay timeout handling 2021-04-24 17:37:50 -07:00
Toby
70fd2ffc0d ACL for TCP TProxy 2021-04-24 15:36:19 -07:00
Toby
787ed14c4d TCP TProxy implementation, no UDP or ACL support yet 2021-04-24 02:56:17 -07:00
Toby
444bb5daec handleControlStream should not always return true 2021-04-22 18:09:48 -07:00
Toby
0626a3e505
Merge pull request #54 from tobyxdd/wip-udp-relay
UDP Relay
2021-04-21 21:59:15 -07:00
Toby
b3f0306c13 Merge branch 'master' into wip-udp-relay 2021-04-21 21:54:28 -07:00
Toby
d990586e88 Update READMEs 2021-04-21 21:53:18 -07:00
Toby
00f39ab097 Add missing UDP relay config check 2021-04-21 21:48:36 -07:00
Toby
98ddad22f6 Close stopChan on exit 2021-04-21 21:42:35 -07:00
Toby
bca98ef4da Implement UDP relay 2021-04-21 21:40:43 -07:00
Toby
78f6eece9f Remove unnecessary closures 2021-04-21 17:43:24 -07:00
Toby
3b6a2bc56e Use correct address for packets from localRelayConn 2021-04-21 17:08:01 -07:00
Toby
d8b198ca31 Rename the original relay to TCPRelay 2021-04-21 16:38:08 -07:00
Toby
51abb06911 Adjustable saltLen 2021-04-21 14:23:40 -07:00
Toby
f396cae604
Merge pull request #53 from tobyxdd/wip-xplus-obfs
Better obfs
2021-04-19 20:54:05 -07:00
Toby
45c664785b
Merge pull request #52 from tobyxdd/wip-protocol-2.0
Protocol 2.0
2021-04-19 20:53:47 -07:00
Toby
b80db1fc19 XPlus obfs & don't frag 2021-04-19 20:52:50 -07:00
Toby
eb9006bd0d Add missing file 2021-04-19 00:20:39 -07:00
Toby
b09880a050 Split host & port in the protocol, and make each domain resolves only once even when ACL is enabled, improving performance and ensuring consistency of connection destinations 2021-04-19 00:20:22 -07:00
Toby
7b841aa203 Protocol version check 2021-04-18 18:07:01 -07:00
Toby
fc4d573f3d Minor README improvements 2021-04-13 17:22:41 -07:00
Toby
6ecd4bd9b8 Add the Docker Hub link to README 2021-04-13 16:31:14 -07:00
Toby
e4c5425cd0 fix(docker): ACTIONS_ALLOW_UNSECURE_COMMANDS 2021-04-13 16:22:08 -07:00
Toby
16df31b1b8
Merge pull request #46 from mritd/chore/docker
chore(docker): update dockerfile
2021-04-13 16:16:13 -07:00
mritd
7e769e6b8a
chore(workflow): support Multi-platform build
support Multi-platform build

Signed-off-by: mritd <mritd@linux.com>
2021-04-13 20:42:33 +08:00
mritd
db716f7a75
chore(workflow): fix workflow trigger
fix workflow trigger

Signed-off-by: mritd <mritd@linux.com>
2021-04-13 20:38:43 +08:00
mritd
93a8bde9bc
chore(dockerfile): fix git cmd missing
fix git cmd missing

Signed-off-by: mritd <mritd@linux.com>
2021-04-13 20:30:01 +08:00
mritd
71f3583deb
chore(dockerfile): auto env from git repo
auto env from git repo

Signed-off-by: mritd <mritd@linux.com>
2021-04-13 20:27:32 +08:00
mritd
91cb3f8ef7
chore(docker): update docker file, add ci support
update docker file, add ci support

Signed-off-by: mritd <mritd@linux.com>
2021-04-13 20:05:10 +08:00
Toby
44e6c3fdde Add Installation section to READMEs 2021-04-11 14:37:36 -07:00
Toby
7ba60a0ece darwin/arm64 build 2021-04-11 14:18:31 -07:00
Toby
6378f5e132
Merge pull request #45 from tobyxdd/wip-prometheus
Implement Prometheus Metrics API
2021-04-11 14:09:00 -07:00
Toby
240fb5aa0e Add missing prometheus_listen entry in README.zh.md 2021-04-10 18:30:59 -07:00
Toby
be104a60be README for Prometheus API 2021-04-10 18:25:02 -07:00
Toby
6ddcbdc01d Implement Prometheus metrics 2021-04-10 18:01:56 -07:00
Toby
67f1e469d7
Merge pull request #44 from tobyxdd/wip-http-auth
HTTP external auth implementation
2021-04-09 20:58:28 -07:00
Toby
22ad36dabb Update README 2021-04-04 15:10:23 -07:00
Toby
461b16f07f External HTTP auth implementation 2021-04-04 14:47:07 -07:00
Toby
da65c4cbf5
Merge pull request #40 from tobyxdd/wip-udp-buf
Passthrough required methods for quic-go to increase the buffer size
2021-04-02 14:40:17 -07:00
Toby
ede94df103 Passthrough required methods for quic-go to increase the buffer size (https://github.com/lucas-clemente/quic-go/wiki/UDP-Receive-Buffer-Size) 2021-04-02 14:20:48 -07:00
Toby
ca82abcab3 Remove temp build script for Windows 2021-03-31 16:15:21 -07:00
Toby
65c26cdfe4 Small tweak to brutal CC 2021-03-31 16:01:59 -07:00
Toby
c7c2e59732 Fix incorrect README cmd example 2021-03-28 13:24:07 -07:00
Toby
3fdcb5b34c Restore mistakenly changed go-cross-build workflow step version 2021-03-28 01:18:22 -07:00
Toby
5a464f928b
Merge pull request #36 from tobyxdd/wip-ng
Code Refactoring & Implementing SOCKS5 UDP with QUIC Unreliable Datagram
2021-03-28 01:07:53 -07:00
Toby
a67e245a87 Update README 2021-03-27 23:31:20 -07:00
Toby
ed5442de15 SOCKS5 UDP ACL 2021-03-27 20:50:08 -07:00
Toby
8530211287 Implement SOCKS5 UDP (ACL not yet integrated) 2021-03-27 18:50:12 -07:00
Toby
4bb5982960 Implemented UDP for both server & client 2021-03-27 16:51:15 -07:00
Toby
01c7d18211 Update to support quic-go v0.20.0 APIs 2021-03-21 15:08:48 -07:00
Toby
b107eae34a password auth 2021-03-02 17:08:39 -08:00
Toby
244d0d43a9 PipePairWithTimeout 2021-03-02 16:25:36 -08:00
Toby
adef8d544c
Merge pull request #35 from honwen/master
ensure static-linked
2021-02-16 16:40:03 -08:00
honwen.chan
dd4cb37dfd ensure static-linked 2021-02-16 23:26:04 +08:00
Toby
565d659338 Relay & better logging 2021-02-05 01:00:44 -08:00
Toby
7d280393a3 Most things work fine now, except:
- UDP support has been temporarily removed, pending upstream QUIC library support for unreliable messages
- SOCKS5 server needs some rework
- Authentication
2021-01-29 00:01:32 -08:00
Toby
d9d07a5b2a use new quic-go mod version 2021-01-26 21:34:49 -08:00
Toby
e626e1224e
Merge pull request #31 from tobyxdd/wip-simplify
Simplify code
2020-10-02 18:24:49 -07:00
Toby
05a34f8f92 Simplify code 2020-10-02 18:23:47 -07:00
Toby
2df70dafca Build with Go 1.15 2020-08-29 16:33:36 -07:00
Toby
354389df8f Add SOCKS5 auth options to README 2020-08-29 16:22:53 -07:00
Toby
b94cf9035d
Merge pull request #29 from tobyxdd/wip-socks5-auth
SOCKS5 username & password auth option
2020-08-29 16:19:57 -07:00
Toby
68ae8fefb7 SOCKS5 username & password auth option 2020-08-29 16:19:02 -07:00
Toby
a7c007b0a3
Merge pull request #28 from tobyxdd/wip-new-quic
TQUIC 3
2020-08-29 16:05:18 -07:00
Toby
becf5893f4 TQUIC 3 2020-08-29 16:03:17 -07:00
Toby
7a93091fb7 Fix option description 2020-08-07 18:48:58 -07:00
Toby
f0fc398ebb Add HTTPS proxy option description to README 2020-08-07 18:47:01 -07:00
Toby
c456079be1 Have to use Dial (not DialContext) to make goproxy happy 2020-08-07 18:40:33 -07:00
Toby
d3ad171761 Disable HTTP auth when no username/password is set 2020-08-07 18:36:13 -07:00
Toby
36cf8e6013
Merge pull request #26 from mritd/feat/https_client
feat(client): support https proxy
2020-08-07 18:24:30 -07:00
mritd
fad7cf0206
feat(client): support https proxy
support https proxy
use the built-in basic auth extension

ref tobyxdd/hysteria#14 tobyxdd/hysteria#15

Signed-off-by: mritd <mritd@linux.com>
2020-08-07 18:11:44 +08:00
Toby
c35adc2d73
Merge pull request #24 from mritd/chore/docker
chore(docker): add dockerfile
2020-08-06 23:47:36 -07:00
Toby
31e317d6ee Fix HTTP auth logging level & add option description to README 2020-08-06 23:40:05 -07:00
Toby
1301039807
Merge pull request #23 from mritd/feat/add-log-timestamp-format
feat(log): add log timestamp format
2020-08-06 23:24:31 -07:00
Toby
30a7032d17
Merge pull request #25 from mritd/feat/http_basic_auth
feat(client): add http basic auth
2020-08-06 23:23:33 -07:00
mritd
ca1f1fdcab
feat(client): add http basic auth
add http basic auth

ref tobyxdd/hysteria#15

Signed-off-by: mritd <mritd@linux.com>
2020-08-07 14:12:01 +08:00
mritd
3614c80080
chore(docker): fix special date format causing build failed
fix special date format causing build failed

Signed-off-by: mritd <mritd@linux.com>
2020-08-07 12:11:38 +08:00
mritd
5d43173673
chore(docker): add dockerfile
add dockerfile

Signed-off-by: mritd <mritd@linux.com>
2020-08-07 11:51:26 +08:00
mritd
87c9ee8d9e
feat(log): add log timestamp format
add log timestamp format

Signed-off-by: mritd <mritd@linux.com>
2020-08-07 10:26:35 +08:00
Toby
7257ce746e Remove redundant action steps 2020-07-12 14:25:30 -07:00
Toby
579275ce08 Use custom go-cross-build action with ldflags support 2020-07-12 14:12:09 -07:00
Toby
9c7d223712 Optimize release workflow & add more platforms 2020-07-12 13:51:55 -07:00
Toby
c0ce9c8ab0
Merge pull request #21 from tobyxdd/wip-log-level
Add log level & format environment variables
2020-07-07 18:39:11 -07:00
Toby
c0270a5c67 Add log level & format environment variables 2020-07-07 18:38:18 -07:00
Toby
7f45cb2ae4
Merge pull request #20 from tobyxdd/wip-logrus
Change the logging system to Logrus
2020-07-06 14:02:57 -07:00
Toby
4bc61cea61 Change the logging system to Logrus 2020-07-06 14:01:45 -07:00
Toby
8b4ed85348
Merge pull request #19 from tobyxdd/wip-disable-udp
Add disable UDP option for both proxy client & server
2020-07-02 17:26:20 -07:00
Toby
59767dfaff Add disable UDP option for both proxy client & server 2020-07-02 17:24:25 -07:00
Toby
55e029f8ad Update quic-go 2020-06-08 15:14:12 -07:00
Toby
d9d119d7ae
Merge pull request #12 from tobyxdd/wip-http
HTTP proxy implementation
2020-05-13 20:46:27 -07:00
Toby
f65e532957 HTTP proxy implementation 2020-05-13 20:43:46 -07:00
Toby
a9f11f826b Replace horrendous chat badge 2020-04-27 14:03:31 -07:00
Toby
4c58b35ee5
Merge pull request #9 from tobyxdd/wip-acl
Client & server side ACL
2020-04-27 13:49:02 -07:00
Toby
2ee4f245a8 Implement server side ACL & an example script 2020-04-27 13:46:11 -07:00
Toby
ea7b596f79 ACL README 2020-04-26 16:42:43 -07:00
Toby
654787cebd Implement client side ACL for SOCKS5 UDP 2020-04-26 15:32:55 -07:00
Toby
5d14a34414 Cache default action too 2020-04-26 15:11:03 -07:00
Toby
127e9e1b6c Implement client side ACL for SOCKS5 TCP 2020-04-26 14:58:50 -07:00
Toby
ee8558f2fb ACL engine & tests 2020-04-25 22:56:49 -07:00
Toby
6cd960ea41 ACL entry 2020-04-25 18:58:27 -07:00
Toby
a722c6cd2e Fix README 2020-04-25 11:22:44 -07:00
Toby
c4c2a4ba28 Fix README.zh.md inconsistency 2020-04-24 22:18:50 -07:00
Toby
61796a4a54 Add missing image 2020-04-24 22:17:45 -07:00
Toby
5434a5e064 Add comparison bench1 2020-04-24 22:17:10 -07:00
Toby
5dcd6a50e9 Fix yml 2020-04-24 20:12:37 -07:00
Toby
0d7132d94a Add linux arm/mipsle build targets for embedded devices 2020-04-24 20:11:37 -07:00
Toby
41cae19aee Update README about SOCKS5 implementation 2020-04-24 20:04:08 -07:00
Toby
be97a593df
Merge pull request #7 from tobyxdd/wip-socks5-udp
SOCKS5 UDP implementation
2020-04-24 19:53:23 -07:00
Toby
e02ede3076 SOCKS5 UDP implementation 2020-04-24 19:47:56 -07:00
Toby
6b5fc2862a Fix README typo 2020-04-23 17:56:40 -07:00
Toby
41148c0219 README.zh.md 2020-04-23 17:52:11 -07:00
Toby
f2f025aff2 README 2020-04-23 17:15:44 -07:00
Toby
c89c584c7f
Merge pull request #6 from tobyxdd/wip-obfs
Obfuscator interface in core & relay/proxy CLI support
2020-04-23 14:45:50 -07:00
Toby
5ebe556d8d Obfuscator interface in core & relay/proxy CLI support 2020-04-23 14:43:12 -07:00
291 changed files with 65150 additions and 2805 deletions

1
.github/FUNDING.yml vendored Normal file
View file

@ -0,0 +1 @@
custom: [ 'https://v2.hysteria.network/docs/Donation/' ]

26
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View file

@ -0,0 +1,26 @@
---
name: Bug report
about: Report anything you think is a bug and needs to be fixed.
title: ''
labels: bug
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior.
**Expected behavior**
A clear and concise description of what you expected to happen.
**Logs**
Attach logs from the client/server when the error occurs.
**Device and Operating System**
What are you using it on.
**Additional context**
Add any other context about the problem here.

26
.github/ISSUE_TEMPLATE/bug_report.zh.md vendored Normal file
View file

@ -0,0 +1,26 @@
---
name: Bug 反馈
about: 反馈任何你认为是 bug 需要修复的问题。
title: ''
labels: bug
assignees: ''
---
**描述问题**
请尽量清晰精准地描述你遇到的问题。
**如何复现**
复现问题的步骤。
**预期行为**
你认为修复后的行为应该是怎样的。
**日志**
附上客户端/服务器端在错误发生前后的日志。
**设备和操作系统**
你在用什么设备和操作系统。
**额外信息**
其他你认为有助于解决问题的信息。

View file

@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project.
title: ''
labels: enhancement
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

View file

@ -0,0 +1,20 @@
---
name: 功能请求
about: 为这个项目提出改进意见。
title: ''
labels: enhancement
assignees: ''
---
**你的功能请求是否与某个问题有关?**
请尽量清晰精准地描述你遇到的问题。例如:我家运营商限制 UDP 协议速度,导致 Hysteria 很慢,希望增加 FakeTCP 支持。
**描述你希望的解决方案**
请尽量清晰精准地描述你希望的解决方案。
**有没有其他替代方案**
请尽量清晰精准地描述你认为可能的替代方案。
**额外信息**
其他你认为有助于开发者了解你需求的信息。

10
.github/dependabot.yml vendored Normal file
View file

@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"

104
.github/workflows/autotag.yaml vendored Normal file
View file

@ -0,0 +1,104 @@
name: "Create release tags for nested modules"
on:
push:
tags:
- app/v*.*.*
permissions:
contents: write
jobs:
tag:
name: "Create tags"
runs-on: ubuntu-latest
steps:
- name: "Extract tagbase"
id: extract_tagbase
uses: actions/github-script@v7
with:
script: |
const ref = context.ref;
core.info(`context.ref: ${ref}`);
const refPrefix = 'refs/tags/app/';
if (!ref.startsWith(refPrefix)) {
core.setFailed(`context.ref does not start with ${refPrefix}: ${ref}`);
return;
}
const tagbase = ref.slice(refPrefix.length);
core.info(`tagbase: ${tagbase}`);
core.setOutput('tagbase', tagbase);
- name: "Tagging core/*"
uses: actions/github-script@v7
env:
INPUT_TAGPREFIX: "core/"
INPUT_TAGBASE: ${{ steps.extract_tagbase.outputs.tagbase }}
with:
script: |
const tagbase = core.getInput('tagbase', { required: true });
const tagprefix = core.getInput('tagprefix', { required: true });
const refname = `tags/${tagprefix}${tagbase}`;
core.info(`creating ref ${refname}`);
try {
await github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `refs/${refname}`,
sha: context.sha
});
core.info(`created ref ${refname}`);
return;
} catch (error) {
core.info(`failed to create ref ${refname}: ${error}`);
}
core.info(`updating ref ${refname}`)
try {
await github.rest.git.updateRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: refname,
sha: context.sha
});
core.info(`updated ref ${refname}`);
return;
} catch (error) {
core.setFailed(`failed to update ref ${refname}: ${error}`);
}
- name: "Tagging extras/*"
uses: actions/github-script@v7
env:
INPUT_TAGPREFIX: "extras/"
INPUT_TAGBASE: ${{ steps.extract_tagbase.outputs.tagbase }}
with:
script: |
const tagbase = core.getInput('tagbase', { required: true });
const tagprefix = core.getInput('tagprefix', { required: true });
const refname = `tags/${tagprefix}${tagbase}`;
core.info(`creating ref ${refname}`);
try {
await github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `refs/${refname}`,
sha: context.sha
});
core.info(`created ref ${refname}`);
return;
} catch (error) {
core.info(`failed to create ref ${refname}: ${error}`);
}
core.info(`updating ref ${refname}`)
try {
await github.rest.git.updateRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: refname,
sha: context.sha
});
core.info(`updated ref ${refname}`);
return;
} catch (error) {
core.setFailed(`failed to update ref ${refname}: ${error}`);
}

44
.github/workflows/docker.yml vendored Normal file
View file

@ -0,0 +1,44 @@
name: "Build Docker Image"
on:
push:
tags:
- app/v*.*.*
jobs:
docker:
runs-on: ubuntu-latest
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
steps:
- name: Check out
uses: actions/checkout@v4
- name: Get version
id: get_version
run: echo "version=$(git describe --tags --always --match 'app/v*' | sed -n 's|app/\([^/-]*\)\(-.*\)\{0,1\}|\1|p')" >> $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: tobyxdd/hysteria:latest,tobyxdd/hysteria:v2,tobyxdd/hysteria:${{ steps.get_version.outputs.version }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}

52
.github/workflows/master.yml vendored Normal file
View file

@ -0,0 +1,52 @@
name: "Build master branch"
on:
push:
branches:
- master
jobs:
build:
name: Build
runs-on: ubuntu-latest
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
steps:
- name: Check out
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.23"
- name: Setup Python # This is for the build script
uses: actions/setup-python@v5
with:
python-version: "3.11"
- uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: r26b
add-to-path: false
- name: Run build script
env:
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
run: |
export HY_APP_PLATFORMS=$(sed 's/\r$//' platforms.txt | awk '!/^#/ && !/^$/' | paste -sd ",")
python hyperbole.py build -r
- name: Generate hashes
run: |
for file in build/*; do
sha256sum $file >> build/hashes.txt
done
- name: Archive
uses: actions/upload-artifact@v4
with:
name: hysteria-master-${{ github.sha }}
path: build

View file

@ -1,61 +1,71 @@
name: Build and release
name: "Build release"
on:
push:
tags:
- 'v*'
- app/v*.*.*
jobs:
build:
name: Build and release
name: Build
runs-on: ubuntu-latest
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
steps:
- name: Set up Go 1.14
uses: actions/setup-go@v1
with:
go-version: 1.14
id: go
- name: Check out
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Get dependencies
run: |
go get -v -t -d ./...
if [ -f Gopkg.toml ]; then
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure
fi
- name: Get version
id: get_version
run: echo "version=$(git describe --tags --always --match 'app/v*' | sed -n 's|app/\([^/-]*\)\(-.*\)\{0,1\}|\1|p')" >> $GITHUB_OUTPUT
- name: Get tag
uses: olegtarasov/get-tag@v2
id: tagName
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.23"
- name: Get time
uses: gerred/actions/current-time@master
id: current-time
- name: Setup Python # This is for the build script
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Build
uses: izumin5210/action-go-crossbuild@v1.0.0
- uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: r26b
add-to-path: false
- name: Run build script
env:
TIME: "${{ steps.current-time.outputs.time }}"
with:
name: hysteria
arch: amd64
dest: ./dist/
ldflags: -w -s -X main.appVersion=${{ env.GIT_TAG_NAME }} -X main.appCommit=${{ github.sha }} -X main.appDate=${{ env.TIME }}
os: windows,linux,darwin
package: ./cmd
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
run: |
export HY_APP_PLATFORMS=$(sed 's/\r$//' platforms.txt | awk '!/^#/ && !/^$/' | paste -sd ",")
python hyperbole.py build -r
- name: Upload
uses: meeDamian/github-release@2.0
- name: Generate hashes
run: |
for file in build/*; do
sha256sum $file >> build/hashes.txt
done
- name: Upload GitHub
uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
gzip: false
allow_override: true
files: >
./dist/hysteria_windows_amd64.zip
./dist/hysteria_linux_amd64.tar.gz
./dist/hysteria_darwin_amd64.zip
files: build/*
- name: Upload CF bucket
uses: shallwefootball/upload-s3-action@v1.3.3
with:
aws_key_id: ${{ secrets.CF_KEY_ID }}
aws_secret_access_key: ${{ secrets.CF_KEY }}
aws_bucket: "hydownload"
endpoint: "https://bea223c61d5a41250d127bd67f51dfec.r2.cloudflarestorage.com/"
source_dir: "build"
destination_dir: "app/${{ steps.get_version.outputs.version }}"
- name: Publish to API
run: |
export HY_API_POST_KEY=${{ secrets.HY2_API_POST_KEY }}
pip install requests
python hyperbole.py publish

29
.github/workflows/scripts.yml vendored Normal file
View file

@ -0,0 +1,29 @@
name: "Publish scripts"
on:
push:
branches:
- master
paths:
- scripts/**
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
deployments: write
name: Publish scripts to Cloudflare Pages
steps:
- name: Check out
uses: actions/checkout@v4
- name: Publish to Cloudflare Pages
uses: cloudflare/pages-action@v1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: hy2scripts
directory: scripts
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
branch: main

332
.gitignore vendored
View file

@ -1,7 +1,10 @@
# Created by https://www.gitignore.io/api/go,linux,macos,windows,intellij+all
# Edit at https://www.gitignore.io/?templates=go,linux,macos,windows,intellij+all
# Created by https://www.toptal.com/developers/gitignore/api/goland+all,intellij+all,go,windows,linux,macos,python,pycharm+all
# Edit at https://www.toptal.com/developers/gitignore?templates=goland+all,intellij+all,go,windows,linux,macos,python,pycharm+all
### Go ###
# If you prefer the allow list template instead of the deny list, see community template:
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
#
# Binaries for programs and plugins
*.exe
*.exe~
@ -18,12 +21,11 @@
# Dependency directories (remove the comment below to include it)
# vendor/
### Go Patch ###
/vendor/
/Godeps/
# Go workspace file
go.work
### Intellij+all ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
### GoLand+all ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
@ -33,6 +35,9 @@
.idea/**/dictionaries
.idea/**/shelf
# AWS User-specific
.idea/**/aws.xml
# Generated files
.idea/**/contentModel.xml
@ -53,6 +58,9 @@
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
@ -80,6 +88,9 @@ atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# SonarLint plugin
.idea/sonarlint/
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
@ -92,21 +103,69 @@ fabric.properties
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
### GoLand+all Patch ###
# Ignore everything but code style settings and run configurations
# that are supposed to be shared within teams.
.idea/*
!.idea/codeStyles
!.idea/runConfigurations
### Intellij+all ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
# AWS User-specific
# Generated files
# Sensitive or high-churn files
# Gradle
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr
# CMake
# Mongo Explorer plugin
# File-based project format
# IntelliJ
# mpeltonen/sbt-idea plugin
# JIRA plugin
# Cursive Clojure plugin
# SonarLint plugin
# Crashlytics plugin (for Android Studio and IntelliJ)
# Editor-based Rest Client
# Android studio 3.1+ serialized cache file
### Intellij+all Patch ###
# Ignores the whole .idea folder and all .iml files
# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360
# Ignore everything but code style settings and run configurations
# that are supposed to be shared within teams.
.idea/
# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023
*.iml
modules.xml
.idea/misc.xml
*.ipr
# Sonarlint plugin
.idea/sonarlint
### Linux ###
*~
@ -132,6 +191,7 @@ modules.xml
# Icon must end with two \r
Icon
# Thumbnails
._*
@ -151,6 +211,236 @@ Network Trash Folder
Temporary Items
.apdisk
### macOS Patch ###
# iCloud generated files
*.icloud
### PyCharm+all ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
# AWS User-specific
# Generated files
# Sensitive or high-churn files
# Gradle
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr
# CMake
# Mongo Explorer plugin
# File-based project format
# IntelliJ
# mpeltonen/sbt-idea plugin
# JIRA plugin
# Cursive Clojure plugin
# SonarLint plugin
# Crashlytics plugin (for Android Studio and IntelliJ)
# Editor-based Rest Client
# Android studio 3.1+ serialized cache file
### PyCharm+all Patch ###
# Ignore everything but code style settings and run configurations
# that are supposed to be shared within teams.
### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock
# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/
# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
### Python Patch ###
# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
poetry.toml
# ruff
.ruff_cache/
# LSP config files
pyrightconfig.json
### Windows ###
# Windows thumbnail cache files
Thumbs.db
@ -177,6 +467,4 @@ $RECYCLE.BIN/
# Windows shortcuts
*.lnk
# End of https://www.gitignore.io/api/go,linux,macos,windows,intellij+all
cmd/relay/*.json
# End of https://www.toptal.com/developers/gitignore/api/goland+all,intellij+all,go,windows,linux,macos,python,pycharm+all

3
CHANGELOG.md Normal file
View file

@ -0,0 +1,3 @@
# Changelog
https://v2.hysteria.network/docs/Changelog/

39
Dockerfile Normal file
View file

@ -0,0 +1,39 @@
FROM golang:1-alpine AS builder
# GOPROXY is disabled by default, use:
# docker build --build-arg GOPROXY="https://goproxy.io" ...
# to enable GOPROXY.
ARG GOPROXY=""
ENV GOPROXY ${GOPROXY}
COPY . /go/src/github.com/apernet/hysteria
WORKDIR /go/src/github.com/apernet/hysteria
RUN set -ex \
&& apk add git build-base bash python3 \
&& python hyperbole.py build -r \
&& mv ./build/hysteria-* /go/bin/hysteria
# multi-stage builds to create the final image
FROM alpine AS dist
# set up nsswitch.conf for Go's "netgo" implementation
# - https://github.com/golang/go/blob/go1.9.1/src/net/conf.go#L194-L275
# - docker run --rm debian:stretch grep '^hosts:' /etc/nsswitch.conf
RUN if [ ! -e /etc/nsswitch.conf ]; then echo 'hosts: files dns' > /etc/nsswitch.conf; fi
# bash is used for debugging, tzdata is used to add timezone information.
# Install ca-certificates to ensure no CA certificate errors.
#
# Do not try to add the "--no-cache" option when there are multiple "apk"
# commands, this will cause the build process to become very slow.
RUN set -ex \
&& apk upgrade \
&& apk add bash tzdata ca-certificates \
&& rm -rf /var/cache/apk/*
COPY --from=builder /go/bin/hysteria /usr/local/bin/hysteria
ENTRYPOINT ["hysteria"]

View file

@ -1,21 +1,7 @@
The MIT License (MIT)
Copyright 2023 Toby
Copyright (c) 2020 Toby
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

153
PROTOCOL.md Normal file
View file

@ -0,0 +1,153 @@
# Hysteria 2 Protocol Specification
Hysteria is a TCP & UDP proxy based on QUIC, designed for speed, security and censorship resistance. This document describes the protocol used by Hysteria starting with version 2.0.0, sometimes internally referred to as the "v4" protocol. From here on, we will call it "the protocol" or "the Hysteria protocol".
## Requirements Language
The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC 2119](https://tools.ietf.org/html/rfc2119).
## Underlying Protocol & Wire Format
The Hysteria protocol MUST be implemented on top of the standard QUIC transport protocol [RFC 9000](https://datatracker.ietf.org/doc/html/rfc9000) with [Unreliable Datagram Extension](https://datatracker.ietf.org/doc/rfc9221/).
All multibyte numbers use Big Endian format.
All variable-length integers ("varints") are encoded/decoded as defined in QUIC (RFC 9000).
## Authentication & HTTP/3 masquerading
One of the key features of the Hysteria protocol is that to a third party without proper authentication credentials (whether it's a middleman or an active prober), a Hysteria proxy server behaves just like a standard HTTP/3 web server. Additionally, the encrypted traffic between the client and the server appears indistinguishable from normal HTTP/3 traffic.
Therefore, a Hysteria server MUST implement an HTTP/3 server (as defined by [RFC 9114](https://datatracker.ietf.org/doc/rfc9114/)) and handle HTTP requests as any standard web server would. To prevent active probers from detecting common response patterns in Hysteria servers, implementations SHOULD advise users to either host actual content or set it up as a reverse proxy for other sites.
An actual Hysteria client, upon connection, MUST send the following HTTP/3 request to the server:
```
:method: POST
:path: /auth
:host: hysteria
Hysteria-Auth: [string]
Hysteria-CC-RX: [uint]
Hysteria-Padding: [string]
```
`Hysteria-Auth`: Authentication credentials.
`Hysteria-CC-RX`: Client's maximum receive rate in bytes per second. A value of 0 indicates unknown.
`Hysteria-Padding`: A random padding string of variable length.
The Hysteria server MUST identify this special request, and, instead of attempting to serve content or forwarding it to an upstream site, it MUST authenticate the client using the provided information. If authentication is successful, the server MUST send the following response (HTTP status code 233):
```
:status: 233 HyOK
Hysteria-UDP: [true/false]
Hysteria-CC-RX: [uint/"auto"]
Hysteria-Padding: [string]
```
`Hysteria-UDP`: Whether the server supports UDP relay.
`Hysteria-CC-RX`: Server's maximum receive rate in bytes per second. A value of 0 indicates unlimited; "auto" indicates the server refuses to provide a value and ask the client to use congestion control to determine the rate on its own.
`Hysteria-Padding`: A random padding string of variable length.
See the Congestion Control section for more information on how to use the `Hysteria-CC-RX` values.
`Hysteria-Padding` is optional and is only intended to obfuscate the request/response pattern. It SHOULD be ignored by both sides.
If authentication fails, the server MUST either act like a standard web server that does not understand the request, or in the case of being a reverse proxy, forward the request to the upstream site and return the response to the client.
The client MUST check the status code to determine if the authentication was successful. If the status code is anything other than 233, the client MUST consider authentication to have failed and disconnect from the server.
After (and only after) a client passes authentication, the server MUST consider this QUIC connection to be a Hysteria proxy connection. It MUST then start processing proxy requests from the client as described in the next section.
## Proxy Requests
### TCP
For each TCP connection, the client MUST create a new QUIC bidirectional stream and send the following TCPRequest message:
```
[varint] 0x401 (TCPRequest ID)
[varint] Address length
[bytes] Address string (host:port)
[varint] Padding length
[bytes] Random padding
```
The server MUST respond with a TCPResponse message:
```
[uint8] Status (0x00 = OK, 0x01 = Error)
[varint] Message length
[bytes] Message string
[varint] Padding length
[bytes] Random padding
```
If the status is OK, the server MUST then begin forwarding data between the client and the specified TCP address until either side closes the connection. If the status is Error, the server MUST close the QUIC stream.
### UDP
UDP packets MUST be encapsulated in the following UDPMessage format and sent over QUIC's unreliable datagram (for both client-to-server and server-to-client):
```
[uint32] Session ID
[uint16] Packet ID
[uint8] Fragment ID
[uint8] Fragment count
[varint] Address length
[bytes] Address string (host:port)
[bytes] Payload
```
The client MUST use a unique Session ID for each UDP session. The server SHOULD assign a unique UDP port to each Session ID, unless it has another mechanism to differentiate packets from different sessions (e.g., symmetric NAT, varying outbound IP addresses, etc.).
The protocol does not provide an explicit way to close a UDP session. While a client can retain and reuse a Session ID indefinitely, the server SHOULD release and reassign the port associated with the Session ID after a period of inactivity or some other criteria. If the client sends a UDP packet to a Session ID that is no longer recognized by the server, the server MUST treat it as a new session and assign a new port.
If a server does not support UDP relay, it SHOULD silently discard all UDP messages received from the client.
#### Fragmentation
Due to the limit imposed by QUIC's unreliable datagram channel, any UDP packet that exceeds QUIC's maximum datagram size MUST either be fragmented or discarded.
For fragmented packets, each fragment MUST carry the same unique Packet ID. The Fragment ID, starting from 0, indicates the index out of the total Fragment Count. Both the server and client MUST wait for all fragments of a fragmented packet to arrive before processing them. If one or more fragments of a packet are lost, the entire packet MUST be discarded.
For packets that are not fragmented, the Fragment Count MUST be set to 1. In this case, the values of Packet ID and Fragment ID are irrelevant.
## Congestion Control
A unique feature of Hysteria is the ability to set the tx/rx (upload/download) rate on the client side. During authentication, the client sends its rx rate to the server via the `Hysteria-CC-RX` header. The server can use this to determine its transmission rate to the client, and vice versa by returning its rx rate to the client through the same header.
Three special cases are:
- If the client sends 0, it doesn't know its own rx rate. The server MUST use a congestion control algorithm (e.g., BBR, Cubic) to adjust its transmission rate.
- If the server responds with 0, it has no bandwidth limit. The client MAY transmit at any rate it wants.
- If the server responds with "auto", it chooses not to specify a rate. The client MUST use a congestion control algorithm to adjust its transmission rate.
## "Salamander" Obfuscation
The Hysteria protocol supports an optional obfuscation layer codenamed "Salamander".
"Salamander" encapsulates all QUIC packets in the following format:
```
[8 bytes] Salt
[bytes] Payload
```
For each QUIC packet, the obfuscator MUST calculate the BLAKE2b-256 hash of a randomly generated 8-byte salt appended to a user-provided pre-shared key.
```
hash = BLAKE2b-256(key + salt)
```
The hash is then used to obfuscate the payload using the following algorithm:
```
for i in range(0, len(payload)):
payload[i] ^= hash[i % 32]
```
The deobfuscator MUST use the same algorithms to calculate the salted hash and deobfuscate the payload. Any invalid packet MUST be discarded.

View file

@ -1,8 +1,60 @@
![Logo](docs/logos/readme.png)
# ![Hysteria 2](logo.svg)
[![License][1]][2] [![Telegram][3]][4]
[![License][1]][2] [![Release][3]][4] [![Telegram][5]][6] [![Discussions][7]][8]
[1]: https://img.shields.io/github/license/tobyxdd/hysteria?style=flat-square&
[1]: https://img.shields.io/badge/license-MIT-blue
[2]: LICENSE.md
[3]: https://patrolavia.github.io/telegram-badge/chat.png
[4]: https://t.me/hysteria_github
[3]: https://img.shields.io/github/v/release/apernet/hysteria?style=flat-square
[4]: https://github.com/apernet/hysteria/releases
[5]: https://img.shields.io/badge/chat-Telegram-blue?style=flat-square
[6]: https://t.me/hysteria_github
[7]: https://img.shields.io/github/discussions/apernet/hysteria?style=flat-square
[8]: https://github.com/apernet/hysteria/discussions
<h2 style="text-align: center;">Hysteria is a powerful, lightning fast and censorship resistant proxy.</h2>
### [Get Started](https://v2.hysteria.network/)
### [中文文档](https://v2.hysteria.network/zh/)
### [Hysteria 1.x (legacy)](https://v1.hysteria.network/)
---
<div class="feature-grid">
<div>
<h3>🛠️ Jack of all trades</h3>
<p>Wide range of modes including SOCKS5, HTTP Proxy, TCP/UDP Forwarding, Linux TProxy, TUN - with more features being added constantly.</p>
</div>
<div>
<h3>⚡ Blazing fast</h3>
<p>Powered by a customized QUIC protocol, Hysteria is designed to deliver unparalleled performance over unreliable and lossy networks.</p>
</div>
<div>
<h3>✊ Censorship resistant</h3>
<p>The protocol masquerades as standard HTTP/3 traffic, making it very difficult for censors to detect and block without widespread collateral damage.</p>
</div>
<div>
<h3>💻 Cross-platform</h3>
<p>We have builds for every major platform and architecture. Deploy anywhere & use everywhere. Not to mention the long list of 3rd party apps.</p>
</div>
<div>
<h3>🔗 Easy integration</h3>
<p>With built-in support for custom authentication, traffic statistics & access control, Hysteria is easy to integrate into your infrastructure.</p>
</div>
<div>
<h3>🤗 Chill and supportive</h3>
<p>We have well-documented specifications and code for developers to contribute and/or build their own apps. And a helpful community, too.</p>
</div>
</div>
---
**If you find Hysteria useful, consider giving it a ⭐️!**
[![Star History Chart](https://api.star-history.com/svg?repos=apernet/hysteria&type=Date)](https://star-history.com/#apernet/hysteria&Date)

7
app/LICENSE.md Normal file
View file

@ -0,0 +1,7 @@
Copyright 2023 Toby
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

1031
app/cmd/client.go Normal file

File diff suppressed because it is too large Load diff

204
app/cmd/client_test.go Normal file
View file

@ -0,0 +1,204 @@
package cmd
import (
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/spf13/viper"
)
// TestClientConfig tests the parsing of the client config
func TestClientConfig(t *testing.T) {
viper.SetConfigFile("client_test.yaml")
err := viper.ReadInConfig()
assert.NoError(t, err)
var config clientConfig
err = viper.Unmarshal(&config)
assert.NoError(t, err)
assert.Equal(t, config, clientConfig{
Server: "example.com",
Auth: "weak_ahh_password",
Transport: clientConfigTransport{
Type: "udp",
UDP: clientConfigTransportUDP{
HopInterval: 30 * time.Second,
},
},
Obfs: clientConfigObfs{
Type: "salamander",
Salamander: clientConfigObfsSalamander{
Password: "cry_me_a_r1ver",
},
},
TLS: clientConfigTLS{
SNI: "another.example.com",
Insecure: true,
PinSHA256: "114515DEADBEEF",
CA: "custom_ca.crt",
},
QUIC: clientConfigQUIC{
InitStreamReceiveWindow: 1145141,
MaxStreamReceiveWindow: 1145142,
InitConnectionReceiveWindow: 1145143,
MaxConnectionReceiveWindow: 1145144,
MaxIdleTimeout: 10 * time.Second,
KeepAlivePeriod: 4 * time.Second,
DisablePathMTUDiscovery: true,
Sockopts: clientConfigQUICSockopts{
BindInterface: stringRef("eth0"),
FirewallMark: uint32Ref(1234),
FdControlUnixSocket: stringRef("test.sock"),
},
},
Bandwidth: clientConfigBandwidth{
Up: "200 mbps",
Down: "1 gbps",
},
FastOpen: true,
Lazy: true,
SOCKS5: &socks5Config{
Listen: "127.0.0.1:1080",
Username: "anon",
Password: "bro",
DisableUDP: true,
},
HTTP: &httpConfig{
Listen: "127.0.0.1:8080",
Username: "qqq",
Password: "bruh",
Realm: "martian",
},
TCPForwarding: []tcpForwardingEntry{
{
Listen: "127.0.0.1:8088",
Remote: "internal.example.com:80",
},
},
UDPForwarding: []udpForwardingEntry{
{
Listen: "127.0.0.1:5353",
Remote: "internal.example.com:53",
Timeout: 50 * time.Second,
},
},
TCPTProxy: &tcpTProxyConfig{
Listen: "127.0.0.1:2500",
},
UDPTProxy: &udpTProxyConfig{
Listen: "127.0.0.1:2501",
Timeout: 20 * time.Second,
},
TCPRedirect: &tcpRedirectConfig{
Listen: "127.0.0.1:3500",
},
TUN: &tunConfig{
Name: "hytun",
MTU: 1500,
Timeout: 60 * time.Second,
Address: struct {
IPv4 string `mapstructure:"ipv4"`
IPv6 string `mapstructure:"ipv6"`
}{IPv4: "100.100.100.101/30", IPv6: "2001::ffff:ffff:ffff:fff1/126"},
Route: &struct {
Strict bool `mapstructure:"strict"`
IPv4 []string `mapstructure:"ipv4"`
IPv6 []string `mapstructure:"ipv6"`
IPv4Exclude []string `mapstructure:"ipv4Exclude"`
IPv6Exclude []string `mapstructure:"ipv6Exclude"`
}{
Strict: true,
IPv4: []string{"0.0.0.0/0"},
IPv6: []string{"2000::/3"},
IPv4Exclude: []string{"192.0.2.1/32"},
IPv6Exclude: []string{"2001:db8::1/128"},
},
},
})
}
// TestClientConfigURI tests URI-related functions of clientConfig
func TestClientConfigURI(t *testing.T) {
tests := []struct {
uri string
uriOK bool
config *clientConfig
}{
{
uri: "hysteria2://god@zilla.jp/",
uriOK: true,
config: &clientConfig{
Server: "zilla.jp",
Auth: "god",
},
},
{
uri: "hysteria2://john:wick@continental.org:4443/",
uriOK: true,
config: &clientConfig{
Server: "continental.org:4443",
Auth: "john:wick",
},
},
{
uri: "hysteria2://saul@better.call:7000-10000,20000/",
uriOK: true,
config: &clientConfig{
Server: "better.call:7000-10000,20000",
Auth: "saul",
},
},
{
uri: "hysteria2://noauth.com/?insecure=1&obfs=salamander&obfs-password=66ccff&pinSHA256=deadbeef&sni=crap.cc",
uriOK: true,
config: &clientConfig{
Server: "noauth.com",
Auth: "",
Obfs: clientConfigObfs{
Type: "salamander",
Salamander: clientConfigObfsSalamander{
Password: "66ccff",
},
},
TLS: clientConfigTLS{
SNI: "crap.cc",
Insecure: true,
PinSHA256: "deadbeef",
},
},
},
{
uri: "invalid.bs",
uriOK: false,
config: nil,
},
{
uri: "https://www.google.com/search?q=test",
uriOK: false,
config: nil,
},
}
for _, test := range tests {
t.Run(test.uri, func(t *testing.T) {
// Test parseURI
nc := &clientConfig{Server: test.uri}
assert.Equal(t, nc.parseURI(), test.uriOK)
if test.uriOK {
assert.Equal(t, nc, test.config)
}
// Test URI generation
if test.config != nil {
assert.Equal(t, test.config.URI(), test.uri)
}
})
}
}
func stringRef(s string) *string {
return &s
}
func uint32Ref(i uint32) *uint32 {
return &i
}

85
app/cmd/client_test.yaml Normal file
View file

@ -0,0 +1,85 @@
server: example.com
auth: weak_ahh_password
transport:
type: udp
udp:
hopInterval: 30s
obfs:
type: salamander
salamander:
password: cry_me_a_r1ver
tls:
sni: another.example.com
insecure: true
pinSHA256: 114515DEADBEEF
ca: custom_ca.crt
quic:
initStreamReceiveWindow: 1145141
maxStreamReceiveWindow: 1145142
initConnReceiveWindow: 1145143
maxConnReceiveWindow: 1145144
maxIdleTimeout: 10s
keepAlivePeriod: 4s
disablePathMTUDiscovery: true
sockopts:
bindInterface: eth0
fwmark: 1234
fdControlUnixSocket: test.sock
bandwidth:
up: 200 mbps
down: 1 gbps
fastOpen: true
lazy: true
socks5:
listen: 127.0.0.1:1080
username: anon
password: bro
disableUDP: true
http:
listen: 127.0.0.1:8080
username: qqq
password: bruh
realm: martian
tcpForwarding:
- listen: 127.0.0.1:8088
remote: internal.example.com:80
udpForwarding:
- listen: 127.0.0.1:5353
remote: internal.example.com:53
timeout: 50s
tcpTProxy:
listen: 127.0.0.1:2500
udpTProxy:
listen: 127.0.0.1:2501
timeout: 20s
tcpRedirect:
listen: 127.0.0.1:3500
tun:
name: "hytun"
mtu: 1500
timeout: 1m
address:
ipv4: 100.100.100.101/30
ipv6: 2001::ffff:ffff:ffff:fff1/126
route:
strict: true
ipv4: [ 0.0.0.0/0 ]
ipv6: [ "2000::/3" ]
ipv4Exclude: [ 192.0.2.1/32 ]
ipv6Exclude: [ "2001:db8::1/128" ]

18
app/cmd/errors.go Normal file
View file

@ -0,0 +1,18 @@
package cmd
import (
"fmt"
)
type configError struct {
Field string
Err error
}
func (e configError) Error() string {
return fmt.Sprintf("invalid config: %s: %s", e.Field, e.Err)
}
func (e configError) Unwrap() error {
return e.Err
}

63
app/cmd/ping.go Normal file
View file

@ -0,0 +1,63 @@
package cmd
import (
"time"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"go.uber.org/zap"
"github.com/apernet/hysteria/core/v2/client"
)
// pingCmd represents the ping command
var pingCmd = &cobra.Command{
Use: "ping address",
Short: "Ping mode",
Long: "Perform a TCP ping to a specified remote address through the proxy server. Can be used as a simple connectivity test.",
Run: runPing,
}
func init() {
rootCmd.AddCommand(pingCmd)
}
func runPing(cmd *cobra.Command, args []string) {
logger.Info("ping mode")
if len(args) != 1 {
logger.Fatal("must specify one and only one address")
}
addr := args[0]
if err := viper.ReadInConfig(); err != nil {
logger.Fatal("failed to read client config", zap.Error(err))
}
var config clientConfig
if err := viper.Unmarshal(&config); err != nil {
logger.Fatal("failed to parse client config", zap.Error(err))
}
hyConfig, err := config.Config()
if err != nil {
logger.Fatal("failed to load client config", zap.Error(err))
}
c, info, err := client.NewClient(hyConfig)
if err != nil {
logger.Fatal("failed to initialize client", zap.Error(err))
}
defer c.Close()
logger.Info("connected to server",
zap.Bool("udpEnabled", info.UDPEnabled),
zap.Uint64("tx", info.Tx))
logger.Info("connecting", zap.String("addr", addr))
start := time.Now()
conn, err := c.TCP(addr)
if err != nil {
logger.Fatal("failed to connect", zap.Error(err), zap.String("time", time.Since(start).String()))
}
defer conn.Close()
logger.Info("connected", zap.String("time", time.Since(start).String()))
}

176
app/cmd/root.go Normal file
View file

@ -0,0 +1,176 @@
package cmd
import (
"fmt"
"os"
"strconv"
"strings"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
)
const (
appLogo = `
`
appDesc = "a powerful, lightning fast and censorship resistant proxy"
appAuthors = "Aperture Internet Laboratory <https://github.com/apernet>"
appLogLevelEnv = "HYSTERIA_LOG_LEVEL"
appLogFormatEnv = "HYSTERIA_LOG_FORMAT"
appDisableUpdateCheckEnv = "HYSTERIA_DISABLE_UPDATE_CHECK"
appACMEDirEnv = "HYSTERIA_ACME_DIR"
)
var (
// These values will be injected by the build system
appVersion = "Unknown"
appDate = "Unknown"
appType = "Unknown" // aka channel
appToolchain = "Unknown"
appCommit = "Unknown"
appPlatform = "Unknown"
appArch = "Unknown"
libVersion = "Unknown"
appVersionLong = fmt.Sprintf("Version:\t%s\n"+
"BuildDate:\t%s\n"+
"BuildType:\t%s\n"+
"Toolchain:\t%s\n"+
"CommitHash:\t%s\n"+
"Platform:\t%s\n"+
"Architecture:\t%s\n"+
"Libraries:\tquic-go=%s",
appVersion, appDate, appType, appToolchain, appCommit, appPlatform, appArch, libVersion)
appAboutLong = fmt.Sprintf("%s\n%s\n%s\n\n%s", appLogo, appDesc, appAuthors, appVersionLong)
)
var logger *zap.Logger
// Flags
var (
cfgFile string
logLevel string
logFormat string
disableUpdateCheck bool
)
var rootCmd = &cobra.Command{
Use: "hysteria",
Short: appDesc,
Long: appAboutLong,
Run: runClient, // Default to client mode
}
var logLevelMap = map[string]zapcore.Level{
"debug": zapcore.DebugLevel,
"info": zapcore.InfoLevel,
"warn": zapcore.WarnLevel,
"error": zapcore.ErrorLevel,
}
var logFormatMap = map[string]zapcore.EncoderConfig{
"console": {
TimeKey: "time",
LevelKey: "level",
NameKey: "logger",
MessageKey: "msg",
LineEnding: zapcore.DefaultLineEnding,
EncodeLevel: zapcore.CapitalColorLevelEncoder,
EncodeTime: zapcore.RFC3339TimeEncoder,
EncodeDuration: zapcore.SecondsDurationEncoder,
},
"json": {
TimeKey: "time",
LevelKey: "level",
NameKey: "logger",
MessageKey: "msg",
LineEnding: zapcore.DefaultLineEnding,
EncodeLevel: zapcore.LowercaseLevelEncoder,
EncodeTime: zapcore.EpochMillisTimeEncoder,
EncodeDuration: zapcore.SecondsDurationEncoder,
},
}
func Execute() {
err := rootCmd.Execute()
if err != nil {
os.Exit(1)
}
}
func init() {
initFlags()
cobra.MousetrapHelpText = "" // Disable the mousetrap so Windows users can run the exe directly by double-clicking
cobra.OnInitialize(initConfig)
cobra.OnInitialize(initLogger) // initLogger must come after initConfig as it depends on config
}
func initFlags() {
rootCmd.PersistentFlags().StringVarP(&cfgFile, "config", "c", "", "config file")
rootCmd.PersistentFlags().StringVarP(&logLevel, "log-level", "l", envOrDefaultString(appLogLevelEnv, "info"), "log level")
rootCmd.PersistentFlags().StringVarP(&logFormat, "log-format", "f", envOrDefaultString(appLogFormatEnv, "console"), "log format")
rootCmd.PersistentFlags().BoolVar(&disableUpdateCheck, "disable-update-check", envOrDefaultBool(appDisableUpdateCheckEnv, false), "disable update check")
}
func initConfig() {
if cfgFile != "" {
viper.SetConfigFile(cfgFile)
} else {
viper.SetConfigName("config")
viper.SetConfigType("yaml")
viper.SupportedExts = append([]string{"yaml", "yml"}, viper.SupportedExts...)
viper.AddConfigPath(".")
viper.AddConfigPath("$HOME/.hysteria")
viper.AddConfigPath("/etc/hysteria/")
}
}
func initLogger() {
level, ok := logLevelMap[strings.ToLower(logLevel)]
if !ok {
fmt.Printf("unsupported log level: %s\n", logLevel)
os.Exit(1)
}
enc, ok := logFormatMap[strings.ToLower(logFormat)]
if !ok {
fmt.Printf("unsupported log format: %s\n", logFormat)
os.Exit(1)
}
c := zap.Config{
Level: zap.NewAtomicLevelAt(level),
DisableCaller: true,
DisableStacktrace: true,
Encoding: strings.ToLower(logFormat),
EncoderConfig: enc,
OutputPaths: []string{"stderr"},
ErrorOutputPaths: []string{"stderr"},
}
var err error
logger, err = c.Build()
if err != nil {
fmt.Printf("failed to initialize logger: %s\n", err)
os.Exit(1)
}
}
func envOrDefaultString(key, def string) string {
if v := os.Getenv(key); v != "" {
return v
}
return def
}
func envOrDefaultBool(key string, def bool) bool {
if v := os.Getenv(key); v != "" {
b, _ := strconv.ParseBool(v)
return b
}
return def
}

1051
app/cmd/server.go Normal file

File diff suppressed because it is too large Load diff

189
app/cmd/server_test.go Normal file
View file

@ -0,0 +1,189 @@
package cmd
import (
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/spf13/viper"
)
// TestServerConfig tests the parsing of the server config
func TestServerConfig(t *testing.T) {
viper.SetConfigFile("server_test.yaml")
err := viper.ReadInConfig()
assert.NoError(t, err)
var config serverConfig
err = viper.Unmarshal(&config)
assert.NoError(t, err)
assert.Equal(t, config, serverConfig{
Listen: ":8443",
Obfs: serverConfigObfs{
Type: "salamander",
Salamander: serverConfigObfsSalamander{
Password: "cry_me_a_r1ver",
},
},
TLS: &serverConfigTLS{
Cert: "some.crt",
Key: "some.key",
SNIGuard: "strict",
},
ACME: &serverConfigACME{
Domains: []string{
"sub1.example.com",
"sub2.example.com",
},
Email: "haha@cringe.net",
CA: "zero",
ListenHost: "127.0.0.9",
Dir: "random_dir",
Type: "dns",
HTTP: serverConfigACMEHTTP{
AltPort: 8888,
},
TLS: serverConfigACMETLS{
AltPort: 44333,
},
DNS: serverConfigACMEDNS{
Name: "gomommy",
Config: map[string]string{
"key1": "value1",
"key2": "value2",
},
},
DisableHTTP: true,
DisableTLSALPN: true,
AltHTTPPort: 8080,
AltTLSALPNPort: 4433,
},
QUIC: serverConfigQUIC{
InitStreamReceiveWindow: 77881,
MaxStreamReceiveWindow: 77882,
InitConnectionReceiveWindow: 77883,
MaxConnectionReceiveWindow: 77884,
MaxIdleTimeout: 999 * time.Second,
MaxIncomingStreams: 256,
DisablePathMTUDiscovery: true,
},
Bandwidth: serverConfigBandwidth{
Up: "500 mbps",
Down: "100 mbps",
},
IgnoreClientBandwidth: true,
SpeedTest: true,
DisableUDP: true,
UDPIdleTimeout: 120 * time.Second,
Auth: serverConfigAuth{
Type: "password",
Password: "goofy_ahh_password",
UserPass: map[string]string{
"yolo": "swag",
"lol": "kek",
"foo": "bar",
},
HTTP: serverConfigAuthHTTP{
URL: "http://127.0.0.1:5000/auth",
Insecure: true,
},
Command: "/etc/some_command",
},
Resolver: serverConfigResolver{
Type: "udp",
TCP: serverConfigResolverTCP{
Addr: "123.123.123.123:5353",
Timeout: 4 * time.Second,
},
UDP: serverConfigResolverUDP{
Addr: "4.6.8.0:53",
Timeout: 2 * time.Second,
},
TLS: serverConfigResolverTLS{
Addr: "dot.yolo.com:8853",
Timeout: 10 * time.Second,
SNI: "server1.yolo.net",
Insecure: true,
},
HTTPS: serverConfigResolverHTTPS{
Addr: "cringe.ahh.cc",
Timeout: 5 * time.Second,
SNI: "real.stuff.net",
Insecure: true,
},
},
Sniff: serverConfigSniff{
Enable: true,
Timeout: 1 * time.Second,
RewriteDomain: true,
TCPPorts: "80,443,1000-2000",
UDPPorts: "443",
},
ACL: serverConfigACL{
File: "chnroute.txt",
Inline: []string{
"lmao(ok)",
"kek(cringe,boba,tea)",
},
GeoIP: "some.dat",
GeoSite: "some_site.dat",
GeoUpdateInterval: 168 * time.Hour,
},
Outbounds: []serverConfigOutboundEntry{
{
Name: "goodstuff",
Type: "direct",
Direct: serverConfigOutboundDirect{
Mode: "64",
BindIPv4: "2.4.6.8",
BindIPv6: "0:0:0:0:0:ffff:0204:0608",
BindDevice: "eth233",
FastOpen: true,
},
},
{
Name: "badstuff",
Type: "socks5",
SOCKS5: serverConfigOutboundSOCKS5{
Addr: "shady.proxy.ru:1080",
Username: "hackerman",
Password: "Elliot Alderson",
},
},
{
Name: "weirdstuff",
Type: "http",
HTTP: serverConfigOutboundHTTP{
URL: "https://eyy.lmao:4443/goofy",
Insecure: true,
},
},
},
TrafficStats: serverConfigTrafficStats{
Listen: ":9999",
Secret: "its_me_mario",
},
Masquerade: serverConfigMasquerade{
Type: "proxy",
File: serverConfigMasqueradeFile{
Dir: "/www/masq",
},
Proxy: serverConfigMasqueradeProxy{
URL: "https://some.site.net",
RewriteHost: true,
Insecure: true,
},
String: serverConfigMasqueradeString{
Content: "aint nothin here",
Headers: map[string]string{
"content-type": "text/plain",
"custom-haha": "lol",
},
StatusCode: 418,
},
ListenHTTP: ":80",
ListenHTTPS: ":443",
ForceHTTPS: true,
},
})
}

144
app/cmd/server_test.yaml Normal file
View file

@ -0,0 +1,144 @@
listen: :8443
obfs:
type: salamander
salamander:
password: cry_me_a_r1ver
tls:
cert: some.crt
key: some.key
sniGuard: strict
acme:
domains:
- sub1.example.com
- sub2.example.com
email: haha@cringe.net
ca: zero
listenHost: 127.0.0.9
dir: random_dir
type: dns
http:
altPort: 8888
tls:
altPort: 44333
dns:
name: gomommy
config:
key1: value1
key2: value2
disableHTTP: true
disableTLSALPN: true
altHTTPPort: 8080
altTLSALPNPort: 4433
quic:
initStreamReceiveWindow: 77881
maxStreamReceiveWindow: 77882
initConnReceiveWindow: 77883
maxConnReceiveWindow: 77884
maxIdleTimeout: 999s
maxIncomingStreams: 256
disablePathMTUDiscovery: true
bandwidth:
up: 500 mbps
down: 100 mbps
ignoreClientBandwidth: true
speedTest: true
disableUDP: true
udpIdleTimeout: 120s
auth:
type: password
password: goofy_ahh_password
userpass:
yolo: swag
lol: kek
foo: bar
http:
url: http://127.0.0.1:5000/auth
insecure: true
command: /etc/some_command
resolver:
type: udp
tcp:
addr: 123.123.123.123:5353
timeout: 4s
udp:
addr: 4.6.8.0:53
timeout: 2s
tls:
addr: dot.yolo.com:8853
timeout: 10s
sni: server1.yolo.net
insecure: true
https:
addr: cringe.ahh.cc
timeout: 5s
sni: real.stuff.net
insecure: true
sniff:
enable: true
timeout: 1s
rewriteDomain: true
tcpPorts: 80,443,1000-2000
udpPorts: 443
acl:
file: chnroute.txt
inline:
- lmao(ok)
- kek(cringe,boba,tea)
geoip: some.dat
geosite: some_site.dat
geoUpdateInterval: 168h
outbounds:
- name: goodstuff
type: direct
direct:
mode: 64
bindIPv4: 2.4.6.8
bindIPv6: 0:0:0:0:0:ffff:0204:0608
bindDevice: eth233
fastOpen: true
- name: badstuff
type: socks5
socks5:
addr: shady.proxy.ru:1080
username: hackerman
password: Elliot Alderson
- name: weirdstuff
type: http
http:
url: https://eyy.lmao:4443/goofy
insecure: true
trafficStats:
listen: :9999
secret: its_me_mario
masquerade:
type: proxy
file:
dir: /www/masq
proxy:
url: https://some.site.net
rewriteHost: true
insecure: true
string:
content: aint nothin here
headers:
content-type: text/plain
custom-haha: lol
statusCode: 418
listenHTTP: :80
listenHTTPS: :443
forceHTTPS: true

55
app/cmd/share.go Normal file
View file

@ -0,0 +1,55 @@
package cmd
import (
"fmt"
"github.com/apernet/hysteria/app/v2/internal/utils"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"go.uber.org/zap"
)
var (
noText bool
withQR bool
)
// shareCmd represents the share command
var shareCmd = &cobra.Command{
Use: "share",
Short: "Generate share URI",
Long: "Generate a hysteria2:// URI from a client config for sharing",
Run: runShare,
}
func init() {
initShareFlags()
rootCmd.AddCommand(shareCmd)
}
func initShareFlags() {
shareCmd.Flags().BoolVar(&noText, "notext", false, "do not show URI as text")
shareCmd.Flags().BoolVar(&withQR, "qr", false, "show URI as QR code")
}
func runShare(cmd *cobra.Command, args []string) {
if err := viper.ReadInConfig(); err != nil {
logger.Fatal("failed to read client config", zap.Error(err))
}
var config clientConfig
if err := viper.Unmarshal(&config); err != nil {
logger.Fatal("failed to parse client config", zap.Error(err))
}
if _, err := config.Config(); err != nil {
logger.Fatal("failed to load client config", zap.Error(err))
}
u := config.URI()
if !noText {
fmt.Println(u)
}
if withQR {
utils.PrintQR(u)
}
}

178
app/cmd/speedtest.go Normal file
View file

@ -0,0 +1,178 @@
package cmd
import (
"errors"
"fmt"
"os"
"os/signal"
"syscall"
"time"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"go.uber.org/zap"
"github.com/apernet/hysteria/core/v2/client"
hyErrors "github.com/apernet/hysteria/core/v2/errors"
"github.com/apernet/hysteria/extras/v2/outbounds"
"github.com/apernet/hysteria/extras/v2/outbounds/speedtest"
)
var (
skipDownload bool
skipUpload bool
dataSize uint32
useBytes bool
speedtestAddr = fmt.Sprintf("%s:%d", outbounds.SpeedtestDest, 0)
)
// speedtestCmd represents the speedtest command
var speedtestCmd = &cobra.Command{
Use: "speedtest",
Short: "Speed test mode",
Long: "Perform a speed test through the proxy server. The server must have speed test support enabled.",
Run: runSpeedtest,
}
func init() {
initSpeedtestFlags()
rootCmd.AddCommand(speedtestCmd)
}
func initSpeedtestFlags() {
speedtestCmd.Flags().BoolVar(&skipDownload, "skip-download", false, "Skip download test")
speedtestCmd.Flags().BoolVar(&skipUpload, "skip-upload", false, "Skip upload test")
speedtestCmd.Flags().Uint32Var(&dataSize, "data-size", 1024*1024*100, "Data size for download and upload tests")
speedtestCmd.Flags().BoolVar(&useBytes, "use-bytes", false, "Use bytes per second instead of bits per second")
}
func runSpeedtest(cmd *cobra.Command, args []string) {
logger.Info("speed test mode")
if err := viper.ReadInConfig(); err != nil {
logger.Fatal("failed to read client config", zap.Error(err))
}
var config clientConfig
if err := viper.Unmarshal(&config); err != nil {
logger.Fatal("failed to parse client config", zap.Error(err))
}
hyConfig, err := config.Config()
if err != nil {
logger.Fatal("failed to load client config", zap.Error(err))
}
c, info, err := client.NewClient(hyConfig)
if err != nil {
logger.Fatal("failed to initialize client", zap.Error(err))
}
defer c.Close()
logger.Info("connected to server",
zap.Bool("udpEnabled", info.UDPEnabled),
zap.Uint64("tx", info.Tx))
signalChan := make(chan os.Signal, 1)
signal.Notify(signalChan, os.Interrupt, syscall.SIGTERM)
defer signal.Stop(signalChan)
runChan := make(chan struct{}, 1)
go func() {
if !skipDownload {
runDownloadTest(c)
}
if !skipUpload {
runUploadTest(c)
}
runChan <- struct{}{}
}()
select {
case <-signalChan:
logger.Info("received signal, shutting down gracefully")
case <-runChan:
logger.Info("speed test complete")
}
}
func runDownloadTest(c client.Client) {
logger.Info("performing download test")
downConn, err := c.TCP(speedtestAddr)
if err != nil {
if errors.As(err, &hyErrors.DialError{}) {
logger.Fatal("failed to connect (server may not support speed test)", zap.Error(err))
} else {
logger.Fatal("failed to connect", zap.Error(err))
}
}
defer downConn.Close()
downClient := &speedtest.Client{Conn: downConn}
currentTotal := uint32(0)
err = downClient.Download(dataSize, func(d time.Duration, b uint32, done bool) {
if !done {
currentTotal += b
logger.Info("downloading",
zap.Uint32("bytes", b),
zap.String("progress", fmt.Sprintf("%.2f%%", float64(currentTotal)/float64(dataSize)*100)),
zap.String("speed", formatSpeed(b, d, useBytes)))
} else {
logger.Info("download complete",
zap.Uint32("bytes", b),
zap.String("speed", formatSpeed(b, d, useBytes)))
}
})
if err != nil {
logger.Fatal("download test failed", zap.Error(err))
}
logger.Info("download test complete")
}
func runUploadTest(c client.Client) {
logger.Info("performing upload test")
upConn, err := c.TCP(speedtestAddr)
if err != nil {
if errors.As(err, &hyErrors.DialError{}) {
logger.Fatal("failed to connect (server may not support speed test)", zap.Error(err))
} else {
logger.Fatal("failed to connect", zap.Error(err))
}
}
defer upConn.Close()
upClient := &speedtest.Client{Conn: upConn}
currentTotal := uint32(0)
err = upClient.Upload(dataSize, func(d time.Duration, b uint32, done bool) {
if !done {
currentTotal += b
logger.Info("uploading",
zap.Uint32("bytes", b),
zap.String("progress", fmt.Sprintf("%.2f%%", float64(currentTotal)/float64(dataSize)*100)),
zap.String("speed", formatSpeed(b, d, useBytes)))
} else {
logger.Info("upload complete",
zap.Uint32("bytes", b),
zap.String("speed", formatSpeed(b, d, useBytes)))
}
})
if err != nil {
logger.Fatal("upload test failed", zap.Error(err))
}
logger.Info("upload test complete")
}
func formatSpeed(bytes uint32, duration time.Duration, useBytes bool) string {
speed := float64(bytes) / duration.Seconds()
var units []string
if useBytes {
units = []string{"B/s", "KB/s", "MB/s", "GB/s"}
} else {
units = []string{"bps", "Kbps", "Mbps", "Gbps"}
speed *= 8
}
unitIndex := 0
for speed > 1000 && unitIndex < len(units)-1 {
speed /= 1000
unitIndex++
}
return fmt.Sprintf("%.2f %s", speed, units[unitIndex])
}

88
app/cmd/update.go Normal file
View file

@ -0,0 +1,88 @@
package cmd
import (
"time"
"github.com/spf13/cobra"
"go.uber.org/zap"
"github.com/apernet/hysteria/app/v2/internal/utils"
"github.com/apernet/hysteria/core/v2/client"
)
const (
updateCheckInterval = 24 * time.Hour
)
// checkUpdateCmd represents the checkUpdate command
var checkUpdateCmd = &cobra.Command{
Use: "check-update",
Short: "Check for updates",
Long: "Check for updates.",
Run: runCheckUpdate,
}
func init() {
rootCmd.AddCommand(checkUpdateCmd)
}
func runCheckUpdate(cmd *cobra.Command, args []string) {
logger.Info("checking for updates",
zap.String("version", appVersion),
zap.String("platform", appPlatform),
zap.String("arch", appArch),
zap.String("channel", appType),
)
checker := utils.NewServerUpdateChecker(appVersion, appPlatform, appArch, appType)
resp, err := checker.Check()
if err != nil {
logger.Fatal("failed to check for updates", zap.Error(err))
}
if resp.HasUpdate {
logger.Info("update available",
zap.String("version", resp.LatestVersion),
zap.String("url", resp.URL),
zap.Bool("urgent", resp.Urgent),
)
} else {
logger.Info("no update available")
}
}
// runCheckUpdateServer is the background update checking routine for server mode
func runCheckUpdateServer() {
checker := utils.NewServerUpdateChecker(appVersion, appPlatform, appArch, appType)
checkUpdateRoutine(checker)
}
// runCheckUpdateClient is the background update checking routine for client mode
func runCheckUpdateClient(hyClient client.Client) {
checker := utils.NewClientUpdateChecker(appVersion, appPlatform, appArch, appType, hyClient)
checkUpdateRoutine(checker)
}
func checkUpdateRoutine(checker *utils.UpdateChecker) {
ticker := time.NewTicker(updateCheckInterval)
for {
logger.Debug("checking for updates",
zap.String("version", appVersion),
zap.String("platform", appPlatform),
zap.String("arch", appArch),
zap.String("channel", appType),
)
resp, err := checker.Check()
if err != nil {
logger.Debug("failed to check for updates", zap.Error(err))
} else if resp.HasUpdate {
logger.Info("update available",
zap.String("version", resp.LatestVersion),
zap.String("url", resp.URL),
zap.Bool("urgent", resp.Urgent),
)
} else {
logger.Debug("no update available")
}
<-ticker.C
}
}

23
app/cmd/version.go Normal file
View file

@ -0,0 +1,23 @@
package cmd
import (
"fmt"
"github.com/spf13/cobra"
)
// versionCmd represents the version command
var versionCmd = &cobra.Command{
Use: "version",
Short: "Show version",
Long: "Show version.",
Run: runVersion,
}
func init() {
rootCmd.AddCommand(versionCmd)
}
func runVersion(cmd *cobra.Command, args []string) {
fmt.Println(appAboutLong)
}

92
app/go.mod Normal file
View file

@ -0,0 +1,92 @@
module github.com/apernet/hysteria/app/v2
go 1.22
toolchain go1.23.2
require (
github.com/apernet/go-tproxy v0.0.0-20230809025308-8f4723fd742f
github.com/apernet/hysteria/core/v2 v2.0.0-00010101000000-000000000000
github.com/apernet/hysteria/extras/v2 v2.0.0-00010101000000-000000000000
github.com/apernet/sing-tun v0.2.6-0.20240323130332-b9f6511036ad
github.com/caddyserver/certmagic v0.17.2
github.com/libdns/cloudflare v0.1.1
github.com/libdns/duckdns v0.2.0
github.com/libdns/gandi v1.0.3
github.com/libdns/godaddy v1.0.3
github.com/libdns/namedotcom v0.3.3
github.com/libdns/vultr v1.0.0
github.com/mdp/qrterminal/v3 v3.1.1
github.com/mholt/acmez v1.0.4
github.com/sagernet/sing v0.3.2
github.com/spf13/cobra v1.7.0
github.com/spf13/viper v1.15.0
github.com/stretchr/testify v1.9.0
github.com/txthinking/socks5 v0.0.0-20230325130024-4230056ae301
go.uber.org/zap v1.24.0
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842
golang.org/x/sys v0.25.0
)
require (
github.com/andybalholm/brotli v1.1.0 // indirect
github.com/apernet/quic-go v0.49.1-0.20250204013113-43c72b1281a0 // indirect
github.com/babolivier/go-doh-client v0.0.0-20201028162107-a76cff4cb8b6 // indirect
github.com/cloudflare/circl v1.3.9 // indirect
github.com/database64128/netx-go v0.0.0-20240905055117-62795b8b054a // indirect
github.com/database64128/tfo-go/v2 v2.2.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-retryablehttp v0.7.6 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.5 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/klauspost/compress v1.17.9 // indirect
github.com/klauspost/cpuid/v2 v2.1.1 // indirect
github.com/libdns/libdns v0.2.2 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/miekg/dns v1.1.59 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/onsi/ginkgo/v2 v2.9.5 // indirect
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/quic-go/qpack v0.5.1 // indirect
github.com/refraction-networking/utls v1.6.6 // indirect
github.com/sagernet/netlink v0.0.0-20220905062125-8043b4a9aa97 // indirect
github.com/scjalliance/comshim v0.0.0-20230315213746-5e51f40bd3b9 // indirect
github.com/spf13/afero v1.9.3 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/objx v0.5.2 // indirect
github.com/subosito/gotenv v1.4.2 // indirect
github.com/txthinking/runnergroup v0.0.0-20210608031112-152c7c4432bf // indirect
github.com/vishvananda/netns v0.0.0-20211101163701-50045581ed74 // indirect
github.com/vultr/govultr/v3 v3.6.4 // indirect
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/mock v0.5.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go4.org/netipx v0.0.0-20231129151722-fdeea329fbba // indirect
golang.org/x/crypto v0.26.0 // indirect
golang.org/x/mod v0.18.0 // indirect
golang.org/x/net v0.28.0 // indirect
golang.org/x/oauth2 v0.20.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/text v0.17.0 // indirect
golang.org/x/tools v0.22.0 // indirect
google.golang.org/protobuf v1.34.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
rsc.io/qr v0.2.0 // indirect
)
replace github.com/apernet/hysteria/core/v2 => ../core
replace github.com/apernet/hysteria/extras/v2 => ../extras

661
app/go.sum Normal file
View file

@ -0,0 +1,661 @@
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU=
cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU=
cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY=
cloud.google.com/go v0.44.3/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY=
cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc=
cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0=
cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To=
cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4=
cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M=
cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc=
cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk=
cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs=
cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc=
cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY=
cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI=
cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk=
cloud.google.com/go v0.75.0/go.mod h1:VGuuCn7PG0dwsd5XPVm2Mm3wlh3EL55/79EKB6hlPTY=
cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o=
cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE=
cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc=
cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg=
cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc=
cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ=
cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE=
cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk=
cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I=
cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw=
cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA=
cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU=
cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw=
cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos=
cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk=
cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs=
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M=
github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY=
github.com/apernet/go-tproxy v0.0.0-20230809025308-8f4723fd742f h1:uVh0qpEslrWjgzx9vOcyCqsOY3c9kofDZ1n+qaw35ZY=
github.com/apernet/go-tproxy v0.0.0-20230809025308-8f4723fd742f/go.mod h1:xkkq9D4ygcldQQhKS/w9CadiCKwCngU7K9E3DaKahpM=
github.com/apernet/quic-go v0.49.1-0.20250204013113-43c72b1281a0 h1:oc6//C91pY9gGOBioHeyJrmmpKv/nS8fvTeDpKNPLnI=
github.com/apernet/quic-go v0.49.1-0.20250204013113-43c72b1281a0/go.mod h1:/mMPNt1MHqduzaVB2qFHnJwam3BR5r5b35GvYouJs/o=
github.com/apernet/sing-tun v0.2.6-0.20240323130332-b9f6511036ad h1:QzQ2sKpc9o42HNRR8ukM5uMC/RzR2HgZd/Nvaqol2C0=
github.com/apernet/sing-tun v0.2.6-0.20240323130332-b9f6511036ad/go.mod h1:S5IydyLSN/QAfvY+r2GoomPJ6hidtXWm/Ad18sJVssk=
github.com/babolivier/go-doh-client v0.0.0-20201028162107-a76cff4cb8b6 h1:4NNbNM2Iq/k57qEu7WfL67UrbPq1uFWxW4qODCohi+0=
github.com/babolivier/go-doh-client v0.0.0-20201028162107-a76cff4cb8b6/go.mod h1:J29hk+f9lJrblVIfiJOtTFk+OblBawmib4uz/VdKzlg=
github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
github.com/caddyserver/certmagic v0.17.2 h1:o30seC1T/dBqBCNNGNHWwj2i5/I/FMjBbTAhjADP3nE=
github.com/caddyserver/certmagic v0.17.2/go.mod h1:ouWUuC490GOLJzkyN35eXfV8bSbwMwSf4bdhkIxtdQE=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cloudflare/circl v1.3.9 h1:QFrlgFYf2Qpi8bSpVPK1HBvWpx16v/1TZivyo7pGuBE=
github.com/cloudflare/circl v1.3.9/go.mod h1:PDRU+oXvdD7KCtgKxW95M5Z8BpSCJXQORiZFnBQS5QU=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/database64128/netx-go v0.0.0-20240905055117-62795b8b054a h1:t4SDi0pmNkryzKdM4QF3o5vqSP4GRjeZD/6j3nyxNP0=
github.com/database64128/netx-go v0.0.0-20240905055117-62795b8b054a/go.mod h1:7K2NQKbabB5mBl41vF6YayYl5g7YpDwc4dQ5iMpP3Lg=
github.com/database64128/tfo-go/v2 v2.2.2 h1:BxynF4qGF5ct3DpPLEG62uyJZ3LQhqaf0Ken+kyy7PM=
github.com/database64128/tfo-go/v2 v2.2.2/go.mod h1:2IW8jppdBwdVMjA08uEyMNnqiAHKUlqAA+J8NrsfktY=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po=
github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM=
github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE=
github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE=
github.com/frankban/quicktest v1.14.3/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps=
github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ=
github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE=
github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78=
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI=
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y=
github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk=
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 h1:yAJXTCF9TqKcTiHJAE8dj7HMvPfh66eeA2JYW7eFpSE=
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g=
github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ=
github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k=
github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M=
github.com/hashicorp/go-retryablehttp v0.7.6 h1:TwRYfx2z2C4cLbXmT8I5PgP/xmuqASDyiVuGYfs9GZM=
github.com/hashicorp/go-retryablehttp v0.7.6/go.mod h1:pkQpWZeYWskR+D1tR2O5OcBFOxfA7DoAO6xtkuQnHTk=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/golang-lru/v2 v2.0.5 h1:wW7h1TG88eUIJ2i69gaE3uNVtEPIagzhGvHgwfx2Vm4=
github.com/hashicorp/golang-lru/v2 v2.0.5/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM=
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA=
github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
github.com/klauspost/cpuid/v2 v2.1.1 h1:t0wUqjowdm8ezddV5k0tLWVklVuvLJpoHeb4WBdydm0=
github.com/klauspost/cpuid/v2 v2.1.1/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY=
github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/libdns/cloudflare v0.1.1 h1:FVPfWwP8zZCqj268LZjmkDleXlHPlFU9KC4OJ3yn054=
github.com/libdns/cloudflare v0.1.1/go.mod h1:9VK91idpOjg6v7/WbjkEW49bSCxj00ALesIFDhJ8PBU=
github.com/libdns/duckdns v0.2.0 h1:vd3pE09G2qTx1Zh1o3LmrivWSByD3Z5FbL7csX5vDgE=
github.com/libdns/duckdns v0.2.0/go.mod h1:jCQ/7+qvhLK39+28qXvKEYGBBvmHBCmIwNqdJTCUmVs=
github.com/libdns/gandi v1.0.3 h1:FIvipWOg/O4zi75fPRmtcolRKqI6MgrbpFy2p5KYdUk=
github.com/libdns/gandi v1.0.3/go.mod h1:G6dw58Xnji2xX+lb+uZxGbtmfxKllm1CGHE2bOPG3WA=
github.com/libdns/godaddy v1.0.3 h1:PX1FOYDQ1HGQzz8mVOmtwm3aa6Sv5MwCkNzivUUTA44=
github.com/libdns/godaddy v1.0.3/go.mod h1:vuKWUXnvblDvcaiRwutOoLl7DuB21x8tI06owsF/JTM=
github.com/libdns/libdns v0.2.0/go.mod h1:yQCXzk1lEZmmCPa857bnk4TsOiqYasqpyOEeSObbb40=
github.com/libdns/libdns v0.2.2 h1:O6ws7bAfRPaBsgAYt8MDe2HcNBGC29hkZ9MX2eUSX3s=
github.com/libdns/libdns v0.2.2/go.mod h1:4Bj9+5CQiNMVGf87wjX4CY3HQJypUHRuLvlsfsZqLWQ=
github.com/libdns/namedotcom v0.3.3 h1:R10C7+IqQGVeC4opHHMiFNBxdNBg1bi65ZwqLESl+jE=
github.com/libdns/namedotcom v0.3.3/go.mod h1:GbYzsAF2yRUpI0WgIK5fs5UX+kDVUPaYCFLpTnKQm0s=
github.com/libdns/vultr v1.0.0 h1:W8B4+k2bm9ro3bZLSZV9hMOQI+uO6Svu+GmD+Olz7ZI=
github.com/libdns/vultr v1.0.0/go.mod h1:8K1HJExcbeHS4YPkFHRZpqpXZzZ+DZAA0m0VikJgEqk=
github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY=
github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mdp/qrterminal/v3 v3.1.1 h1:cIPwg3QU0OIm9+ce/lRfWXhPwEjOSKwk3HBwL3HBTyc=
github.com/mdp/qrterminal/v3 v3.1.1/go.mod h1:5lJlXe7Jdr8wlPDdcsJttv1/knsRgzXASyr4dcGZqNU=
github.com/mholt/acmez v1.0.4 h1:N3cE4Pek+dSolbsofIkAYz6H1d3pE+2G0os7QHslf80=
github.com/mholt/acmez v1.0.4/go.mod h1:qFGLZ4u+ehWINeJZjzPlsnjJBCPAADWTcIqE/7DAYQY=
github.com/miekg/dns v1.1.40/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM=
github.com/miekg/dns v1.1.51/go.mod h1:2Z9d3CP1LQWihRZUf29mQ19yDThaI4DAYzte2CaQW5c=
github.com/miekg/dns v1.1.59 h1:C9EXc/UToRwKLhK5wKU/I4QVsBUc8kE6MkHBkeypWZs=
github.com/miekg/dns v1.1.59/go.mod h1:nZpewl5p6IvctfgrckopVx2OlSEHPRO/U4SYkRklrEk=
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/onsi/ginkgo/v2 v2.9.5 h1:+6Hr4uxzP4XIUyAkg61dWBw8lb/gc4/X5luuxN/EC+Q=
github.com/onsi/ginkgo/v2 v2.9.5/go.mod h1:tvAoo1QUJwNEU2ITftXTpR7R1RbCzoZUOs3RonqW57k=
github.com/onsi/gomega v1.27.6 h1:ENqfyGeS5AX/rlXDd/ETokDz93u0YufY1Pgxuy/PvWE=
github.com/onsi/gomega v1.27.6/go.mod h1:PIQNjfQwkP3aQAH7lf7j87O/5FiNr+ZR8+ipb+qQlhg=
github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc=
github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ=
github.com/pelletier/go-toml/v2 v2.0.6 h1:nrzqCb7j9cDFj2coyLNLaZuJTLjWjlaz6nvTvIwycIU=
github.com/pelletier/go-toml/v2 v2.0.6/go.mod h1:eumQOmlWiOPt5WriQQqoM5y18pDHwha2N+QD+EUNTek=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/quic-go/qpack v0.5.1 h1:giqksBPnT/HDtZ6VhtFKgoLOWmlyo9Ei6u9PqzIMbhI=
github.com/quic-go/qpack v0.5.1/go.mod h1:+PC4XFrEskIVkcLzpEkbLqq1uCoxPhQuvK5rH1ZgaEg=
github.com/refraction-networking/utls v1.6.6 h1:igFsYBUJPYM8Rno9xUuDoM5GQrVEqY4llzEXOkL43Ig=
github.com/refraction-networking/utls v1.6.6/go.mod h1:BC3O4vQzye5hqpmDTWUqi4P5DDhzJfkV1tdqtawQIH0=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/sagernet/netlink v0.0.0-20220905062125-8043b4a9aa97 h1:iL5gZI3uFp0X6EslacyapiRz7LLSJyr4RajF/BhMVyE=
github.com/sagernet/netlink v0.0.0-20220905062125-8043b4a9aa97/go.mod h1:xLnfdiJbSp8rNqYEdIW/6eDO4mVoogml14Bh2hSiFpM=
github.com/sagernet/sing v0.3.2 h1:CwWcxUBPkMvwgfe2/zUgY5oHG9qOL8Aob/evIFYK9jo=
github.com/sagernet/sing v0.3.2/go.mod h1:qHySJ7u8po9DABtMYEkNBcOumx7ZZJf/fbv2sfTkNHE=
github.com/scjalliance/comshim v0.0.0-20230315213746-5e51f40bd3b9 h1:rc/CcqLH3lh8n+csdOuDfP+NuykE0U6AeYSJJHKDgSg=
github.com/scjalliance/comshim v0.0.0-20230315213746-5e51f40bd3b9/go.mod h1:a/83NAfUXvEuLpmxDssAXxgUgrEy12MId3Wd7OTs76s=
github.com/spf13/afero v1.9.3 h1:41FoI0fD7OR7mGcKE/aOiLkGreyf8ifIOQmJANWogMk=
github.com/spf13/afero v1.9.3/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y=
github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w=
github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU=
github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I=
github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0=
github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk=
github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/viper v1.15.0 h1:js3yy885G8xwJa6iOISGFwd+qlUo5AvyXb7CiihdtiU=
github.com/spf13/viper v1.15.0/go.mod h1:fFcTBJxvhhzSJiZy8n+PeW6t8l+KeT/uTARa0jHOQLA=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8=
github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0=
github.com/txthinking/runnergroup v0.0.0-20210608031112-152c7c4432bf h1:7PflaKRtU4np/epFxRXlFhlzLXZzKFrH5/I4so5Ove0=
github.com/txthinking/runnergroup v0.0.0-20210608031112-152c7c4432bf/go.mod h1:CLUSJbazqETbaR+i0YAhXBICV9TrKH93pziccMhmhpM=
github.com/txthinking/socks5 v0.0.0-20230325130024-4230056ae301 h1:d/Wr/Vl/wiJHc3AHYbYs5I3PucJvRuw3SvbmlIRf+oM=
github.com/txthinking/socks5 v0.0.0-20230325130024-4230056ae301/go.mod h1:ntmMHL/xPq1WLeKiw8p/eRATaae6PiVRNipHFJxI8PM=
github.com/vishvananda/netns v0.0.0-20211101163701-50045581ed74 h1:gga7acRE695APm9hlsSMoOoE65U4/TcqNj90mc69Rlg=
github.com/vishvananda/netns v0.0.0-20211101163701-50045581ed74/go.mod h1:DD4vA1DwXk04H54A1oHXtwZmA0grkVMdPxx/VGLCah0=
github.com/vultr/govultr/v3 v3.6.4 h1:unvY9eXlBw667ECQZDbBDOIaWB8wkk6Bx+yB0IMKXJ4=
github.com/vultr/govultr/v3 v3.6.4/go.mod h1:rt9v2x114jZmmLAE/h5N5jnxTmsK9ewwS2oQZ0UBQzM=
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk=
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE=
go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ=
go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A=
go.uber.org/goleak v1.2.1/go.mod h1:qlT2yGI9QafXHhZZLxlSuNsMw3FFLxBr+tBRlmO1xH4=
go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU=
go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM=
go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
go.uber.org/zap v1.21.0/go.mod h1:wjWOCqI0f2ZZrJF/UufIOkiC8ii6tm1iqIsLo76RfJw=
go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60=
go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg=
go4.org/netipx v0.0.0-20231129151722-fdeea329fbba h1:0b9z3AuHCjxk0x/opv64kcgZLBseWJUpBw5I82+2U4M=
go4.org/netipx v0.0.0-20231129151722-fdeea329fbba/go.mod h1:PLyyIXexvUFg3Owu6p/WfdlivPbZJsZdgWZlrGope/Y=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw=
golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek=
golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY=
golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 h1:vr/HnozRka3pE4EsMEg1lgkXJkTFJCVUX+S/ZT6wYzM=
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs=
golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0=
golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/net v0.0.0-20220630215102-69896b714898/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY=
golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE=
golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/oauth2 v0.20.0 h1:4mQdhULixXKP1rwYBW0vAijoXnkTG0BLCDRzfe1idMo=
golang.org/x/oauth2 v0.20.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200217220822-9197077df867/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34=
golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc=
golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk=
golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191216052735-49a3e744a425/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw=
golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw=
golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8=
golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE=
golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k=
golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA=
golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=
google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE=
google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE=
google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM=
google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc=
google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg=
google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE=
google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0=
google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8=
google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA=
google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U=
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA=
google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60=
google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk=
google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8=
google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg=
google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
rsc.io/qr v0.2.0 h1:6vBLea5/NRMVTz8V66gipeLycZMl/+UlFmk8DvqQ6WY=
rsc.io/qr v0.2.0/go.mod h1:IF+uZjkb9fqyeF/4tlBoynqmQxUoPfWEKh921coOuXs=
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=

View file

@ -0,0 +1,62 @@
package forwarding
import (
"io"
"net"
"github.com/apernet/hysteria/core/v2/client"
)
type TCPTunnel struct {
HyClient client.Client
Remote string
EventLogger TCPEventLogger
}
type TCPEventLogger interface {
Connect(addr net.Addr)
Error(addr net.Addr, err error)
}
func (t *TCPTunnel) Serve(listener net.Listener) error {
for {
conn, err := listener.Accept()
if err != nil {
return err
}
go t.handle(conn)
}
}
func (t *TCPTunnel) handle(conn net.Conn) {
defer conn.Close()
if t.EventLogger != nil {
t.EventLogger.Connect(conn.RemoteAddr())
}
var closeErr error
defer func() {
if t.EventLogger != nil {
t.EventLogger.Error(conn.RemoteAddr(), closeErr)
}
}()
rc, err := t.HyClient.TCP(t.Remote)
if err != nil {
closeErr = err
return
}
defer rc.Close()
// Start forwarding
copyErrChan := make(chan error, 2)
go func() {
_, copyErr := io.Copy(rc, conn)
copyErrChan <- copyErr
}()
go func() {
_, copyErr := io.Copy(conn, rc)
copyErrChan <- copyErr
}()
closeErr = <-copyErrChan
}

View file

@ -0,0 +1,39 @@
package forwarding
import (
"crypto/rand"
"net"
"testing"
"github.com/stretchr/testify/assert"
"github.com/apernet/hysteria/app/v2/internal/utils_test"
)
func TestTCPTunnel(t *testing.T) {
// Start the tunnel
l, err := net.Listen("tcp", "127.0.0.1:34567")
assert.NoError(t, err)
defer l.Close()
tunnel := &TCPTunnel{
HyClient: &utils_test.MockEchoHyClient{},
}
go tunnel.Serve(l)
for i := 0; i < 10; i++ {
conn, err := net.Dial("tcp", "127.0.0.1:34567")
assert.NoError(t, err)
data := make([]byte, 1024)
_, _ = rand.Read(data)
_, err = conn.Write(data)
assert.NoError(t, err)
recv := make([]byte, 1024)
_, err = conn.Read(recv)
assert.NoError(t, err)
assert.Equal(t, data, recv)
_ = conn.Close()
}
}

View file

@ -0,0 +1,180 @@
package forwarding
import (
"net"
"sync"
"sync/atomic"
"time"
"github.com/apernet/hysteria/core/v2/client"
)
const (
udpBufferSize = 4096
defaultTimeout = 60 * time.Second
idleCleanupInterval = 1 * time.Second
)
type atomicTime struct {
v atomic.Value
}
func newAtomicTime(t time.Time) *atomicTime {
a := &atomicTime{}
a.Set(t)
return a
}
func (t *atomicTime) Set(new time.Time) {
t.v.Store(new)
}
func (t *atomicTime) Get() time.Time {
return t.v.Load().(time.Time)
}
type sessionEntry struct {
HyConn client.HyUDPConn
Last *atomicTime
Timeout bool // true if the session is closed due to timeout
}
func (e *sessionEntry) Feed(data []byte, addr string) error {
e.Last.Set(time.Now())
return e.HyConn.Send(data, addr)
}
func (e *sessionEntry) ReceiveLoop(pc net.PacketConn, addr net.Addr) error {
for {
data, _, err := e.HyConn.Receive()
if err != nil {
return err
}
_, err = pc.WriteTo(data, addr)
if err != nil {
return err
}
e.Last.Set(time.Now())
}
}
type UDPTunnel struct {
HyClient client.Client
Remote string
Timeout time.Duration
EventLogger UDPEventLogger
m map[string]*sessionEntry // addr -> HyConn
mutex sync.RWMutex
}
type UDPEventLogger interface {
Connect(addr net.Addr)
Error(addr net.Addr, err error)
}
func (t *UDPTunnel) Serve(pc net.PacketConn) error {
t.m = make(map[string]*sessionEntry)
stopCh := make(chan struct{})
go t.idleCleanupLoop(stopCh)
defer close(stopCh)
defer t.cleanup(false)
buf := make([]byte, udpBufferSize)
for {
n, addr, err := pc.ReadFrom(buf)
if err != nil {
return err
}
t.feed(pc, addr, buf[:n])
}
}
func (t *UDPTunnel) idleCleanupLoop(stopCh <-chan struct{}) {
ticker := time.NewTicker(idleCleanupInterval)
defer ticker.Stop()
for {
select {
case <-ticker.C:
t.cleanup(true)
case <-stopCh:
return
}
}
}
func (t *UDPTunnel) cleanup(idleOnly bool) {
// We use RLock here as we are only scanning the map, not deleting from it.
t.mutex.RLock()
defer t.mutex.RUnlock()
timeout := t.Timeout
if timeout == 0 {
timeout = defaultTimeout
}
now := time.Now()
for _, entry := range t.m {
if !idleOnly || now.Sub(entry.Last.Get()) > timeout {
entry.Timeout = true
_ = entry.HyConn.Close()
// Closing the connection here will cause the ReceiveLoop to exit,
// and the session will be removed from the map there.
}
}
}
func (t *UDPTunnel) feed(pc net.PacketConn, addr net.Addr, data []byte) {
t.mutex.RLock()
entry := t.m[addr.String()]
t.mutex.RUnlock()
// Create a new session if not exists
if entry == nil {
if t.EventLogger != nil {
t.EventLogger.Connect(addr)
}
hyConn, err := t.HyClient.UDP()
if err != nil {
if t.EventLogger != nil {
t.EventLogger.Error(addr, err)
}
return
}
entry = &sessionEntry{
HyConn: hyConn,
Last: newAtomicTime(time.Now()),
}
// Start the receive loop for this session
// Local <- Remote
go func() {
err := entry.ReceiveLoop(pc, addr)
if !entry.Timeout {
_ = hyConn.Close()
if t.EventLogger != nil {
t.EventLogger.Error(addr, err)
}
} else {
// Connection already closed by timeout cleanup,
// no need to close again here.
// Use nil error to indicate timeout.
if t.EventLogger != nil {
t.EventLogger.Error(addr, nil)
}
}
// Remove the session from the map
t.mutex.Lock()
delete(t.m, addr.String())
t.mutex.Unlock()
}()
// Insert the session into the map
t.mutex.Lock()
t.m[addr.String()] = entry
t.mutex.Unlock()
}
// Feed the message to the session
_ = entry.Feed(data, t.Remote)
}

View file

@ -0,0 +1,39 @@
package forwarding
import (
"crypto/rand"
"net"
"testing"
"github.com/stretchr/testify/assert"
"github.com/apernet/hysteria/app/v2/internal/utils_test"
)
func TestUDPTunnel(t *testing.T) {
// Start the tunnel
l, err := net.ListenPacket("udp", "127.0.0.1:34567")
assert.NoError(t, err)
defer l.Close()
tunnel := &UDPTunnel{
HyClient: &utils_test.MockEchoHyClient{},
}
go tunnel.Serve(l)
for i := 0; i < 10; i++ {
conn, err := net.Dial("udp", "127.0.0.1:34567")
assert.NoError(t, err)
data := make([]byte, 1024)
_, _ = rand.Read(data)
_, err = conn.Write(data)
assert.NoError(t, err)
recv := make([]byte, 1024)
_, err = conn.Read(recv)
assert.NoError(t, err)
assert.Equal(t, data, recv)
_ = conn.Close()
}
}

301
app/internal/http/server.go Normal file
View file

@ -0,0 +1,301 @@
package http
import (
"bufio"
"bytes"
"context"
"encoding/base64"
"fmt"
"io"
"net"
"net/http"
"strings"
"time"
"github.com/apernet/hysteria/core/v2/client"
)
const (
httpClientTimeout = 10 * time.Second
)
// Server is an HTTP server using a Hysteria client as outbound.
type Server struct {
HyClient client.Client
AuthFunc func(username, password string) bool // nil = no authentication
AuthRealm string
EventLogger EventLogger
httpClient *http.Client
}
type EventLogger interface {
ConnectRequest(addr net.Addr, reqAddr string)
ConnectError(addr net.Addr, reqAddr string, err error)
HTTPRequest(addr net.Addr, reqURL string)
HTTPError(addr net.Addr, reqURL string, err error)
}
func (s *Server) Serve(listener net.Listener) error {
for {
conn, err := listener.Accept()
if err != nil {
return err
}
go s.dispatch(conn)
}
}
func (s *Server) dispatch(conn net.Conn) {
bufReader := bufio.NewReader(conn)
for {
req, err := http.ReadRequest(bufReader)
if err != nil {
// Connection error or invalid request
_ = conn.Close()
return
}
if s.AuthFunc != nil {
authOK := false
// Check the Proxy-Authorization header
pAuth := req.Header.Get("Proxy-Authorization")
if strings.HasPrefix(pAuth, "Basic ") {
userPass, err := base64.URLEncoding.DecodeString(pAuth[6:])
if err == nil {
userPassParts := strings.SplitN(string(userPass), ":", 2)
if len(userPassParts) == 2 {
authOK = s.AuthFunc(userPassParts[0], userPassParts[1])
}
}
}
if !authOK {
// Proxy authentication required
_ = sendProxyAuthRequired(conn, req, s.AuthRealm)
_ = conn.Close()
return
}
}
if req.Method == http.MethodConnect {
if bufReader.Buffered() > 0 {
// There is still data in the buffered reader.
// We need to get it out and put it into a cachedConn,
// so that handleConnect can read it.
data := make([]byte, bufReader.Buffered())
_, err := io.ReadFull(bufReader, data)
if err != nil {
// Read from buffer failed, is this possible?
_ = conn.Close()
return
}
cachedConn := &cachedConn{
Conn: conn,
Buffer: *bytes.NewBuffer(data),
}
s.handleConnect(cachedConn, req)
} else {
// No data in the buffered reader, we can just pass the original connection.
s.handleConnect(conn, req)
}
// handleConnect will take over the connection,
// i.e. it will not return until the connection is closed.
// When it returns, there will be no more requests from this connection,
// so we simply exit the loop.
return
} else {
// handleRequest on the other hand handles one request at a time,
// and returns when the request is done. It returns a bool indicating
// whether the connection should be kept alive, but itself never closes
// the connection.
keepAlive := s.handleRequest(conn, req)
if !keepAlive {
_ = conn.Close()
return
}
}
}
}
// cachedConn is a net.Conn wrapper that first Read()s from a buffer,
// and then from the underlying net.Conn when the buffer is drained.
type cachedConn struct {
net.Conn
Buffer bytes.Buffer
}
func (c *cachedConn) Read(b []byte) (int, error) {
if c.Buffer.Len() > 0 {
n, err := c.Buffer.Read(b)
if err == io.EOF {
// Buffer is drained, hide it from the caller
err = nil
}
return n, err
}
return c.Conn.Read(b)
}
func (s *Server) handleConnect(conn net.Conn, req *http.Request) {
defer conn.Close()
port := req.URL.Port()
if port == "" {
// HTTP defaults to port 80
port = "80"
}
reqAddr := net.JoinHostPort(req.URL.Hostname(), port)
// Connect request & error log
if s.EventLogger != nil {
s.EventLogger.ConnectRequest(conn.RemoteAddr(), reqAddr)
}
var closeErr error
defer func() {
if s.EventLogger != nil {
s.EventLogger.ConnectError(conn.RemoteAddr(), reqAddr, closeErr)
}
}()
// Dial
rConn, err := s.HyClient.TCP(reqAddr)
if err != nil {
_ = sendSimpleResponse(conn, req, http.StatusBadGateway)
closeErr = err
return
}
defer rConn.Close()
// Send 200 OK response and start relaying
_ = sendSimpleResponse(conn, req, http.StatusOK)
copyErrChan := make(chan error, 2)
go func() {
_, err := io.Copy(rConn, conn)
copyErrChan <- err
}()
go func() {
_, err := io.Copy(conn, rConn)
copyErrChan <- err
}()
closeErr = <-copyErrChan
}
func (s *Server) handleRequest(conn net.Conn, req *http.Request) bool {
// Some clients use Connection, some use Proxy-Connection
// https://www.oreilly.com/library/view/http-the-definitive/1565925092/re40.html
keepAlive := req.ProtoAtLeast(1, 1) &&
(strings.ToLower(req.Header.Get("Proxy-Connection")) == "keep-alive" ||
strings.ToLower(req.Header.Get("Connection")) == "keep-alive")
req.RequestURI = "" // Outgoing request should not have RequestURI
removeHopByHopHeaders(req.Header)
removeExtraHTTPHostPort(req)
if req.URL.Scheme == "" || req.URL.Host == "" {
_ = sendSimpleResponse(conn, req, http.StatusBadRequest)
return false
}
// Request & error log
if s.EventLogger != nil {
s.EventLogger.HTTPRequest(conn.RemoteAddr(), req.URL.String())
}
var closeErr error
defer func() {
if s.EventLogger != nil {
s.EventLogger.HTTPError(conn.RemoteAddr(), req.URL.String(), closeErr)
}
}()
if s.httpClient == nil {
s.initHTTPClient()
}
// Do the request and send the response back
resp, err := s.httpClient.Do(req)
if err != nil {
closeErr = err
_ = sendSimpleResponse(conn, req, http.StatusBadGateway)
return false
}
removeHopByHopHeaders(resp.Header)
if keepAlive {
resp.Header.Set("Connection", "keep-alive")
resp.Header.Set("Proxy-Connection", "keep-alive")
resp.Header.Set("Keep-Alive", "timeout=60")
}
closeErr = resp.Write(conn)
return closeErr == nil && keepAlive
}
func (s *Server) initHTTPClient() {
s.httpClient = &http.Client{
Transport: &http.Transport{
DialContext: func(ctx context.Context, network, addr string) (net.Conn, error) {
// HyClient doesn't support context for now
return s.HyClient.TCP(addr)
},
},
CheckRedirect: func(req *http.Request, via []*http.Request) error {
return http.ErrUseLastResponse
},
Timeout: httpClientTimeout,
}
}
func removeHopByHopHeaders(header http.Header) {
header.Del("Proxy-Connection") // Not in RFC but common
// https://www.ietf.org/rfc/rfc2616.txt
header.Del("Connection")
header.Del("Keep-Alive")
header.Del("Proxy-Authenticate")
header.Del("Proxy-Authorization")
header.Del("TE")
header.Del("Trailers")
header.Del("Transfer-Encoding")
header.Del("Upgrade")
}
func removeExtraHTTPHostPort(req *http.Request) {
host := req.Host
if host == "" {
host = req.URL.Host
}
if pHost, port, err := net.SplitHostPort(host); err == nil && port == "80" {
host = pHost
}
req.Host = host
req.URL.Host = host
}
// sendSimpleResponse sends a simple HTTP response with the given status code.
func sendSimpleResponse(conn net.Conn, req *http.Request, statusCode int) error {
resp := &http.Response{
StatusCode: statusCode,
Status: http.StatusText(statusCode),
Proto: req.Proto,
ProtoMajor: req.ProtoMajor,
ProtoMinor: req.ProtoMinor,
Header: http.Header{},
}
// Remove the "Content-Length: 0" header, some clients (e.g. ffmpeg) may not like it.
resp.ContentLength = -1
// Also, prevent the "Connection: close" header.
resp.Close = false
resp.Uncompressed = true
return resp.Write(conn)
}
// sendProxyAuthRequired sends a 407 Proxy Authentication Required response.
func sendProxyAuthRequired(conn net.Conn, req *http.Request, realm string) error {
resp := &http.Response{
StatusCode: http.StatusProxyAuthRequired,
Status: http.StatusText(http.StatusProxyAuthRequired),
Proto: req.Proto,
ProtoMajor: req.ProtoMajor,
ProtoMinor: req.ProtoMinor,
Header: http.Header{},
}
resp.Header.Set("Proxy-Authenticate", fmt.Sprintf("Basic realm=%q", realm))
return resp.Write(conn)
}

View file

@ -0,0 +1,59 @@
package http
import (
"errors"
"net"
"net/http"
"os/exec"
"strings"
"testing"
"github.com/stretchr/testify/assert"
"github.com/apernet/hysteria/core/v2/client"
)
const (
testCertFile = "test.crt"
testKeyFile = "test.key"
)
type mockHyClient struct{}
func (c *mockHyClient) TCP(addr string) (net.Conn, error) {
return net.Dial("tcp", addr)
}
func (c *mockHyClient) UDP() (client.HyUDPConn, error) {
return nil, errors.New("not implemented")
}
func (c *mockHyClient) Close() error {
return nil
}
func TestServer(t *testing.T) {
// Start the server
l, err := net.Listen("tcp", "127.0.0.1:18080")
assert.NoError(t, err)
defer l.Close()
s := &Server{
HyClient: &mockHyClient{},
}
go s.Serve(l)
// Start a test HTTP & HTTPS server
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("control is an illusion"))
})
go http.ListenAndServe("127.0.0.1:18081", nil)
go http.ListenAndServeTLS("127.0.0.1:18082", testCertFile, testKeyFile, nil)
// Run the Python test script
cmd := exec.Command("python", "server_test.py")
// Suppress HTTPS warning text from Python
cmd.Env = append(cmd.Env, "PYTHONWARNINGS=ignore:Unverified HTTPS request")
out, err := cmd.CombinedOutput()
assert.NoError(t, err)
assert.Equal(t, "OK", strings.TrimSpace(string(out)))
}

View file

@ -0,0 +1,24 @@
import requests
proxies = {
"http": "http://127.0.0.1:18080",
"https": "http://127.0.0.1:18080",
}
def test_http(it):
for i in range(it):
r = requests.get("http://127.0.0.1:18081", proxies=proxies)
assert r.status_code == 200 and r.text == "control is an illusion"
def test_https(it):
for i in range(it):
r = requests.get("https://127.0.0.1:18082", proxies=proxies, verify=False)
assert r.status_code == 200 and r.text == "control is an illusion"
if __name__ == "__main__":
test_http(10)
test_https(10)
print("OK")

View file

@ -0,0 +1,23 @@
-----BEGIN CERTIFICATE-----
MIIDwTCCAqmgAwIBAgIUMeefneiCXWS2ovxNN+fJcdrOIfAwDQYJKoZIhvcNAQEL
BQAwcDELMAkGA1UEBhMCVFcxEzARBgNVBAgMClNvbWUtU3RhdGUxGTAXBgNVBAoM
EFJhbmRvbSBTdHVmZiBMTEMxEjAQBgNVBAMMCWxvY2FsaG9zdDEdMBsGCSqGSIb3
DQEJARYOcG9vcGVyQHNoaXQuY2MwHhcNMjMwNDI3MDAyMDQ1WhcNMzMwNDI0MDAy
MDQ1WjBwMQswCQYDVQQGEwJUVzETMBEGA1UECAwKU29tZS1TdGF0ZTEZMBcGA1UE
CgwQUmFuZG9tIFN0dWZmIExMQzESMBAGA1UEAwwJbG9jYWxob3N0MR0wGwYJKoZI
hvcNAQkBFg5wb29wZXJAc2hpdC5jYzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
AQoCggEBAOU9/4AT/6fDKyEyZMMLFzUEVC8ZDJHoKZ+3g65ZFQLxRKqlEdhvOwq4
ZsxYF0sceUPDAsdrT+km0l1jAvq6u82n6xQQ60HpKe6hOvDX7KS0dPcKa+nfEa0W
DKamBB+TzxB2dBfBNS1oUU74nBb7ttpJiKnOpRJ0/J+CwslvhJzq04AUXC/W1CtW
CbZBg1JjY0fCN+Oy1WjEqMtRSB6k5Ipk40a8NcsqReBOMZChR8elruZ09sIlA6tf
jICOKToDVBmkjJ8m/GnxfV8MeLoK83M2VA73njsS6q9qe9KDVgIVQmifwi6JUb7N
o0A6f2Z47AWJmvq4goHJtnQ3fyoeIsMCAwEAAaNTMFEwHQYDVR0OBBYEFPrBsm6v
M29fKA3is22tK8yHYQaDMB8GA1UdIwQYMBaAFPrBsm6vM29fKA3is22tK8yHYQaD
MA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAJvOwj0Tf8l9AWvf
1ZLyW0K3m5oJAoUayjlLP9q7KHgJHWd4QXxg4ApUDo523m4Own3FwtN06KCMqlxc
luDJi27ghRzZ8bpB9fUujikC1rs1oWYRz/K+JSO1VItan+azm9AQRj+nNepjUiT4
FjvRif+inC4392tcKuwrqiUFmLIggtFZdsLeKUL+hRGCRjY4BZw0d1sjjPtyVNUD
UMVO8pxlCV0NU4Nmt3vulD4YshAXM+Y8yX/vPRnaNGoRrbRgCg2VORRGaZVjQMHD
OLMvqM7pFKnVg0uiSbQ3xbQJ8WeX620zKI0So2+kZt9HoI+46gd7BdNfl7mmd6K7
ydYKuI8=
-----END CERTIFICATE-----

View file

@ -0,0 +1,27 @@
-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEA5T3/gBP/p8MrITJkwwsXNQRULxkMkegpn7eDrlkVAvFEqqUR
2G87CrhmzFgXSxx5Q8MCx2tP6SbSXWMC+rq7zafrFBDrQekp7qE68NfspLR09wpr
6d8RrRYMpqYEH5PPEHZ0F8E1LWhRTvicFvu22kmIqc6lEnT8n4LCyW+EnOrTgBRc
L9bUK1YJtkGDUmNjR8I347LVaMSoy1FIHqTkimTjRrw1yypF4E4xkKFHx6Wu5nT2
wiUDq1+MgI4pOgNUGaSMnyb8afF9Xwx4ugrzczZUDveeOxLqr2p70oNWAhVCaJ/C
LolRvs2jQDp/ZnjsBYma+riCgcm2dDd/Kh4iwwIDAQABAoIBABjiU/vJL/U8AFCI
MdviNlCw+ZprM6wa8Xm+5/JjBR7epb+IT5mY6WXOgoon/c9PdfJfFswi3/fFGQy+
FLK21nAKjEAPXho3fy/CHK3MIon2dMPkQ7aNWlPZkuH8H3J2DwIQeaWieW1GZ50U
64yrIjwrw0P7hHuua0W9YfuPuWt29YpW5g6ilSRE0kdTzoB6TgMzlVRj6RWbxWLX
erwYFesSpLPiQrozK2yywlQsvRV2AxTlf5woJyRTyCqcao5jNZOJJl0mqeGKNKbu
1iYGtZl9aj1XIRxUt+JB2IMKNJasygIp+GRLUDCHKh8RVFwRlVaSNcWbfLDuyNWW
T3lUEjECgYEA84mrs4TLuPfklsQM4WPBdN/2Ud1r0Zn/W8icHcVc/DCFXbcV4aPA
g4yyyyEkyTac2RSbSp+rfUk/pJcG6CVjwaiRIPehdtcLIUP34EdIrwPrPT7/uWVA
o/Hp1ANSILecknQXeE1qDlHVeGAq2k3vAQH2J0m7lMfar7QCBTMTMHcCgYEA8PkO
Uj9+/LoHod2eb4raH29wntis31X5FX/C/8HlmFmQplxfMxpRckzDYQELdHvDggNY
ZQo6pdE22MjCu2bk9AHa2ukMyieWm/mPe46Upr1YV2o5cWnfFFNa/LP2Ii/dWY5V
rFNsHFnrnwcWymX7OKo0Xb8xYnKhKZJAFwSpXxUCgYBPMjXj6wtU20g6vwZxRT9k
AnDXrmmhf7LK5jHefJAAcsbr8t3qwpWYMejypZSQ2nGnJkxZuBLMa0WHAJX+aCpI
j8iiL+USAFxeNPwmswev4lZdVF9Uqtiad9DSYUIT4aHI/nejZ4lVnscMnjlRRIa0
jS6/F/soJtW2zZLangFfgQKBgCOSAAUwDkSsCThhiGOasXv2bT9laI9HF4+O3m/2
ZTfJ8Mo91GesuN0Qa77D8rbtFfz5FXFEw0d6zIfPir8y/xTtuSqbQCIPGfJIMl/g
uhyq0oGE0pnlMOLFMyceQXTmb9wqYIchgVHmDBvbZgfWafEBXt1/vYB0v0ltpzw+
menJAoGBAI0hx3+mrFgA+xJBEk4oexAlro1qbNWoR7BCmLQtd49jG3eZQu4JxWH2
kh58AIXzLl0X9t4pfMYasYL6jBGvw+AqNdo2krpiL7MWEE8w8FP/wibzqmuloziB
T7BZuCZjpcAM0IxLmQeeUK0LF0mihcqvssxveaet46mj7QoA7bGQ
-----END RSA PRIVATE KEY-----

View file

@ -0,0 +1,12 @@
with-expecter: true
dir: internal/mocks
outpkg: mocks
packages:
net:
interfaces:
Listener:
config:
mockname: MockListener
Conn:
config:
mockname: MockConn

View file

@ -0,0 +1,427 @@
// Code generated by mockery v2.43.0. DO NOT EDIT.
package mocks
import (
net "net"
mock "github.com/stretchr/testify/mock"
time "time"
)
// MockConn is an autogenerated mock type for the Conn type
type MockConn struct {
mock.Mock
}
type MockConn_Expecter struct {
mock *mock.Mock
}
func (_m *MockConn) EXPECT() *MockConn_Expecter {
return &MockConn_Expecter{mock: &_m.Mock}
}
// Close provides a mock function with given fields:
func (_m *MockConn) Close() error {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for Close")
}
var r0 error
if rf, ok := ret.Get(0).(func() error); ok {
r0 = rf()
} else {
r0 = ret.Error(0)
}
return r0
}
// MockConn_Close_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Close'
type MockConn_Close_Call struct {
*mock.Call
}
// Close is a helper method to define mock.On call
func (_e *MockConn_Expecter) Close() *MockConn_Close_Call {
return &MockConn_Close_Call{Call: _e.mock.On("Close")}
}
func (_c *MockConn_Close_Call) Run(run func()) *MockConn_Close_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *MockConn_Close_Call) Return(_a0 error) *MockConn_Close_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockConn_Close_Call) RunAndReturn(run func() error) *MockConn_Close_Call {
_c.Call.Return(run)
return _c
}
// LocalAddr provides a mock function with given fields:
func (_m *MockConn) LocalAddr() net.Addr {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for LocalAddr")
}
var r0 net.Addr
if rf, ok := ret.Get(0).(func() net.Addr); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(net.Addr)
}
}
return r0
}
// MockConn_LocalAddr_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LocalAddr'
type MockConn_LocalAddr_Call struct {
*mock.Call
}
// LocalAddr is a helper method to define mock.On call
func (_e *MockConn_Expecter) LocalAddr() *MockConn_LocalAddr_Call {
return &MockConn_LocalAddr_Call{Call: _e.mock.On("LocalAddr")}
}
func (_c *MockConn_LocalAddr_Call) Run(run func()) *MockConn_LocalAddr_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *MockConn_LocalAddr_Call) Return(_a0 net.Addr) *MockConn_LocalAddr_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockConn_LocalAddr_Call) RunAndReturn(run func() net.Addr) *MockConn_LocalAddr_Call {
_c.Call.Return(run)
return _c
}
// Read provides a mock function with given fields: b
func (_m *MockConn) Read(b []byte) (int, error) {
ret := _m.Called(b)
if len(ret) == 0 {
panic("no return value specified for Read")
}
var r0 int
var r1 error
if rf, ok := ret.Get(0).(func([]byte) (int, error)); ok {
return rf(b)
}
if rf, ok := ret.Get(0).(func([]byte) int); ok {
r0 = rf(b)
} else {
r0 = ret.Get(0).(int)
}
if rf, ok := ret.Get(1).(func([]byte) error); ok {
r1 = rf(b)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockConn_Read_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Read'
type MockConn_Read_Call struct {
*mock.Call
}
// Read is a helper method to define mock.On call
// - b []byte
func (_e *MockConn_Expecter) Read(b interface{}) *MockConn_Read_Call {
return &MockConn_Read_Call{Call: _e.mock.On("Read", b)}
}
func (_c *MockConn_Read_Call) Run(run func(b []byte)) *MockConn_Read_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].([]byte))
})
return _c
}
func (_c *MockConn_Read_Call) Return(n int, err error) *MockConn_Read_Call {
_c.Call.Return(n, err)
return _c
}
func (_c *MockConn_Read_Call) RunAndReturn(run func([]byte) (int, error)) *MockConn_Read_Call {
_c.Call.Return(run)
return _c
}
// RemoteAddr provides a mock function with given fields:
func (_m *MockConn) RemoteAddr() net.Addr {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for RemoteAddr")
}
var r0 net.Addr
if rf, ok := ret.Get(0).(func() net.Addr); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(net.Addr)
}
}
return r0
}
// MockConn_RemoteAddr_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoteAddr'
type MockConn_RemoteAddr_Call struct {
*mock.Call
}
// RemoteAddr is a helper method to define mock.On call
func (_e *MockConn_Expecter) RemoteAddr() *MockConn_RemoteAddr_Call {
return &MockConn_RemoteAddr_Call{Call: _e.mock.On("RemoteAddr")}
}
func (_c *MockConn_RemoteAddr_Call) Run(run func()) *MockConn_RemoteAddr_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *MockConn_RemoteAddr_Call) Return(_a0 net.Addr) *MockConn_RemoteAddr_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockConn_RemoteAddr_Call) RunAndReturn(run func() net.Addr) *MockConn_RemoteAddr_Call {
_c.Call.Return(run)
return _c
}
// SetDeadline provides a mock function with given fields: t
func (_m *MockConn) SetDeadline(t time.Time) error {
ret := _m.Called(t)
if len(ret) == 0 {
panic("no return value specified for SetDeadline")
}
var r0 error
if rf, ok := ret.Get(0).(func(time.Time) error); ok {
r0 = rf(t)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockConn_SetDeadline_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetDeadline'
type MockConn_SetDeadline_Call struct {
*mock.Call
}
// SetDeadline is a helper method to define mock.On call
// - t time.Time
func (_e *MockConn_Expecter) SetDeadline(t interface{}) *MockConn_SetDeadline_Call {
return &MockConn_SetDeadline_Call{Call: _e.mock.On("SetDeadline", t)}
}
func (_c *MockConn_SetDeadline_Call) Run(run func(t time.Time)) *MockConn_SetDeadline_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(time.Time))
})
return _c
}
func (_c *MockConn_SetDeadline_Call) Return(_a0 error) *MockConn_SetDeadline_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockConn_SetDeadline_Call) RunAndReturn(run func(time.Time) error) *MockConn_SetDeadline_Call {
_c.Call.Return(run)
return _c
}
// SetReadDeadline provides a mock function with given fields: t
func (_m *MockConn) SetReadDeadline(t time.Time) error {
ret := _m.Called(t)
if len(ret) == 0 {
panic("no return value specified for SetReadDeadline")
}
var r0 error
if rf, ok := ret.Get(0).(func(time.Time) error); ok {
r0 = rf(t)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockConn_SetReadDeadline_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetReadDeadline'
type MockConn_SetReadDeadline_Call struct {
*mock.Call
}
// SetReadDeadline is a helper method to define mock.On call
// - t time.Time
func (_e *MockConn_Expecter) SetReadDeadline(t interface{}) *MockConn_SetReadDeadline_Call {
return &MockConn_SetReadDeadline_Call{Call: _e.mock.On("SetReadDeadline", t)}
}
func (_c *MockConn_SetReadDeadline_Call) Run(run func(t time.Time)) *MockConn_SetReadDeadline_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(time.Time))
})
return _c
}
func (_c *MockConn_SetReadDeadline_Call) Return(_a0 error) *MockConn_SetReadDeadline_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockConn_SetReadDeadline_Call) RunAndReturn(run func(time.Time) error) *MockConn_SetReadDeadline_Call {
_c.Call.Return(run)
return _c
}
// SetWriteDeadline provides a mock function with given fields: t
func (_m *MockConn) SetWriteDeadline(t time.Time) error {
ret := _m.Called(t)
if len(ret) == 0 {
panic("no return value specified for SetWriteDeadline")
}
var r0 error
if rf, ok := ret.Get(0).(func(time.Time) error); ok {
r0 = rf(t)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockConn_SetWriteDeadline_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetWriteDeadline'
type MockConn_SetWriteDeadline_Call struct {
*mock.Call
}
// SetWriteDeadline is a helper method to define mock.On call
// - t time.Time
func (_e *MockConn_Expecter) SetWriteDeadline(t interface{}) *MockConn_SetWriteDeadline_Call {
return &MockConn_SetWriteDeadline_Call{Call: _e.mock.On("SetWriteDeadline", t)}
}
func (_c *MockConn_SetWriteDeadline_Call) Run(run func(t time.Time)) *MockConn_SetWriteDeadline_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(time.Time))
})
return _c
}
func (_c *MockConn_SetWriteDeadline_Call) Return(_a0 error) *MockConn_SetWriteDeadline_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockConn_SetWriteDeadline_Call) RunAndReturn(run func(time.Time) error) *MockConn_SetWriteDeadline_Call {
_c.Call.Return(run)
return _c
}
// Write provides a mock function with given fields: b
func (_m *MockConn) Write(b []byte) (int, error) {
ret := _m.Called(b)
if len(ret) == 0 {
panic("no return value specified for Write")
}
var r0 int
var r1 error
if rf, ok := ret.Get(0).(func([]byte) (int, error)); ok {
return rf(b)
}
if rf, ok := ret.Get(0).(func([]byte) int); ok {
r0 = rf(b)
} else {
r0 = ret.Get(0).(int)
}
if rf, ok := ret.Get(1).(func([]byte) error); ok {
r1 = rf(b)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockConn_Write_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Write'
type MockConn_Write_Call struct {
*mock.Call
}
// Write is a helper method to define mock.On call
// - b []byte
func (_e *MockConn_Expecter) Write(b interface{}) *MockConn_Write_Call {
return &MockConn_Write_Call{Call: _e.mock.On("Write", b)}
}
func (_c *MockConn_Write_Call) Run(run func(b []byte)) *MockConn_Write_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].([]byte))
})
return _c
}
func (_c *MockConn_Write_Call) Return(n int, err error) *MockConn_Write_Call {
_c.Call.Return(n, err)
return _c
}
func (_c *MockConn_Write_Call) RunAndReturn(run func([]byte) (int, error)) *MockConn_Write_Call {
_c.Call.Return(run)
return _c
}
// NewMockConn creates a new instance of MockConn. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewMockConn(t interface {
mock.TestingT
Cleanup(func())
}) *MockConn {
mock := &MockConn{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View file

@ -0,0 +1,185 @@
// Code generated by mockery v2.43.0. DO NOT EDIT.
package mocks
import (
net "net"
mock "github.com/stretchr/testify/mock"
)
// MockListener is an autogenerated mock type for the Listener type
type MockListener struct {
mock.Mock
}
type MockListener_Expecter struct {
mock *mock.Mock
}
func (_m *MockListener) EXPECT() *MockListener_Expecter {
return &MockListener_Expecter{mock: &_m.Mock}
}
// Accept provides a mock function with given fields:
func (_m *MockListener) Accept() (net.Conn, error) {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for Accept")
}
var r0 net.Conn
var r1 error
if rf, ok := ret.Get(0).(func() (net.Conn, error)); ok {
return rf()
}
if rf, ok := ret.Get(0).(func() net.Conn); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(net.Conn)
}
}
if rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockListener_Accept_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Accept'
type MockListener_Accept_Call struct {
*mock.Call
}
// Accept is a helper method to define mock.On call
func (_e *MockListener_Expecter) Accept() *MockListener_Accept_Call {
return &MockListener_Accept_Call{Call: _e.mock.On("Accept")}
}
func (_c *MockListener_Accept_Call) Run(run func()) *MockListener_Accept_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *MockListener_Accept_Call) Return(_a0 net.Conn, _a1 error) *MockListener_Accept_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockListener_Accept_Call) RunAndReturn(run func() (net.Conn, error)) *MockListener_Accept_Call {
_c.Call.Return(run)
return _c
}
// Addr provides a mock function with given fields:
func (_m *MockListener) Addr() net.Addr {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for Addr")
}
var r0 net.Addr
if rf, ok := ret.Get(0).(func() net.Addr); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(net.Addr)
}
}
return r0
}
// MockListener_Addr_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Addr'
type MockListener_Addr_Call struct {
*mock.Call
}
// Addr is a helper method to define mock.On call
func (_e *MockListener_Expecter) Addr() *MockListener_Addr_Call {
return &MockListener_Addr_Call{Call: _e.mock.On("Addr")}
}
func (_c *MockListener_Addr_Call) Run(run func()) *MockListener_Addr_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *MockListener_Addr_Call) Return(_a0 net.Addr) *MockListener_Addr_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockListener_Addr_Call) RunAndReturn(run func() net.Addr) *MockListener_Addr_Call {
_c.Call.Return(run)
return _c
}
// Close provides a mock function with given fields:
func (_m *MockListener) Close() error {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for Close")
}
var r0 error
if rf, ok := ret.Get(0).(func() error); ok {
r0 = rf()
} else {
r0 = ret.Error(0)
}
return r0
}
// MockListener_Close_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Close'
type MockListener_Close_Call struct {
*mock.Call
}
// Close is a helper method to define mock.On call
func (_e *MockListener_Expecter) Close() *MockListener_Close_Call {
return &MockListener_Close_Call{Call: _e.mock.On("Close")}
}
func (_c *MockListener_Close_Call) Run(run func()) *MockListener_Close_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *MockListener_Close_Call) Return(_a0 error) *MockListener_Close_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockListener_Close_Call) RunAndReturn(run func() error) *MockListener_Close_Call {
_c.Call.Return(run)
return _c
}
// NewMockListener creates a new instance of MockListener. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewMockListener(t interface {
mock.TestingT
Cleanup(func())
}) *MockListener {
mock := &MockListener{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View file

@ -0,0 +1,72 @@
package proxymux
import (
"net"
"sync"
"github.com/apernet/hysteria/extras/v2/correctnet"
)
type muxManager struct {
listeners map[string]*muxListener
lock sync.Mutex
}
var globalMuxManager *muxManager
func init() {
globalMuxManager = &muxManager{
listeners: make(map[string]*muxListener),
}
}
func (m *muxManager) GetOrCreate(address string) (*muxListener, error) {
key, err := m.canonicalizeAddrPort(address)
if err != nil {
return nil, err
}
m.lock.Lock()
defer m.lock.Unlock()
if ml, ok := m.listeners[key]; ok {
return ml, nil
}
listener, err := correctnet.Listen("tcp", key)
if err != nil {
return nil, err
}
ml := newMuxListener(listener, func() {
m.lock.Lock()
defer m.lock.Unlock()
delete(m.listeners, key)
})
m.listeners[key] = ml
return ml, nil
}
func (m *muxManager) canonicalizeAddrPort(address string) (string, error) {
taddr, err := net.ResolveTCPAddr("tcp", address)
if err != nil {
return "", err
}
return taddr.String(), nil
}
func ListenHTTP(address string) (net.Listener, error) {
ml, err := globalMuxManager.GetOrCreate(address)
if err != nil {
return nil, err
}
return ml.ListenHTTP()
}
func ListenSOCKS(address string) (net.Listener, error) {
ml, err := globalMuxManager.GetOrCreate(address)
if err != nil {
return nil, err
}
return ml.ListenSOCKS()
}

View file

@ -0,0 +1,110 @@
package proxymux
import (
"net"
"testing"
"time"
"github.com/stretchr/testify/assert"
)
func TestListenSOCKS(t *testing.T) {
address := "127.2.39.129:11081"
sl, err := ListenSOCKS(address)
if !assert.NoError(t, err) {
return
}
defer func() {
sl.Close()
}()
hl, err := ListenHTTP(address)
if !assert.NoError(t, err) {
return
}
defer hl.Close()
_, err = ListenSOCKS(address)
if !assert.ErrorIs(t, err, ErrProtocolInUse) {
return
}
sl.Close()
sl, err = ListenSOCKS(address)
if !assert.NoError(t, err) {
return
}
}
func TestListenHTTP(t *testing.T) {
address := "127.2.39.129:11082"
hl, err := ListenHTTP(address)
if !assert.NoError(t, err) {
return
}
defer func() {
hl.Close()
}()
sl, err := ListenSOCKS(address)
if !assert.NoError(t, err) {
return
}
defer sl.Close()
_, err = ListenHTTP(address)
if !assert.ErrorIs(t, err, ErrProtocolInUse) {
return
}
hl.Close()
hl, err = ListenHTTP(address)
if !assert.NoError(t, err) {
return
}
}
func TestRelease(t *testing.T) {
address := "127.2.39.129:11083"
hl, err := ListenHTTP(address)
if !assert.NoError(t, err) {
return
}
sl, err := ListenSOCKS(address)
if !assert.NoError(t, err) {
return
}
if !assert.True(t, globalMuxManager.testAddressExists(address)) {
return
}
_, err = net.Listen("tcp", address)
if !assert.Error(t, err) {
return
}
hl.Close()
sl.Close()
// Wait for muxListener released
time.Sleep(time.Second)
if !assert.False(t, globalMuxManager.testAddressExists(address)) {
return
}
lis, err := net.Listen("tcp", address)
if !assert.NoError(t, err) {
return
}
defer lis.Close()
}
func (m *muxManager) testAddressExists(address string) bool {
m.lock.Lock()
defer m.lock.Unlock()
_, ok := m.listeners[address]
return ok
}

View file

@ -0,0 +1,320 @@
package proxymux
import (
"errors"
"fmt"
"io"
"net"
"sync"
)
func newMuxListener(listener net.Listener, deleteFunc func()) *muxListener {
l := &muxListener{
base: listener,
acceptChan: make(chan net.Conn),
closeChan: make(chan struct{}),
deleteFunc: deleteFunc,
}
go l.acceptLoop()
go l.mainLoop()
return l
}
type muxListener struct {
lock sync.Mutex
base net.Listener
acceptErr error
acceptChan chan net.Conn
closeChan chan struct{}
socksListener *subListener
httpListener *subListener
deleteFunc func()
}
func (l *muxListener) acceptLoop() {
defer close(l.acceptChan)
for {
conn, err := l.base.Accept()
if err != nil {
l.lock.Lock()
l.acceptErr = err
l.lock.Unlock()
return
}
select {
case <-l.closeChan:
return
case l.acceptChan <- conn:
}
}
}
func (l *muxListener) mainLoop() {
defer func() {
l.deleteFunc()
l.base.Close()
close(l.closeChan)
l.lock.Lock()
defer l.lock.Unlock()
if sl := l.httpListener; sl != nil {
close(sl.acceptChan)
l.httpListener = nil
}
if sl := l.socksListener; sl != nil {
close(sl.acceptChan)
l.socksListener = nil
}
}()
for {
var socksCloseChan, httpCloseChan chan struct{}
if l.httpListener != nil {
httpCloseChan = l.httpListener.closeChan
}
if l.socksListener != nil {
socksCloseChan = l.socksListener.closeChan
}
select {
case <-l.closeChan:
return
case conn, ok := <-l.acceptChan:
if !ok {
return
}
go l.dispatch(conn)
case <-socksCloseChan:
l.lock.Lock()
if socksCloseChan == l.socksListener.closeChan {
// not replaced by another ListenSOCKS()
l.socksListener = nil
}
l.lock.Unlock()
if l.checkIdle() {
return
}
case <-httpCloseChan:
l.lock.Lock()
if httpCloseChan == l.httpListener.closeChan {
// not replaced by another ListenHTTP()
l.httpListener = nil
}
l.lock.Unlock()
if l.checkIdle() {
return
}
}
}
}
func (l *muxListener) dispatch(conn net.Conn) {
var b [1]byte
if _, err := io.ReadFull(conn, b[:]); err != nil {
conn.Close()
return
}
l.lock.Lock()
var target *subListener
if b[0] == 5 {
target = l.socksListener
} else {
target = l.httpListener
}
l.lock.Unlock()
if target == nil {
conn.Close()
return
}
wconn := &connWithOneByte{Conn: conn, b: b[0]}
select {
case <-target.closeChan:
case target.acceptChan <- wconn:
}
}
func (l *muxListener) checkIdle() bool {
l.lock.Lock()
defer l.lock.Unlock()
return l.httpListener == nil && l.socksListener == nil
}
func (l *muxListener) getAndClearAcceptError() error {
l.lock.Lock()
defer l.lock.Unlock()
if l.acceptErr == nil {
return nil
}
err := l.acceptErr
l.acceptErr = nil
return err
}
func (l *muxListener) ListenHTTP() (net.Listener, error) {
l.lock.Lock()
defer l.lock.Unlock()
if l.httpListener != nil {
subListenerPendingClosed := false
select {
case <-l.httpListener.closeChan:
subListenerPendingClosed = true
default:
}
if !subListenerPendingClosed {
return nil, OpErr{
Addr: l.base.Addr(),
Protocol: "http",
Op: "bind-protocol",
Err: ErrProtocolInUse,
}
}
l.httpListener = nil
}
select {
case <-l.closeChan:
return nil, net.ErrClosed
default:
}
sl := newSubListener(l.getAndClearAcceptError, l.base.Addr)
l.httpListener = sl
return sl, nil
}
func (l *muxListener) ListenSOCKS() (net.Listener, error) {
l.lock.Lock()
defer l.lock.Unlock()
if l.socksListener != nil {
subListenerPendingClosed := false
select {
case <-l.socksListener.closeChan:
subListenerPendingClosed = true
default:
}
if !subListenerPendingClosed {
return nil, OpErr{
Addr: l.base.Addr(),
Protocol: "socks",
Op: "bind-protocol",
Err: ErrProtocolInUse,
}
}
l.socksListener = nil
}
select {
case <-l.closeChan:
return nil, net.ErrClosed
default:
}
sl := newSubListener(l.getAndClearAcceptError, l.base.Addr)
l.socksListener = sl
return sl, nil
}
func newSubListener(acceptErrorFunc func() error, addrFunc func() net.Addr) *subListener {
return &subListener{
acceptChan: make(chan net.Conn),
acceptErrorFunc: acceptErrorFunc,
closeChan: make(chan struct{}),
addrFunc: addrFunc,
}
}
type subListener struct {
// receive connections or closure from upstream
acceptChan chan net.Conn
// get an error of Accept() from upstream
acceptErrorFunc func() error
// notify upstream that we are closed
closeChan chan struct{}
// Listener.Addr() implementation of base listener
addrFunc func() net.Addr
}
func (l *subListener) Accept() (net.Conn, error) {
select {
case <-l.closeChan:
// closed by ourselves
return nil, net.ErrClosed
case conn, ok := <-l.acceptChan:
if !ok {
// closed by upstream
if acceptErr := l.acceptErrorFunc(); acceptErr != nil {
return nil, acceptErr
}
return nil, net.ErrClosed
}
return conn, nil
}
}
func (l *subListener) Addr() net.Addr {
return l.addrFunc()
}
// Close implements net.Listener.Close.
// Upstream should use close(l.acceptChan) instead.
func (l *subListener) Close() error {
select {
case <-l.closeChan:
return nil
default:
}
close(l.closeChan)
return nil
}
// connWithOneByte is a net.Conn that returns b for the first read
// request, then forwards everything else to Conn.
type connWithOneByte struct {
net.Conn
b byte
bRead bool
}
func (c *connWithOneByte) Read(bs []byte) (int, error) {
if c.bRead {
return c.Conn.Read(bs)
}
if len(bs) == 0 {
return 0, nil
}
c.bRead = true
bs[0] = c.b
return 1, nil
}
type OpErr struct {
Addr net.Addr
Protocol string
Op string
Err error
}
func (m OpErr) Error() string {
return fmt.Sprintf("mux-listen: %s[%s]: %s: %v", m.Addr, m.Protocol, m.Op, m.Err)
}
func (m OpErr) Unwrap() error {
return m.Err
}
var ErrProtocolInUse = errors.New("protocol already in use")

View file

@ -0,0 +1,154 @@
package proxymux
import (
"bytes"
"net"
"sync"
"testing"
"time"
"github.com/apernet/hysteria/app/v2/internal/proxymux/internal/mocks"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
)
//go:generate mockery
func testMockListener(t *testing.T, connChan <-chan net.Conn) net.Listener {
closedChan := make(chan struct{})
mockListener := mocks.NewMockListener(t)
mockListener.EXPECT().Accept().RunAndReturn(func() (net.Conn, error) {
select {
case <-closedChan:
return nil, net.ErrClosed
case conn, ok := <-connChan:
if !ok {
panic("unexpected closed channel (connChan)")
}
return conn, nil
}
})
mockListener.EXPECT().Close().RunAndReturn(func() error {
select {
case <-closedChan:
default:
close(closedChan)
}
return nil
})
return mockListener
}
func testMockConn(t *testing.T, b []byte) net.Conn {
buf := bytes.NewReader(b)
isClosed := false
mockConn := mocks.NewMockConn(t)
mockConn.EXPECT().Read(mock.Anything).RunAndReturn(func(b []byte) (int, error) {
if isClosed {
return 0, net.ErrClosed
}
return buf.Read(b)
})
mockConn.EXPECT().Close().RunAndReturn(func() error {
isClosed = true
return nil
})
return mockConn
}
func TestMuxHTTP(t *testing.T) {
connChan := make(chan net.Conn)
mockListener := testMockListener(t, connChan)
mockConn := testMockConn(t, []byte("CONNECT example.com:443 HTTP/1.1\r\n\r\n"))
mux := newMuxListener(mockListener, func() {})
hl, err := mux.ListenHTTP()
if !assert.NoError(t, err) {
return
}
sl, err := mux.ListenSOCKS()
if !assert.NoError(t, err) {
return
}
connChan <- mockConn
var socksConn, httpConn net.Conn
var socksErr, httpErr error
var wg sync.WaitGroup
wg.Add(2)
go func() {
socksConn, socksErr = sl.Accept()
wg.Done()
}()
go func() {
httpConn, httpErr = hl.Accept()
wg.Done()
}()
time.Sleep(time.Second)
sl.Close()
hl.Close()
wg.Wait()
assert.Nil(t, socksConn)
assert.ErrorIs(t, socksErr, net.ErrClosed)
assert.NotNil(t, httpConn)
httpConn.Close()
assert.NoError(t, httpErr)
// Wait for muxListener released
<-mux.acceptChan
}
func TestMuxSOCKS(t *testing.T) {
connChan := make(chan net.Conn)
mockListener := testMockListener(t, connChan)
mockConn := testMockConn(t, []byte{0x05, 0x02, 0x00, 0x01}) // SOCKS5 Connect Request: NOAUTH+GSSAPI
mux := newMuxListener(mockListener, func() {})
hl, err := mux.ListenHTTP()
if !assert.NoError(t, err) {
return
}
sl, err := mux.ListenSOCKS()
if !assert.NoError(t, err) {
return
}
connChan <- mockConn
var socksConn, httpConn net.Conn
var socksErr, httpErr error
var wg sync.WaitGroup
wg.Add(2)
go func() {
socksConn, socksErr = sl.Accept()
wg.Done()
}()
go func() {
httpConn, httpErr = hl.Accept()
wg.Done()
}()
time.Sleep(time.Second)
sl.Close()
hl.Close()
wg.Wait()
assert.NotNil(t, socksConn)
socksConn.Close()
assert.NoError(t, socksErr)
assert.Nil(t, httpConn)
assert.ErrorIs(t, httpErr, net.ErrClosed)
// Wait for muxListener released
<-mux.acceptChan
}

View file

@ -0,0 +1,17 @@
//go:build !386
// +build !386
package redirect
import (
"syscall"
"unsafe"
)
func getsockopt(s, level, name uintptr, val unsafe.Pointer, vallen *uint32) (err error) {
_, _, e := syscall.Syscall6(syscall.SYS_GETSOCKOPT, s, level, name, uintptr(val), uintptr(unsafe.Pointer(vallen)), 0)
if e != 0 {
err = e
}
return
}

View file

@ -0,0 +1,23 @@
package redirect
import (
"syscall"
"unsafe"
)
const (
sysGetsockopt = 15
)
// On 386 we cannot call socketcall with syscall.Syscall6, as it always fails with EFAULT.
// Use our own syscall.socketcall hack instead.
func syscall_socketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, err syscall.Errno)
func getsockopt(s, level, name uintptr, val unsafe.Pointer, vallen *uint32) (err error) {
_, e := syscall_socketcall(sysGetsockopt, s, level, name, uintptr(val), uintptr(unsafe.Pointer(vallen)), 0)
if e != 0 {
err = e
}
return
}

View file

@ -0,0 +1,7 @@
//go:build gc
// +build gc
#include "textflag.h"
TEXT ·syscall_socketcall(SB),NOSPLIT,$0-36
JMP syscall·socketcall(SB)

View file

@ -0,0 +1,126 @@
package redirect
import (
"encoding/binary"
"errors"
"io"
"net"
"syscall"
"unsafe"
"github.com/apernet/hysteria/core/v2/client"
)
const (
soOriginalDst = 80
soOriginalDstV6 = 80
)
type TCPRedirect struct {
HyClient client.Client
EventLogger TCPEventLogger
}
type TCPEventLogger interface {
Connect(addr, reqAddr net.Addr)
Error(addr, reqAddr net.Addr, err error)
}
func (r *TCPRedirect) ListenAndServe(laddr *net.TCPAddr) error {
listener, err := net.ListenTCP("tcp", laddr)
if err != nil {
return err
}
defer listener.Close()
for {
c, err := listener.AcceptTCP()
if err != nil {
return err
}
go r.handle(c)
}
}
func (r *TCPRedirect) handle(conn *net.TCPConn) {
defer conn.Close()
dstAddr, err := getDstAddr(conn)
if err != nil {
// Fail silently if we can't get the original destination.
// Maybe we should print something to the log?
return
}
if r.EventLogger != nil {
r.EventLogger.Connect(conn.RemoteAddr(), dstAddr)
}
var closeErr error
defer func() {
if r.EventLogger != nil {
r.EventLogger.Error(conn.RemoteAddr(), dstAddr, closeErr)
}
}()
rc, err := r.HyClient.TCP(dstAddr.String())
if err != nil {
closeErr = err
return
}
defer rc.Close()
// Start forwarding
copyErrChan := make(chan error, 2)
go func() {
_, copyErr := io.Copy(rc, conn)
copyErrChan <- copyErr
}()
go func() {
_, copyErr := io.Copy(conn, rc)
copyErrChan <- copyErr
}()
closeErr = <-copyErrChan
}
type sockAddr struct {
family uint16
port [2]byte // always big endian regardless of platform
data [24]byte // sockaddr_in or sockaddr_in6
}
func getOriginalDst(fd uintptr) (*sockAddr, error) {
var addr sockAddr
addrSize := uint32(unsafe.Sizeof(addr))
// Try IPv6 first
err := getsockopt(fd, syscall.SOL_IPV6, soOriginalDstV6, unsafe.Pointer(&addr), &addrSize)
if err == nil {
return &addr, nil
}
// Then IPv4
err = getsockopt(fd, syscall.SOL_IP, soOriginalDst, unsafe.Pointer(&addr), &addrSize)
return &addr, err
}
// getDstAddr returns the original destination of a redirected TCP connection.
func getDstAddr(conn *net.TCPConn) (*net.TCPAddr, error) {
rc, err := conn.SyscallConn()
if err != nil {
return nil, err
}
var addr *sockAddr
var err2 error
err = rc.Control(func(fd uintptr) {
addr, err2 = getOriginalDst(fd)
})
if err != nil {
return nil, err
}
if err2 != nil {
return nil, err2
}
switch addr.family {
case syscall.AF_INET:
return &net.TCPAddr{IP: addr.data[:4], Port: int(binary.BigEndian.Uint16(addr.port[:]))}, nil
case syscall.AF_INET6:
return &net.TCPAddr{IP: addr.data[4:20], Port: int(binary.BigEndian.Uint16(addr.port[:]))}, nil
default:
return nil, errors.New("address family not IPv4 or IPv6")
}
}

View file

@ -0,0 +1,24 @@
//go:build !linux
package redirect
import (
"errors"
"net"
"github.com/apernet/hysteria/core/v2/client"
)
type TCPRedirect struct {
HyClient client.Client
EventLogger TCPEventLogger
}
type TCPEventLogger interface {
Connect(addr, reqAddr net.Addr)
Error(addr, reqAddr net.Addr, err error)
}
func (r *TCPRedirect) ListenAndServe(laddr *net.TCPAddr) error {
return errors.New("not supported on this platform")
}

View file

@ -0,0 +1,65 @@
import socket
import array
import os
import struct
import sys
def serve(path):
try:
os.unlink(path)
except OSError:
if os.path.exists(path):
raise
server = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
server.bind(path)
server.listen()
print(f"Listening on {path}")
try:
while True:
connection, client_address = server.accept()
print(f"Client connected")
try:
# Receiving fd from client
fds = array.array("i")
msg, ancdata, flags, addr = connection.recvmsg(1, socket.CMSG_LEN(struct.calcsize('i')))
for cmsg_level, cmsg_type, cmsg_data in ancdata:
if cmsg_level == socket.SOL_SOCKET and cmsg_type == socket.SCM_RIGHTS:
fds.frombytes(cmsg_data[:len(cmsg_data) - (len(cmsg_data) % fds.itemsize)])
fd = fds[0]
# We make a call to setsockopt(2) here, so client can verify we have received the fd
# In the real scenario, the server would set things like SO_MARK,
# we use SO_RCVBUF as it doesn't require any special capabilities.
nbytes = struct.pack("i", 2500)
fdsocket = fd_to_socket(fd)
fdsocket.setsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF, nbytes)
fdsocket.close()
# The only protocol-like thing specified in the client implementation.
connection.send(b'\x01')
finally:
connection.close()
print("Connection closed")
except KeyboardInterrupt:
print("Exit")
finally:
server.close()
os.unlink(path)
def fd_to_socket(fd):
return socket.fromfd(fd, socket.AF_UNIX, socket.SOCK_STREAM)
if __name__ == "__main__":
if len(sys.argv) < 2:
raise ValueError("unix socket path is required")
serve(sys.argv[1])

View file

@ -0,0 +1,76 @@
package sockopts
import (
"fmt"
"net"
)
type SocketOptions struct {
BindInterface *string
FirewallMark *uint32
FdControlUnixSocket *string
}
// implemented in platform-specific files
var (
bindInterfaceFunc func(c *net.UDPConn, device string) error
firewallMarkFunc func(c *net.UDPConn, fwmark uint32) error
fdControlUnixSocketFunc func(c *net.UDPConn, path string) error
)
func (o *SocketOptions) CheckSupported() (err error) {
if o.BindInterface != nil && bindInterfaceFunc == nil {
return &UnsupportedError{"bindInterface"}
}
if o.FirewallMark != nil && firewallMarkFunc == nil {
return &UnsupportedError{"fwmark"}
}
if o.FdControlUnixSocket != nil && fdControlUnixSocketFunc == nil {
return &UnsupportedError{"fdControlUnixSocket"}
}
return nil
}
type UnsupportedError struct {
Field string
}
func (e *UnsupportedError) Error() string {
return fmt.Sprintf("%s is not supported on this platform", e.Field)
}
func (o *SocketOptions) ListenUDP() (uconn net.PacketConn, err error) {
uconn, err = net.ListenUDP("udp", nil)
if err != nil {
return
}
err = o.applyToUDPConn(uconn.(*net.UDPConn))
if err != nil {
uconn.Close()
uconn = nil
return
}
return
}
func (o *SocketOptions) applyToUDPConn(c *net.UDPConn) error {
if o.BindInterface != nil && bindInterfaceFunc != nil {
err := bindInterfaceFunc(c, *o.BindInterface)
if err != nil {
return fmt.Errorf("failed to bind to interface: %w", err)
}
}
if o.FirewallMark != nil && firewallMarkFunc != nil {
err := firewallMarkFunc(c, *o.FirewallMark)
if err != nil {
return fmt.Errorf("failed to set fwmark: %w", err)
}
}
if o.FdControlUnixSocket != nil && fdControlUnixSocketFunc != nil {
err := fdControlUnixSocketFunc(c, *o.FdControlUnixSocket)
if err != nil {
return fmt.Errorf("failed to send fd to control unix socket: %w", err)
}
}
return nil
}

View file

@ -0,0 +1,96 @@
//go:build linux
package sockopts
import (
"fmt"
"net"
"time"
"golang.org/x/exp/constraints"
"golang.org/x/sys/unix"
)
const (
fdControlUnixTimeout = 3 * time.Second
)
func init() {
bindInterfaceFunc = bindInterfaceImpl
firewallMarkFunc = firewallMarkImpl
fdControlUnixSocketFunc = fdControlUnixSocketImpl
}
func controlUDPConn(c *net.UDPConn, cb func(fd int) error) (err error) {
rconn, err := c.SyscallConn()
if err != nil {
return
}
cerr := rconn.Control(func(fd uintptr) {
err = cb(int(fd))
})
if err != nil {
return
}
if cerr != nil {
err = fmt.Errorf("failed to control fd: %w", cerr)
return
}
return
}
func bindInterfaceImpl(c *net.UDPConn, device string) error {
return controlUDPConn(c, func(fd int) error {
return unix.BindToDevice(fd, device)
})
}
func firewallMarkImpl(c *net.UDPConn, fwmark uint32) error {
return controlUDPConn(c, func(fd int) error {
return unix.SetsockoptInt(fd, unix.SOL_SOCKET, unix.SO_MARK, int(fwmark))
})
}
func fdControlUnixSocketImpl(c *net.UDPConn, path string) error {
return controlUDPConn(c, func(fd int) error {
socketFd, err := unix.Socket(unix.AF_UNIX, unix.SOCK_STREAM, 0)
if err != nil {
return fmt.Errorf("failed to create unix socket: %w", err)
}
defer unix.Close(socketFd)
var timeout unix.Timeval
timeUsec := fdControlUnixTimeout.Microseconds()
castAssignInteger(timeUsec/1e6, &timeout.Sec)
// Specifying the type explicitly is not necessary here, but it makes GoLand happy.
castAssignInteger[int64](timeUsec%1e6, &timeout.Usec)
_ = unix.SetsockoptTimeval(socketFd, unix.SOL_SOCKET, unix.SO_RCVTIMEO, &timeout)
_ = unix.SetsockoptTimeval(socketFd, unix.SOL_SOCKET, unix.SO_SNDTIMEO, &timeout)
err = unix.Connect(socketFd, &unix.SockaddrUnix{Name: path})
if err != nil {
return fmt.Errorf("failed to connect: %w", err)
}
err = unix.Sendmsg(socketFd, nil, unix.UnixRights(fd), nil, 0)
if err != nil {
return fmt.Errorf("failed to send: %w", err)
}
dummy := []byte{1}
n, err := unix.Read(socketFd, dummy)
if err != nil {
return fmt.Errorf("failed to receive: %w", err)
}
if n != 1 {
return fmt.Errorf("socket closed unexpectedly")
}
return nil
})
}
func castAssignInteger[F, T constraints.Integer](from F, to *T) {
*to = T(from)
}

View file

@ -0,0 +1,53 @@
//go:build linux
package sockopts
import (
"net"
"os"
"os/exec"
"testing"
"time"
"github.com/stretchr/testify/assert"
"golang.org/x/sys/unix"
)
func Test_fdControlUnixSocketImpl(t *testing.T) {
sockPath := "./fd_control_unix_socket_test.sock"
defer os.Remove(sockPath)
// Run test server
cmd := exec.Command("python", "fd_control_unix_socket_test.py", sockPath)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err := cmd.Start()
if !assert.NoError(t, err) {
return
}
defer cmd.Process.Kill()
// Wait for the server to start
time.Sleep(1 * time.Second)
so := SocketOptions{
FdControlUnixSocket: &sockPath,
}
conn, err := so.ListenUDP()
if !assert.NoError(t, err) {
return
}
defer conn.Close()
err = controlUDPConn(conn.(*net.UDPConn), func(fd int) (err error) {
rcvbuf, err := unix.GetsockoptInt(fd, unix.SOL_SOCKET, unix.SO_RCVBUF)
if err != nil {
return
}
// The test server called setsockopt(fd, SOL_SOCKET, SO_RCVBUF, 2500),
// and kernel will double this value for getsockopt().
assert.Equal(t, 5000, rcvbuf)
return
})
assert.NoError(t, err)
}

View file

@ -0,0 +1,300 @@
package socks5
import (
"encoding/binary"
"io"
"net"
"github.com/txthinking/socks5"
"github.com/apernet/hysteria/core/v2/client"
)
const udpBufferSize = 4096
// Server is a SOCKS5 server using a Hysteria client as outbound.
type Server struct {
HyClient client.Client
AuthFunc func(username, password string) bool // nil = no authentication
DisableUDP bool
EventLogger EventLogger
}
type EventLogger interface {
TCPRequest(addr net.Addr, reqAddr string)
TCPError(addr net.Addr, reqAddr string, err error)
UDPRequest(addr net.Addr)
UDPError(addr net.Addr, err error)
}
func (s *Server) Serve(listener net.Listener) error {
for {
conn, err := listener.Accept()
if err != nil {
return err
}
go s.dispatch(conn)
}
}
func (s *Server) dispatch(conn net.Conn) {
ok, _ := s.negotiate(conn)
if !ok {
_ = conn.Close()
return
}
// Negotiation ok, get and handle the request
req, err := socks5.NewRequestFrom(conn)
if err != nil {
_ = conn.Close()
return
}
switch req.Cmd {
case socks5.CmdConnect: // TCP
s.handleTCP(conn, req)
case socks5.CmdUDP: // UDP
if s.DisableUDP {
_ = sendSimpleReply(conn, socks5.RepCommandNotSupported)
_ = conn.Close()
return
}
s.handleUDP(conn, req)
default:
_ = sendSimpleReply(conn, socks5.RepCommandNotSupported)
_ = conn.Close()
}
}
func (s *Server) negotiate(conn net.Conn) (bool, error) {
req, err := socks5.NewNegotiationRequestFrom(conn)
if err != nil {
return false, err
}
var serverMethod byte
if s.AuthFunc != nil {
serverMethod = socks5.MethodUsernamePassword
} else {
serverMethod = socks5.MethodNone
}
// Look for the supported method in the client request
supported := false
for _, m := range req.Methods {
if m == serverMethod {
supported = true
break
}
}
if !supported {
// No supported method found, reject the client
rep := socks5.NewNegotiationReply(socks5.MethodUnsupportAll)
_, err := rep.WriteTo(conn)
return false, err
}
// OK, send the method we chose
rep := socks5.NewNegotiationReply(serverMethod)
_, err = rep.WriteTo(conn)
if err != nil {
return false, err
}
// If we chose the username/password method, authenticate the client
if serverMethod == socks5.MethodUsernamePassword {
req, err := socks5.NewUserPassNegotiationRequestFrom(conn)
if err != nil {
return false, err
}
ok := s.AuthFunc(string(req.Uname), string(req.Passwd))
if ok {
rep := socks5.NewUserPassNegotiationReply(socks5.UserPassStatusSuccess)
_, err := rep.WriteTo(conn)
if err != nil {
return false, err
}
} else {
rep := socks5.NewUserPassNegotiationReply(socks5.UserPassStatusFailure)
_, err := rep.WriteTo(conn)
return false, err
}
}
return true, nil
}
func (s *Server) handleTCP(conn net.Conn, req *socks5.Request) {
defer conn.Close()
addr := req.Address()
// TCP request & error log
if s.EventLogger != nil {
s.EventLogger.TCPRequest(conn.RemoteAddr(), addr)
}
var closeErr error
defer func() {
if s.EventLogger != nil {
s.EventLogger.TCPError(conn.RemoteAddr(), addr, closeErr)
}
}()
// Dial
rConn, err := s.HyClient.TCP(addr)
if err != nil {
_ = sendSimpleReply(conn, socks5.RepHostUnreachable)
closeErr = err
return
}
defer rConn.Close()
// Send reply and start relaying
_ = sendSimpleReply(conn, socks5.RepSuccess)
copyErrChan := make(chan error, 2)
go func() {
_, err := io.Copy(rConn, conn)
copyErrChan <- err
}()
go func() {
_, err := io.Copy(conn, rConn)
copyErrChan <- err
}()
closeErr = <-copyErrChan
}
func (s *Server) handleUDP(conn net.Conn, req *socks5.Request) {
defer conn.Close()
// UDP request & error log
if s.EventLogger != nil {
s.EventLogger.UDPRequest(conn.RemoteAddr())
}
var closeErr error
defer func() {
if s.EventLogger != nil {
s.EventLogger.UDPError(conn.RemoteAddr(), closeErr)
}
}()
// Start UDP relay server
// SOCKS5 UDP requires the server to return the UDP bind address and port in the reply.
// We bind to the same address that our TCP server listens on (but a different port).
host, _, err := net.SplitHostPort(conn.LocalAddr().String())
if err != nil {
// Is this even possible?
_ = sendSimpleReply(conn, socks5.RepServerFailure)
closeErr = err
return
}
udpAddr, err := net.ResolveUDPAddr("udp", net.JoinHostPort(host, "0"))
if err != nil {
_ = sendSimpleReply(conn, socks5.RepServerFailure)
closeErr = err
return
}
udpConn, err := net.ListenUDP("udp", udpAddr)
if err != nil {
_ = sendSimpleReply(conn, socks5.RepServerFailure)
closeErr = err
return
}
defer udpConn.Close()
// HyClient UDP session
hyUDP, err := s.HyClient.UDP()
if err != nil {
_ = sendSimpleReply(conn, socks5.RepServerFailure)
closeErr = err
return
}
defer hyUDP.Close()
// Send reply
_ = sendUDPReply(conn, udpConn.LocalAddr().(*net.UDPAddr))
// UDP relay & SOCKS5 connection holder
errChan := make(chan error, 2)
go func() {
err := s.udpServer(udpConn, hyUDP)
errChan <- err
}()
go func() {
_, err := io.Copy(io.Discard, conn)
errChan <- err
}()
closeErr = <-errChan
}
func (s *Server) udpServer(udpConn *net.UDPConn, hyUDP client.HyUDPConn) error {
var clientAddr *net.UDPAddr
buf := make([]byte, udpBufferSize)
// local -> remote
for {
n, cAddr, err := udpConn.ReadFromUDP(buf)
if err != nil {
return err
}
d, err := socks5.NewDatagramFromBytes(buf[:n])
if err != nil || d.Frag != 0 {
// Ignore bad packets
// Also we don't support SOCKS5 UDP fragmentation for now
continue
}
if clientAddr == nil {
// Before the first packet, we don't know what IP the client will use to send us packets,
// so we don't know what IP to return packets to.
// We treat whoever sends us the first packet as our client.
clientAddr = cAddr
// Now that we know the client's address, we can start the
// remote -> local direction.
go func() {
for {
bs, from, err := hyUDP.Receive()
if err != nil {
// Close the UDP conn so that the local -> remote direction will exit
_ = udpConn.Close()
return
}
atyp, addr, port, err := socks5.ParseAddress(from)
if err != nil {
continue
}
if atyp == socks5.ATYPDomain {
// socks5.ParseAddress adds a leading byte for domains,
// but socks5.NewDatagram will add it again as it expects a raw domain.
// So we must remove it here.
addr = addr[1:]
}
d := socks5.NewDatagram(atyp, addr, port, bs)
_, _ = udpConn.WriteToUDP(d.Bytes(), clientAddr)
}
}()
} else if !clientAddr.IP.Equal(cAddr.IP) || clientAddr.Port != cAddr.Port {
// Not our client, ignore
continue
}
// Send to remote
_ = hyUDP.Send(d.Data, d.Address())
}
}
// sendSimpleReply sends a SOCKS5 reply with the given reply code.
// It does not contain bind address or port, so it's not suitable for successful UDP requests.
func sendSimpleReply(conn net.Conn, rep byte) error {
p := socks5.NewReply(rep, socks5.ATYPIPv4, []byte{0x00, 0x00, 0x00, 0x00}, []byte{0x00, 0x00})
_, err := p.WriteTo(conn)
return err
}
// sendUDPReply sends a SOCKS5 reply with the given reply code and bind address/port.
func sendUDPReply(conn net.Conn, addr *net.UDPAddr) error {
var atyp byte
var bndAddr, bndPort []byte
if ip4 := addr.IP.To4(); ip4 != nil {
atyp = socks5.ATYPIPv4
bndAddr = ip4
} else {
atyp = socks5.ATYPIPv6
bndAddr = addr.IP
}
bndPort = make([]byte, 2)
binary.BigEndian.PutUint16(bndPort, uint16(addr.Port))
p := socks5.NewReply(socks5.RepSuccess, atyp, bndAddr, bndPort)
_, err := p.WriteTo(conn)
return err
}

View file

@ -0,0 +1,29 @@
package socks5
import (
"net"
"os/exec"
"strings"
"testing"
"github.com/stretchr/testify/assert"
"github.com/apernet/hysteria/app/v2/internal/utils_test"
)
func TestServer(t *testing.T) {
// Start the server
l, err := net.Listen("tcp", "127.0.0.1:11080")
assert.NoError(t, err)
defer l.Close()
s := &Server{
HyClient: &utils_test.MockEchoHyClient{},
}
go s.Serve(l)
// Run the Python test script
cmd := exec.Command("python", "server_test.py")
out, err := cmd.CombinedOutput()
assert.NoError(t, err)
assert.Equal(t, "OK", strings.TrimSpace(string(out)))
}

View file

@ -0,0 +1,57 @@
import socket
import socks
import os
ADDR = "127.0.0.1"
PORT = 11080
def test_tcp(size, count, it, domain=False):
for i in range(it):
s = socks.socksocket(socket.AF_INET, socket.SOCK_STREAM)
s.set_proxy(socks.SOCKS5, ADDR, PORT)
if domain:
s.connect(("test.tcp.com", 12345))
else:
s.connect(("1.2.3.4", 12345))
for j in range(count):
payload = os.urandom(size)
s.send(payload)
rsp = s.recv(size)
assert rsp == payload
s.close()
def test_udp(size, count, it, domain=False):
for i in range(it):
s = socks.socksocket(socket.AF_INET, socket.SOCK_DGRAM)
s.set_proxy(socks.SOCKS5, ADDR, PORT)
for j in range(count):
payload = os.urandom(size)
if domain:
s.sendto(payload, ("test.udp.com", 12345))
else:
s.sendto(payload, ("1.2.3.4", 12345))
rsp, addr = s.recvfrom(size)
assert rsp == payload
if domain:
assert addr == (b"test.udp.com", 12345)
else:
assert addr == ("1.2.3.4", 12345)
s.close()
if __name__ == "__main__":
test_tcp(1024, 1024, 10, domain=False)
test_tcp(1024, 1024, 10, domain=True)
test_udp(1024, 1024, 10, domain=False)
test_udp(1024, 1024, 10, domain=True)
print("OK")

View file

@ -0,0 +1,69 @@
package tproxy
import (
"io"
"net"
"github.com/apernet/go-tproxy"
"github.com/apernet/hysteria/core/v2/client"
)
type TCPTProxy struct {
HyClient client.Client
EventLogger TCPEventLogger
}
type TCPEventLogger interface {
Connect(addr, reqAddr net.Addr)
Error(addr, reqAddr net.Addr, err error)
}
func (r *TCPTProxy) ListenAndServe(laddr *net.TCPAddr) error {
listener, err := tproxy.ListenTCP("tcp", laddr)
if err != nil {
return err
}
defer listener.Close()
for {
c, err := listener.Accept()
if err != nil {
return err
}
go r.handle(c)
}
}
func (r *TCPTProxy) handle(conn net.Conn) {
defer conn.Close()
// In TProxy mode, we are masquerading as the remote server.
// So LocalAddr is actually the target the user is trying to connect to,
// and RemoteAddr is the local address.
if r.EventLogger != nil {
r.EventLogger.Connect(conn.RemoteAddr(), conn.LocalAddr())
}
var closeErr error
defer func() {
if r.EventLogger != nil {
r.EventLogger.Error(conn.RemoteAddr(), conn.LocalAddr(), closeErr)
}
}()
rc, err := r.HyClient.TCP(conn.LocalAddr().String())
if err != nil {
closeErr = err
return
}
defer rc.Close()
// Start forwarding
copyErrChan := make(chan error, 2)
go func() {
_, copyErr := io.Copy(rc, conn)
copyErrChan <- copyErr
}()
go func() {
_, copyErr := io.Copy(conn, rc)
copyErrChan <- copyErr
}()
closeErr = <-copyErrChan
}

View file

@ -0,0 +1,24 @@
//go:build !linux
package tproxy
import (
"errors"
"net"
"github.com/apernet/hysteria/core/v2/client"
)
type TCPTProxy struct {
HyClient client.Client
EventLogger TCPEventLogger
}
type TCPEventLogger interface {
Connect(addr, reqAddr net.Addr)
Error(addr, reqAddr net.Addr, err error)
}
func (r *TCPTProxy) ListenAndServe(laddr *net.TCPAddr) error {
return errors.New("not supported on this platform")
}

View file

@ -0,0 +1,140 @@
package tproxy
import (
"errors"
"net"
"time"
"github.com/apernet/go-tproxy"
"github.com/apernet/hysteria/core/v2/client"
)
const (
udpBufferSize = 4096
defaultTimeout = 60 * time.Second
)
type UDPTProxy struct {
HyClient client.Client
Timeout time.Duration
EventLogger UDPEventLogger
}
type UDPEventLogger interface {
Connect(addr, reqAddr net.Addr)
Error(addr, reqAddr net.Addr, err error)
}
func (r *UDPTProxy) ListenAndServe(laddr *net.UDPAddr) error {
conn, err := tproxy.ListenUDP("udp", laddr)
if err != nil {
return err
}
defer conn.Close()
buf := make([]byte, udpBufferSize)
for {
// We will only get the first packet of each src/dst pair here,
// because newPair will create a TProxy connection and take over
// the src/dst pair. Later packets will be sent there instead of here.
n, srcAddr, dstAddr, err := tproxy.ReadFromUDP(conn, buf)
if err != nil {
return err
}
r.newPair(srcAddr, dstAddr, buf[:n])
}
}
func (r *UDPTProxy) newPair(srcAddr, dstAddr *net.UDPAddr, initPkt []byte) {
if r.EventLogger != nil {
r.EventLogger.Connect(srcAddr, dstAddr)
}
var closeErr error
defer func() {
// If closeErr is nil, it means we at least successfully sent the first packet
// and started forwarding, in which case we don't call the error logger.
if r.EventLogger != nil && closeErr != nil {
r.EventLogger.Error(srcAddr, dstAddr, closeErr)
}
}()
conn, err := tproxy.DialUDP("udp", dstAddr, srcAddr)
if err != nil {
closeErr = err
return
}
hyConn, err := r.HyClient.UDP()
if err != nil {
_ = conn.Close()
closeErr = err
return
}
// Send the first packet
err = hyConn.Send(initPkt, dstAddr.String())
if err != nil {
_ = conn.Close()
_ = hyConn.Close()
closeErr = err
return
}
// Start forwarding
go func() {
err := r.forwarding(conn, hyConn, dstAddr.String())
_ = conn.Close()
_ = hyConn.Close()
if r.EventLogger != nil {
var netErr net.Error
if errors.As(err, &netErr) && netErr.Timeout() {
// We don't consider deadline exceeded (timeout) an error
err = nil
}
r.EventLogger.Error(srcAddr, dstAddr, err)
}
}()
}
func (r *UDPTProxy) forwarding(conn *net.UDPConn, hyConn client.HyUDPConn, dst string) error {
errChan := make(chan error, 2)
// Local <- Remote
go func() {
for {
bs, _, err := hyConn.Receive()
if err != nil {
errChan <- err
return
}
_, err = conn.Write(bs)
if err != nil {
errChan <- err
return
}
_ = r.updateConnDeadline(conn)
}
}()
// Local -> Remote
go func() {
buf := make([]byte, udpBufferSize)
for {
_ = r.updateConnDeadline(conn)
n, err := conn.Read(buf)
if n > 0 {
err := hyConn.Send(buf[:n], dst)
if err != nil {
errChan <- err
return
}
}
if err != nil {
errChan <- err
return
}
}
}()
return <-errChan
}
func (r *UDPTProxy) updateConnDeadline(conn *net.UDPConn) error {
if r.Timeout == 0 {
return conn.SetReadDeadline(time.Now().Add(defaultTimeout))
} else {
return conn.SetReadDeadline(time.Now().Add(r.Timeout))
}
}

View file

@ -0,0 +1,26 @@
//go:build !linux
package tproxy
import (
"errors"
"net"
"time"
"github.com/apernet/hysteria/core/v2/client"
)
type UDPTProxy struct {
HyClient client.Client
Timeout time.Duration
EventLogger UDPEventLogger
}
type UDPEventLogger interface {
Connect(addr, reqAddr net.Addr)
Error(addr, reqAddr net.Addr, err error)
}
func (r *UDPTProxy) ListenAndServe(laddr *net.UDPAddr) error {
return errors.New("not supported on this platform")
}

View file

@ -0,0 +1,14 @@
//go:build !unix && !windows
package tun
import "net"
func isIPv6Supported() bool {
lis, err := net.ListenPacket("udp6", "[::1]:0")
if err != nil {
return false
}
_ = lis.Close()
return true
}

View file

@ -0,0 +1,16 @@
//go:build unix
package tun
import (
"golang.org/x/sys/unix"
)
func isIPv6Supported() bool {
sock, err := unix.Socket(unix.AF_INET6, unix.SOCK_DGRAM, unix.IPPROTO_UDP)
if err != nil {
return false
}
_ = unix.Close(sock)
return true
}

View file

@ -0,0 +1,24 @@
//go:build windows
package tun
import (
"golang.org/x/sys/windows"
)
func isIPv6Supported() bool {
var wsaData windows.WSAData
err := windows.WSAStartup(uint32(0x202), &wsaData)
if err != nil {
// Failing silently: it is not our duty to report such errors
return true
}
defer windows.WSACleanup()
sock, err := windows.Socket(windows.AF_INET6, windows.SOCK_DGRAM, windows.IPPROTO_UDP)
if err != nil {
return false
}
_ = windows.Closesocket(sock)
return true
}

77
app/internal/tun/log.go Normal file
View file

@ -0,0 +1,77 @@
package tun
import (
"github.com/sagernet/sing/common/logger"
"go.uber.org/zap"
)
var _ logger.Logger = (*singLogger)(nil)
type singLogger struct {
tag string
zapLogger *zap.Logger
}
func extractSingExceptions(args []any) {
for i, arg := range args {
if err, ok := arg.(error); ok {
args[i] = err.Error()
}
}
}
func (l *singLogger) Trace(args ...any) {
if l.zapLogger == nil {
return
}
extractSingExceptions(args)
l.zapLogger.Debug(l.tag, zap.Any("args", args))
}
func (l *singLogger) Debug(args ...any) {
if l.zapLogger == nil {
return
}
extractSingExceptions(args)
l.zapLogger.Debug(l.tag, zap.Any("args", args))
}
func (l *singLogger) Info(args ...any) {
if l.zapLogger == nil {
return
}
extractSingExceptions(args)
l.zapLogger.Info(l.tag, zap.Any("args", args))
}
func (l *singLogger) Warn(args ...any) {
if l.zapLogger == nil {
return
}
extractSingExceptions(args)
l.zapLogger.Warn(l.tag, zap.Any("args", args))
}
func (l *singLogger) Error(args ...any) {
if l.zapLogger == nil {
return
}
extractSingExceptions(args)
l.zapLogger.Error(l.tag, zap.Any("args", args))
}
func (l *singLogger) Fatal(args ...any) {
if l.zapLogger == nil {
return
}
extractSingExceptions(args)
l.zapLogger.Fatal(l.tag, zap.Any("args", args))
}
func (l *singLogger) Panic(args ...any) {
if l.zapLogger == nil {
return
}
extractSingExceptions(args)
l.zapLogger.Panic(l.tag, zap.Any("args", args))
}

234
app/internal/tun/server.go Normal file
View file

@ -0,0 +1,234 @@
package tun
import (
"context"
"fmt"
"io"
"net"
"net/netip"
tun "github.com/apernet/sing-tun"
"github.com/sagernet/sing/common/buf"
"github.com/sagernet/sing/common/control"
"github.com/sagernet/sing/common/metadata"
"github.com/sagernet/sing/common/network"
"go.uber.org/zap"
"github.com/apernet/hysteria/core/v2/client"
)
type Server struct {
HyClient client.Client
EventLogger EventLogger
// for debugging
Logger *zap.Logger
IfName string
MTU uint32
Timeout int64 // in seconds, also applied to TCP in system stack
// required by system stack
Inet4Address []netip.Prefix
Inet6Address []netip.Prefix
// auto route
AutoRoute bool
StructRoute bool
Inet4RouteAddress []netip.Prefix
Inet6RouteAddress []netip.Prefix
Inet4RouteExcludeAddress []netip.Prefix
Inet6RouteExcludeAddress []netip.Prefix
}
type EventLogger interface {
TCPRequest(addr, reqAddr string)
TCPError(addr, reqAddr string, err error)
UDPRequest(addr string)
UDPError(addr string, err error)
}
func (s *Server) Serve() error {
if !isIPv6Supported() {
s.Logger.Warn("tun-pre-check", zap.String("msg", "IPv6 is not supported or enabled on this system, TUN device is created without IPv6 support."))
s.Inet6Address = nil
}
tunOpts := tun.Options{
Name: s.IfName,
Inet4Address: s.Inet4Address,
Inet6Address: s.Inet6Address,
MTU: s.MTU,
GSO: true,
AutoRoute: s.AutoRoute,
StrictRoute: s.StructRoute,
Inet4RouteAddress: s.Inet4RouteAddress,
Inet6RouteAddress: s.Inet6RouteAddress,
Inet4RouteExcludeAddress: s.Inet4RouteExcludeAddress,
Inet6RouteExcludeAddress: s.Inet6RouteExcludeAddress,
Logger: &singLogger{
tag: "tun",
zapLogger: s.Logger,
},
}
tunIf, err := tun.New(tunOpts)
if err != nil {
return fmt.Errorf("failed to create tun interface: %w", err)
}
defer tunIf.Close()
tunStack, err := tun.NewSystem(tun.StackOptions{
Context: context.Background(),
Tun: tunIf,
TunOptions: tunOpts,
UDPTimeout: s.Timeout,
Handler: &tunHandler{s},
Logger: &singLogger{
tag: "tun-stack",
zapLogger: s.Logger,
},
ForwarderBindInterface: true,
InterfaceFinder: &interfaceFinder{},
})
if err != nil {
return fmt.Errorf("failed to create tun stack: %w", err)
}
defer tunStack.Close()
return tunStack.(tun.StackRunner).Run()
}
type tunHandler struct {
*Server
}
var _ tun.Handler = (*tunHandler)(nil)
func (t *tunHandler) NewConnection(ctx context.Context, conn net.Conn, m metadata.Metadata) error {
addr := m.Source.String()
reqAddr := m.Destination.String()
if t.EventLogger != nil {
t.EventLogger.TCPRequest(addr, reqAddr)
}
var closeErr error
defer func() {
if t.EventLogger != nil {
t.EventLogger.TCPError(addr, reqAddr, closeErr)
}
}()
rc, err := t.HyClient.TCP(reqAddr)
if err != nil {
closeErr = err
// the returned err is ignored by caller
return nil
}
defer rc.Close()
// start forwarding
copyErrChan := make(chan error, 3)
go func() {
<-ctx.Done()
copyErrChan <- ctx.Err()
}()
go func() {
_, copyErr := io.Copy(rc, conn)
copyErrChan <- copyErr
}()
go func() {
_, copyErr := io.Copy(conn, rc)
copyErrChan <- copyErr
}()
closeErr = <-copyErrChan
return nil
}
func (t *tunHandler) NewPacketConnection(ctx context.Context, conn network.PacketConn, m metadata.Metadata) error {
addr := m.Source.String()
if t.EventLogger != nil {
t.EventLogger.UDPRequest(addr)
}
var closeErr error
defer func() {
if t.EventLogger != nil {
t.EventLogger.UDPError(addr, closeErr)
}
}()
rc, err := t.HyClient.UDP()
if err != nil {
closeErr = err
// the returned err is simply called into NewError again
return nil
}
defer rc.Close()
// start forwarding
copyErrChan := make(chan error, 3)
go func() {
<-ctx.Done()
copyErrChan <- ctx.Err()
}()
// local <- remote
go func() {
for {
bs, from, err := rc.Receive()
if err != nil {
copyErrChan <- err
return
}
var fromAddr metadata.Socksaddr
if ap, perr := netip.ParseAddrPort(from); perr == nil {
fromAddr = metadata.SocksaddrFromNetIP(ap)
} else {
fromAddr.Fqdn = from
}
err = conn.WritePacket(buf.As(bs), fromAddr)
if err != nil {
copyErrChan <- err
return
}
}
}()
// local -> remote
go func() {
buffer := buf.NewPacket()
defer buffer.Release()
for {
buffer.Reset()
addr, err := conn.ReadPacket(buffer)
if err != nil {
copyErrChan <- err
return
}
err = rc.Send(buffer.Bytes(), addr.String())
if err != nil {
copyErrChan <- err
return
}
}
}()
closeErr = <-copyErrChan
return nil
}
func (t *tunHandler) NewError(ctx context.Context, err error) {
// unused
}
type interfaceFinder struct{}
var _ control.InterfaceFinder = (*interfaceFinder)(nil)
func (f *interfaceFinder) InterfaceIndexByName(name string) (int, error) {
ifce, err := net.InterfaceByName(name)
if err != nil {
return -1, err
}
return ifce.Index, nil
}
func (f *interfaceFinder) InterfaceNameByIndex(index int) (string, error) {
ifce, err := net.InterfaceByIndex(index)
if err != nil {
return "", err
}
return ifce.Name, nil
}

1270
app/internal/url/url.go Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,91 @@
package url
import (
"reflect"
"testing"
)
func TestParse(t *testing.T) {
type args struct {
rawURL string
}
tests := []struct {
name string
args args
want *URL
wantErr bool
}{
{
name: "no port",
args: args{
rawURL: "hysteria2://ganggang@icecreamsogood/",
},
want: &URL{
Scheme: "hysteria2",
User: User("ganggang"),
Host: "icecreamsogood",
Path: "/",
},
},
{
name: "single port",
args: args{
rawURL: "hysteria2://yesyes@icecreamsogood:8888/",
},
want: &URL{
Scheme: "hysteria2",
User: User("yesyes"),
Host: "icecreamsogood:8888",
Path: "/",
},
},
{
name: "multi port",
args: args{
rawURL: "hysteria2://darkness@laplus.org:8888,9999,11111/",
},
want: &URL{
Scheme: "hysteria2",
User: User("darkness"),
Host: "laplus.org:8888,9999,11111",
Path: "/",
},
},
{
name: "range port",
args: args{
rawURL: "hysteria2://darkness@laplus.org:8888-9999/",
},
want: &URL{
Scheme: "hysteria2",
User: User("darkness"),
Host: "laplus.org:8888-9999",
Path: "/",
},
},
{
name: "both",
args: args{
rawURL: "hysteria2://gawr:gura@atlantis.moe:443,7788-8899,10010/",
},
want: &URL{
Scheme: "hysteria2",
User: UserPassword("gawr", "gura"),
Host: "atlantis.moe:443,7788-8899,10010",
Path: "/",
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got, err := Parse(tt.args.rawURL)
if (err != nil) != tt.wantErr {
t.Errorf("Parse() error = %v, wantErr %v", err, tt.wantErr)
return
}
if !reflect.DeepEqual(got, tt.want) {
t.Errorf("Parse() got = %v, want %v", got, tt.want)
}
})
}
}

View file

@ -0,0 +1,68 @@
package utils
import (
"errors"
"fmt"
"strconv"
"strings"
)
const (
Byte = 1
Kilobyte = Byte * 1000
Megabyte = Kilobyte * 1000
Gigabyte = Megabyte * 1000
Terabyte = Gigabyte * 1000
)
// StringToBps converts a string to a bandwidth value in bytes per second.
// E.g. "100 Mbps", "512 kbps", "1g" are all valid.
func StringToBps(s string) (uint64, error) {
s = strings.ToLower(strings.TrimSpace(s))
spl := 0
for i, c := range s {
if c < '0' || c > '9' {
spl = i
break
}
}
if spl == 0 {
// No unit or no value
return 0, errors.New("invalid format")
}
v, err := strconv.ParseUint(s[:spl], 10, 64)
if err != nil {
return 0, err
}
unit := strings.TrimSpace(s[spl:])
switch strings.ToLower(unit) {
case "b", "bps":
return v * Byte / 8, nil
case "k", "kb", "kbps":
return v * Kilobyte / 8, nil
case "m", "mb", "mbps":
return v * Megabyte / 8, nil
case "g", "gb", "gbps":
return v * Gigabyte / 8, nil
case "t", "tb", "tbps":
return v * Terabyte / 8, nil
default:
return 0, errors.New("unsupported unit")
}
}
// ConvBandwidth handles both string and int types for bandwidth.
// When using string, it will be parsed as a bandwidth string with units.
// When using int, it will be parsed as a raw bandwidth in bytes per second.
// It does NOT support float types.
func ConvBandwidth(bw interface{}) (uint64, error) {
switch bwT := bw.(type) {
case string:
return StringToBps(bwT)
case int:
return uint64(bwT), nil
default:
return 0, fmt.Errorf("invalid type %T for bandwidth", bwT)
}
}

View file

@ -0,0 +1,40 @@
package utils
import "testing"
func TestStringToBps(t *testing.T) {
type args struct {
s string
}
tests := []struct {
name string
args args
want uint64
wantErr bool
}{
{"bps", args{"800 bps"}, 100, false},
{"kbps", args{"800 kbps"}, 100_000, false},
{"mbps", args{"800 mbps"}, 100_000_000, false},
{"gbps", args{"800 gbps"}, 100_000_000_000, false},
{"tbps", args{"800 tbps"}, 100_000_000_000_000, false},
{"mbps simp", args{"100m"}, 12_500_000, false},
{"gbps simp upper", args{"2G"}, 250_000_000, false},
{"invalid 1", args{"damn"}, 0, true},
{"invalid 2", args{"6444"}, 0, true},
{"invalid 3", args{"5.4 mbps"}, 0, true},
{"invalid 4", args{"kbps"}, 0, true},
{"invalid 5", args{"1234 5678 gbps"}, 0, true},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got, err := StringToBps(tt.args.s)
if (err != nil) != tt.wantErr {
t.Errorf("StringToBps() error = %v, wantErr %v", err, tt.wantErr)
return
}
if got != tt.want {
t.Errorf("StringToBps() got = %v, want %v", got, tt.want)
}
})
}
}

View file

@ -0,0 +1,198 @@
package utils
import (
"crypto/tls"
"crypto/x509"
"fmt"
"net"
"os"
"strings"
"sync"
"sync/atomic"
"time"
)
type LocalCertificateLoader struct {
CertFile string
KeyFile string
SNIGuard SNIGuardFunc
lock sync.Mutex
cache atomic.Pointer[localCertificateCache]
}
type SNIGuardFunc func(info *tls.ClientHelloInfo, cert *tls.Certificate) error
// localCertificateCache holds the certificate and its mod times.
// this struct is designed to be read-only.
//
// to update the cache, use LocalCertificateLoader.makeCache and
// update the LocalCertificateLoader.cache field.
type localCertificateCache struct {
certificate *tls.Certificate
certModTime time.Time
keyModTime time.Time
}
func (l *LocalCertificateLoader) InitializeCache() error {
l.lock.Lock()
defer l.lock.Unlock()
cache, err := l.makeCache()
if err != nil {
return err
}
l.cache.Store(cache)
return nil
}
func (l *LocalCertificateLoader) GetCertificate(info *tls.ClientHelloInfo) (*tls.Certificate, error) {
cert, err := l.getCertificateWithCache()
if err != nil {
return nil, err
}
if l.SNIGuard == nil {
return cert, nil
}
err = l.SNIGuard(info, cert)
if err != nil {
return nil, err
}
return cert, nil
}
func (l *LocalCertificateLoader) checkModTime() (certModTime, keyModTime time.Time, err error) {
fi, err := os.Stat(l.CertFile)
if err != nil {
err = fmt.Errorf("failed to stat certificate file: %w", err)
return
}
certModTime = fi.ModTime()
fi, err = os.Stat(l.KeyFile)
if err != nil {
err = fmt.Errorf("failed to stat key file: %w", err)
return
}
keyModTime = fi.ModTime()
return
}
func (l *LocalCertificateLoader) makeCache() (cache *localCertificateCache, err error) {
c := &localCertificateCache{}
c.certModTime, c.keyModTime, err = l.checkModTime()
if err != nil {
return
}
cert, err := tls.LoadX509KeyPair(l.CertFile, l.KeyFile)
if err != nil {
return
}
c.certificate = &cert
if c.certificate.Leaf == nil {
// certificate.Leaf was left nil by tls.LoadX509KeyPair before Go 1.23
c.certificate.Leaf, err = x509.ParseCertificate(cert.Certificate[0])
if err != nil {
return
}
}
cache = c
return
}
func (l *LocalCertificateLoader) getCertificateWithCache() (*tls.Certificate, error) {
cache := l.cache.Load()
certModTime, keyModTime, terr := l.checkModTime()
if terr != nil {
if cache != nil {
// use cache when file is temporarily unavailable
return cache.certificate, nil
}
return nil, terr
}
if cache != nil && cache.certModTime.Equal(certModTime) && cache.keyModTime.Equal(keyModTime) {
// cache is up-to-date
return cache.certificate, nil
}
if cache != nil {
if !l.lock.TryLock() {
// another goroutine is updating the cache
return cache.certificate, nil
}
} else {
l.lock.Lock()
}
defer l.lock.Unlock()
if l.cache.Load() != cache {
// another goroutine updated the cache
return l.cache.Load().certificate, nil
}
newCache, err := l.makeCache()
if err != nil {
if cache != nil {
// use cache when loading failed
return cache.certificate, nil
}
return nil, err
}
l.cache.Store(newCache)
return newCache.certificate, nil
}
// getNameFromClientHello returns a normalized form of hello.ServerName.
// If hello.ServerName is empty (i.e. client did not use SNI), then the
// associated connection's local address is used to extract an IP address.
//
// ref: https://github.com/caddyserver/certmagic/blob/3bad5b6bb595b09c14bd86ff0b365d302faaf5e2/handshake.go#L838
func getNameFromClientHello(hello *tls.ClientHelloInfo) string {
normalizedName := func(serverName string) string {
return strings.ToLower(strings.TrimSpace(serverName))
}
localIPFromConn := func(c net.Conn) string {
if c == nil {
return ""
}
localAddr := c.LocalAddr().String()
ip, _, err := net.SplitHostPort(localAddr)
if err != nil {
ip = localAddr
}
if scopeIDStart := strings.Index(ip, "%"); scopeIDStart > -1 {
ip = ip[:scopeIDStart]
}
return ip
}
if name := normalizedName(hello.ServerName); name != "" {
return name
}
return localIPFromConn(hello.Conn)
}
func SNIGuardDNSSAN(info *tls.ClientHelloInfo, cert *tls.Certificate) error {
if len(cert.Leaf.DNSNames) == 0 {
return nil
}
return SNIGuardStrict(info, cert)
}
func SNIGuardStrict(info *tls.ClientHelloInfo, cert *tls.Certificate) error {
hostname := getNameFromClientHello(info)
err := cert.Leaf.VerifyHostname(hostname)
if err != nil {
return fmt.Errorf("sni guard: %w", err)
}
return nil
}

View file

@ -0,0 +1,139 @@
package utils
import (
"crypto/tls"
"log"
"net/http"
"os"
"os/exec"
"strings"
"testing"
"github.com/stretchr/testify/assert"
)
const (
testListen = "127.82.39.147:12947"
testCAFile = "./testcerts/ca"
testCertFile = "./testcerts/cert"
testKeyFile = "./testcerts/key"
)
func TestCertificateLoaderPathError(t *testing.T) {
assert.NoError(t, os.RemoveAll(testCertFile))
assert.NoError(t, os.RemoveAll(testKeyFile))
loader := LocalCertificateLoader{
CertFile: testCertFile,
KeyFile: testKeyFile,
SNIGuard: SNIGuardStrict,
}
err := loader.InitializeCache()
var pathErr *os.PathError
assert.ErrorAs(t, err, &pathErr)
}
func TestCertificateLoaderFullChain(t *testing.T) {
assert.NoError(t, generateTestCertificate([]string{"example.com"}, "fullchain"))
loader := LocalCertificateLoader{
CertFile: testCertFile,
KeyFile: testKeyFile,
SNIGuard: SNIGuardStrict,
}
assert.NoError(t, loader.InitializeCache())
lis, err := tls.Listen("tcp", testListen, &tls.Config{
GetCertificate: loader.GetCertificate,
})
assert.NoError(t, err)
defer lis.Close()
go http.Serve(lis, nil)
assert.Error(t, runTestTLSClient("unmatched-sni.example.com"))
assert.Error(t, runTestTLSClient(""))
assert.NoError(t, runTestTLSClient("example.com"))
}
func TestCertificateLoaderNoSAN(t *testing.T) {
assert.NoError(t, generateTestCertificate(nil, "selfsign"))
loader := LocalCertificateLoader{
CertFile: testCertFile,
KeyFile: testKeyFile,
SNIGuard: SNIGuardDNSSAN,
}
assert.NoError(t, loader.InitializeCache())
lis, err := tls.Listen("tcp", testListen, &tls.Config{
GetCertificate: loader.GetCertificate,
})
assert.NoError(t, err)
defer lis.Close()
go http.Serve(lis, nil)
assert.NoError(t, runTestTLSClient(""))
}
func TestCertificateLoaderReplaceCertificate(t *testing.T) {
assert.NoError(t, generateTestCertificate([]string{"example.com"}, "fullchain"))
loader := LocalCertificateLoader{
CertFile: testCertFile,
KeyFile: testKeyFile,
SNIGuard: SNIGuardStrict,
}
assert.NoError(t, loader.InitializeCache())
lis, err := tls.Listen("tcp", testListen, &tls.Config{
GetCertificate: loader.GetCertificate,
})
assert.NoError(t, err)
defer lis.Close()
go http.Serve(lis, nil)
assert.NoError(t, runTestTLSClient("example.com"))
assert.Error(t, runTestTLSClient("2.example.com"))
assert.NoError(t, generateTestCertificate([]string{"2.example.com"}, "fullchain"))
assert.Error(t, runTestTLSClient("example.com"))
assert.NoError(t, runTestTLSClient("2.example.com"))
}
func generateTestCertificate(dnssan []string, certType string) error {
args := []string{
"certloader_test_gencert.py",
"--ca", testCAFile,
"--cert", testCertFile,
"--key", testKeyFile,
"--type", certType,
}
if len(dnssan) > 0 {
args = append(args, "--dnssan", strings.Join(dnssan, ","))
}
cmd := exec.Command("python", args...)
out, err := cmd.CombinedOutput()
if err != nil {
log.Printf("Failed to generate test certificate: %s", out)
return err
}
return nil
}
func runTestTLSClient(sni string) error {
args := []string{
"certloader_test_tlsclient.py",
"--server", testListen,
"--ca", testCAFile,
}
if sni != "" {
args = append(args, "--sni", sni)
}
cmd := exec.Command("python", args...)
out, err := cmd.CombinedOutput()
if err != nil {
log.Printf("Failed to run test TLS client: %s", out)
return err
}
return nil
}

View file

@ -0,0 +1,134 @@
import argparse
import datetime
from cryptography import x509
from cryptography.x509.oid import NameOID
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.asymmetric import ec
from cryptography.hazmat.primitives.serialization import Encoding, PrivateFormat, NoEncryption
def create_key():
return ec.generate_private_key(ec.SECP256R1())
def create_certificate(cert_type, subject, issuer, private_key, public_key, dns_san=None):
serial_number = x509.random_serial_number()
not_valid_before = datetime.datetime.now(datetime.UTC)
not_valid_after = not_valid_before + datetime.timedelta(days=365)
subject_name = x509.Name([
x509.NameAttribute(NameOID.COUNTRY_NAME, subject.get('C', 'ZZ')),
x509.NameAttribute(NameOID.ORGANIZATION_NAME, subject.get('O', 'No Organization')),
x509.NameAttribute(NameOID.COMMON_NAME, subject.get('CN', 'No CommonName')),
])
issuer_name = x509.Name([
x509.NameAttribute(NameOID.COUNTRY_NAME, issuer.get('C', 'ZZ')),
x509.NameAttribute(NameOID.ORGANIZATION_NAME, issuer.get('O', 'No Organization')),
x509.NameAttribute(NameOID.COMMON_NAME, issuer.get('CN', 'No CommonName')),
])
builder = x509.CertificateBuilder()
builder = builder.subject_name(subject_name)
builder = builder.issuer_name(issuer_name)
builder = builder.public_key(public_key)
builder = builder.serial_number(serial_number)
builder = builder.not_valid_before(not_valid_before)
builder = builder.not_valid_after(not_valid_after)
if cert_type == 'root':
builder = builder.add_extension(
x509.BasicConstraints(ca=True, path_length=None), critical=True
)
elif cert_type == 'intermediate':
builder = builder.add_extension(
x509.BasicConstraints(ca=True, path_length=0), critical=True
)
elif cert_type == 'leaf':
builder = builder.add_extension(
x509.BasicConstraints(ca=False, path_length=None), critical=True
)
else:
raise ValueError(f'Invalid cert_type: {cert_type}')
if dns_san:
builder = builder.add_extension(
x509.SubjectAlternativeName([x509.DNSName(d) for d in dns_san.split(',')]),
critical=False
)
return builder.sign(private_key=private_key, algorithm=hashes.SHA256())
def main():
parser = argparse.ArgumentParser(description='Generate HTTPS server certificate.')
parser.add_argument('--ca', required=True,
help='Path to write the X509 CA certificate in PEM format')
parser.add_argument('--cert', required=True,
help='Path to write the X509 certificate in PEM format')
parser.add_argument('--key', required=True,
help='Path to write the private key in PEM format')
parser.add_argument('--dnssan', required=False, default=None,
help='Comma-separated list of DNS SANs')
parser.add_argument('--type', required=True, choices=['selfsign', 'fullchain'],
help='Type of certificate to generate')
args = parser.parse_args()
key = create_key()
public_key = key.public_key()
if args.type == 'selfsign':
subject = {"C": "ZZ", "O": "Certificate", "CN": "Certificate"}
cert = create_certificate(
cert_type='root',
subject=subject,
issuer=subject,
private_key=key,
public_key=public_key,
dns_san=args.dnssan)
with open(args.ca, 'wb') as f:
f.write(cert.public_bytes(Encoding.PEM))
with open(args.cert, 'wb') as f:
f.write(cert.public_bytes(Encoding.PEM))
with open(args.key, 'wb') as f:
f.write(
key.private_bytes(Encoding.PEM, PrivateFormat.TraditionalOpenSSL, NoEncryption()))
elif args.type == 'fullchain':
ca_key = create_key()
ca_public_key = ca_key.public_key()
ca_subject = {"C": "ZZ", "O": "Root CA", "CN": "Root CA"}
ca_cert = create_certificate(
cert_type='root',
subject=ca_subject,
issuer=ca_subject,
private_key=ca_key,
public_key=ca_public_key)
intermediate_key = create_key()
intermediate_public_key = intermediate_key.public_key()
intermediate_subject = {"C": "ZZ", "O": "Intermediate CA", "CN": "Intermediate CA"}
intermediate_cert = create_certificate(
cert_type='intermediate',
subject=intermediate_subject,
issuer=ca_subject,
private_key=ca_key,
public_key=intermediate_public_key)
leaf_subject = {"C": "ZZ", "O": "Leaf Certificate", "CN": "Leaf Certificate"}
cert = create_certificate(
cert_type='leaf',
subject=leaf_subject,
issuer=intermediate_subject,
private_key=intermediate_key,
public_key=public_key,
dns_san=args.dnssan)
with open(args.ca, 'wb') as f:
f.write(ca_cert.public_bytes(Encoding.PEM))
with open(args.cert, 'wb') as f:
f.write(cert.public_bytes(Encoding.PEM))
f.write(intermediate_cert.public_bytes(Encoding.PEM))
with open(args.key, 'wb') as f:
f.write(
key.private_bytes(Encoding.PEM, PrivateFormat.TraditionalOpenSSL, NoEncryption()))
if __name__ == "__main__":
main()

View file

@ -0,0 +1,60 @@
import argparse
import ssl
import socket
import sys
def check_tls(server, ca_cert, sni, alpn):
try:
host, port = server.split(":")
port = int(port)
if ca_cert:
context = ssl.create_default_context(ssl.Purpose.SERVER_AUTH, cafile=ca_cert)
context.check_hostname = sni is not None
context.verify_mode = ssl.CERT_REQUIRED
else:
context = ssl.create_default_context()
context.check_hostname = False
context.verify_mode = ssl.CERT_NONE
if alpn:
context.set_alpn_protocols([p for p in alpn.split(",")])
with socket.create_connection((host, port)) as sock:
with context.wrap_socket(sock, server_hostname=sni) as ssock:
# Verify handshake and certificate
print(f'Connected to {ssock.version()} using {ssock.cipher()}')
print(f'Server certificate validated and details: {ssock.getpeercert()}')
print("OK")
return 0
except Exception as e:
print(f"Error: {e}")
return 1
def main():
parser = argparse.ArgumentParser(description="Test TLS Server")
parser.add_argument("--server", required=True,
help="Server address to test (e.g., 127.1.2.3:8443)")
parser.add_argument("--ca", required=False, default=None,
help="CA certificate file used to validate the server certificate"
"Omit to use insecure connection")
parser.add_argument("--sni", required=False, default=None,
help="SNI to send in ClientHello")
parser.add_argument("--alpn", required=False, default='h2',
help="ALPN to send in ClientHello")
args = parser.parse_args()
exit_status = check_tls(
server=args.server,
ca_cert=args.ca,
sni=args.sni,
alpn=args.alpn)
sys.exit(exit_status)
if __name__ == "__main__":
main()

View file

@ -0,0 +1,172 @@
package utils
import (
"fmt"
"io"
"net/http"
"os"
"time"
"github.com/apernet/hysteria/extras/v2/outbounds/acl"
"github.com/apernet/hysteria/extras/v2/outbounds/acl/v2geo"
)
const (
geoipFilename = "geoip.dat"
geoipURL = "https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geoip.dat"
geositeFilename = "geosite.dat"
geositeURL = "https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geosite.dat"
geoDlTmpPattern = ".hysteria-geoloader.dlpart.*"
geoDefaultUpdateInterval = 7 * 24 * time.Hour // 7 days
)
var _ acl.GeoLoader = (*GeoLoader)(nil)
// GeoLoader provides the on-demand GeoIP/GeoSite database
// loading functionality required by the ACL engine.
// Empty filenames = automatic download from built-in URLs.
type GeoLoader struct {
GeoIPFilename string
GeoSiteFilename string
UpdateInterval time.Duration
DownloadFunc func(filename, url string)
DownloadErrFunc func(err error)
geoipMap map[string]*v2geo.GeoIP
geositeMap map[string]*v2geo.GeoSite
}
func (l *GeoLoader) shouldDownload(filename string) bool {
info, err := os.Stat(filename)
if os.IsNotExist(err) {
return true
}
if info.Size() == 0 {
// empty files are loadable by v2geo, but we consider it broken
return true
}
dt := time.Now().Sub(info.ModTime())
if l.UpdateInterval == 0 {
return dt > geoDefaultUpdateInterval
} else {
return dt > l.UpdateInterval
}
}
func (l *GeoLoader) downloadAndCheck(filename, url string, checkFunc func(filename string) error) error {
l.DownloadFunc(filename, url)
resp, err := http.Get(url)
if err != nil {
l.DownloadErrFunc(err)
return err
}
defer resp.Body.Close()
f, err := os.CreateTemp(".", geoDlTmpPattern)
if err != nil {
l.DownloadErrFunc(err)
return err
}
defer os.Remove(f.Name())
_, err = io.Copy(f, resp.Body)
if err != nil {
f.Close()
l.DownloadErrFunc(err)
return err
}
f.Close()
err = checkFunc(f.Name())
if err != nil {
l.DownloadErrFunc(fmt.Errorf("integrity check failed: %w", err))
return err
}
err = os.Rename(f.Name(), filename)
if err != nil {
l.DownloadErrFunc(fmt.Errorf("rename failed: %w", err))
return err
}
return nil
}
func (l *GeoLoader) LoadGeoIP() (map[string]*v2geo.GeoIP, error) {
if l.geoipMap != nil {
return l.geoipMap, nil
}
autoDL := false
filename := l.GeoIPFilename
if filename == "" {
autoDL = true
filename = geoipFilename
}
if autoDL {
if !l.shouldDownload(filename) {
m, err := v2geo.LoadGeoIP(filename)
if err == nil {
l.geoipMap = m
return m, nil
}
// file is broken, download it again
}
err := l.downloadAndCheck(filename, geoipURL, func(filename string) error {
_, err := v2geo.LoadGeoIP(filename)
return err
})
if err != nil {
// as long as the previous download exists, fallback to it
if _, serr := os.Stat(filename); os.IsNotExist(serr) {
return nil, err
}
}
}
m, err := v2geo.LoadGeoIP(filename)
if err != nil {
return nil, err
}
l.geoipMap = m
return m, nil
}
func (l *GeoLoader) LoadGeoSite() (map[string]*v2geo.GeoSite, error) {
if l.geositeMap != nil {
return l.geositeMap, nil
}
autoDL := false
filename := l.GeoSiteFilename
if filename == "" {
autoDL = true
filename = geositeFilename
}
if autoDL {
if !l.shouldDownload(filename) {
m, err := v2geo.LoadGeoSite(filename)
if err == nil {
l.geositeMap = m
return m, nil
}
// file is broken, download it again
}
err := l.downloadAndCheck(filename, geositeURL, func(filename string) error {
_, err := v2geo.LoadGeoSite(filename)
return err
})
if err != nil {
// as long as the previous download exists, fallback to it
if _, serr := os.Stat(filename); os.IsNotExist(serr) {
return nil, err
}
}
}
m, err := v2geo.LoadGeoSite(filename)
if err != nil {
return nil, err
}
l.geositeMap = m
return m, nil
}

16
app/internal/utils/qr.go Normal file
View file

@ -0,0 +1,16 @@
package utils
import (
"os"
"github.com/mdp/qrterminal/v3"
)
func PrintQR(str string) {
qrterminal.GenerateWithConfig(str, qrterminal.Config{
Level: qrterminal.L,
Writer: os.Stdout,
BlackChar: qrterminal.BLACK,
WhiteChar: qrterminal.WHITE,
})
}

View file

@ -0,0 +1,3 @@
# This directory is used for certificate generation in certloader_test.go
/*
!/.gitignore

View file

@ -0,0 +1,96 @@
package utils
import (
"context"
"encoding/json"
"fmt"
"net"
"net/http"
"time"
"github.com/apernet/hysteria/core/v2/client"
)
const (
updateCheckEndpoint = "https://api.hy2.io/v1/update"
updateCheckTimeout = 10 * time.Second
)
type UpdateChecker struct {
CurrentVersion string
Platform string
Architecture string
Channel string
Side string
Client *http.Client
}
func NewServerUpdateChecker(currentVersion, platform, architecture, channel string) *UpdateChecker {
return &UpdateChecker{
CurrentVersion: currentVersion,
Platform: platform,
Architecture: architecture,
Channel: channel,
Side: "server",
Client: &http.Client{
Timeout: updateCheckTimeout,
},
}
}
// NewClientUpdateChecker ensures that update checks are routed through a HyClient,
// not being sent directly. This safeguard is CRITICAL, especially in scenarios where
// users use Hysteria to bypass censorship. Making direct HTTPS requests to the API
// endpoint could be easily spotted by censors (through SNI, for example), and could
// serve as a signal to identify and penalize Hysteria users.
func NewClientUpdateChecker(currentVersion, platform, architecture, channel string, hyClient client.Client) *UpdateChecker {
return &UpdateChecker{
CurrentVersion: currentVersion,
Platform: platform,
Architecture: architecture,
Channel: channel,
Side: "client",
Client: &http.Client{
Timeout: updateCheckTimeout,
Transport: &http.Transport{
DialContext: func(_ context.Context, network, addr string) (net.Conn, error) {
// Unfortunately HyClient doesn't support context for now
return hyClient.TCP(addr)
},
},
},
}
}
type UpdateResponse struct {
HasUpdate bool `json:"update"`
LatestVersion string `json:"lver"`
URL string `json:"url"`
Urgent bool `json:"urgent"`
}
func (uc *UpdateChecker) Check() (*UpdateResponse, error) {
url := fmt.Sprintf("%s?cver=%s&plat=%s&arch=%s&chan=%s&side=%s",
updateCheckEndpoint,
uc.CurrentVersion,
uc.Platform,
uc.Architecture,
uc.Channel,
uc.Side,
)
resp, err := uc.Client.Get(url)
if err != nil {
return nil, err
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
return nil, fmt.Errorf("unexpected status code: %d", resp.StatusCode)
}
var uResp UpdateResponse
decoder := json.NewDecoder(resp.Body)
if err := decoder.Decode(&uResp); err != nil {
return nil, err
}
return &uResp, nil
}

View file

@ -0,0 +1,106 @@
package utils_test
import (
"io"
"net"
"time"
"github.com/apernet/hysteria/core/v2/client"
)
type MockEchoHyClient struct{}
func (c *MockEchoHyClient) TCP(addr string) (net.Conn, error) {
return &mockEchoTCPConn{
BufChan: make(chan []byte, 10),
}, nil
}
func (c *MockEchoHyClient) UDP() (client.HyUDPConn, error) {
return &mockEchoUDPConn{
BufChan: make(chan mockEchoUDPPacket, 10),
}, nil
}
func (c *MockEchoHyClient) Close() error {
return nil
}
type mockEchoTCPConn struct {
BufChan chan []byte
}
func (c *mockEchoTCPConn) Read(b []byte) (n int, err error) {
buf := <-c.BufChan
if buf == nil {
// EOF
return 0, io.EOF
}
return copy(b, buf), nil
}
func (c *mockEchoTCPConn) Write(b []byte) (n int, err error) {
c.BufChan <- b
return len(b), nil
}
func (c *mockEchoTCPConn) Close() error {
close(c.BufChan)
return nil
}
func (c *mockEchoTCPConn) LocalAddr() net.Addr {
// Not implemented
return nil
}
func (c *mockEchoTCPConn) RemoteAddr() net.Addr {
// Not implemented
return nil
}
func (c *mockEchoTCPConn) SetDeadline(t time.Time) error {
// Not implemented
return nil
}
func (c *mockEchoTCPConn) SetReadDeadline(t time.Time) error {
// Not implemented
return nil
}
func (c *mockEchoTCPConn) SetWriteDeadline(t time.Time) error {
// Not implemented
return nil
}
type mockEchoUDPPacket struct {
Data []byte
Addr string
}
type mockEchoUDPConn struct {
BufChan chan mockEchoUDPPacket
}
func (c *mockEchoUDPConn) Receive() ([]byte, string, error) {
p := <-c.BufChan
if p.Data == nil {
// EOF
return nil, "", io.EOF
}
return p.Data, p.Addr, nil
}
func (c *mockEchoUDPConn) Send(bytes []byte, s string) error {
c.BufChan <- mockEchoUDPPacket{
Data: bytes,
Addr: s,
}
return nil
}
func (c *mockEchoUDPConn) Close() error {
close(c.BufChan)
return nil
}

7
app/main.go Normal file
View file

@ -0,0 +1,7 @@
package main
import "github.com/apernet/hysteria/app/v2/cmd"
func main() {
cmd.Execute()
}

50
app/misc/socks5_test.py Normal file
View file

@ -0,0 +1,50 @@
import socket
import socks
import time
TARGET = "1.1.1.1"
def test_tcp() -> None:
s = socks.socksocket(socket.AF_INET, socket.SOCK_STREAM)
s.set_proxy(socks.SOCKS5, "127.0.0.1", 1080)
print(f"TCP - Sending HTTP request to {TARGET}")
start = time.time()
s.connect((TARGET, 80))
s.send(b"GET / HTTP/1.1\r\nHost: " + TARGET.encode() + b"\r\n\r\n")
data = s.recv(1024)
if not data:
print("No data received")
elif not data.startswith(b"HTTP/1.1 "):
print("Invalid response received")
else:
print("TCP test passed")
end = time.time()
s.close()
print(f"Time: {round((end - start) * 1000, 2)} ms")
def test_udp() -> None:
s = socks.socksocket(socket.AF_INET, socket.SOCK_DGRAM)
s.set_proxy(socks.SOCKS5, "127.0.0.1", 1080)
req = b"\x12\x34\x01\x00\x00\x01\x00\x00\x00\x00\x00\x00\x05\x62\x61\x69\x64\x75\x03\x63\x6f\x6d\x00\x00\x01\x00\x01"
print(f"UDP - Sending DNS request to {TARGET}")
start = time.time()
s.sendto(req, (TARGET, 53))
(rsp, address) = s.recvfrom(4096)
if address[0] == TARGET and address[1] == 53 and rsp[0] == req[0] and rsp[1] == req[1]:
print("UDP test passed")
else:
print("Invalid response received")
end = time.time()
s.close()
print(f"Time: {round((end - start) * 1000, 2)} ms")
if __name__ == "__main__":
test_tcp()
test_udp()

22
app/pprof.go Normal file
View file

@ -0,0 +1,22 @@
//go:build pprof
package main
import (
"fmt"
"net/http"
_ "net/http/pprof"
)
const (
pprofListenAddr = ":6060"
)
func init() {
fmt.Printf("!!! pprof enabled, listening on %s\n", pprofListenAddr)
go func() {
if err := http.ListenAndServe(pprofListenAddr, nil); err != nil {
panic(err)
}
}()
}

View file

@ -1,8 +0,0 @@
{
"listen": "localhost:1080",
"server": "toby.moe:36712",
"name": "",
"insecure": false,
"up_mbps": 50,
"down_mbps": 80
}

View file

@ -1,84 +0,0 @@
package main
import (
"encoding/json"
"flag"
"io/ioutil"
"os"
"reflect"
"strings"
)
const (
mbpsToBps = 125000
DefaultMaxReceiveStreamFlowControlWindow = 33554432
DefaultMaxReceiveConnectionFlowControlWindow = 67108864
DefaultMaxIncomingStreams = 200
)
func loadConfig(cfg interface{}, args []string) error {
cfgVal := reflect.ValueOf(cfg).Elem()
fs := flag.NewFlagSet("", flag.ContinueOnError)
fsValMap := make(map[reflect.Value]interface{}, cfgVal.NumField())
for i := 0; i < cfgVal.NumField(); i++ {
structField := cfgVal.Type().Field(i)
tag := structField.Tag
switch structField.Type.Kind() {
case reflect.String:
fsValMap[cfgVal.Field(i)] =
fs.String(jsonTagToFlagName(tag.Get("json")), "", tag.Get("desc"))
case reflect.Int:
fsValMap[cfgVal.Field(i)] =
fs.Int(jsonTagToFlagName(tag.Get("json")), 0, tag.Get("desc"))
case reflect.Uint64:
fsValMap[cfgVal.Field(i)] =
fs.Uint64(jsonTagToFlagName(tag.Get("json")), 0, tag.Get("desc"))
case reflect.Bool:
var bf optionalBoolFlag
fs.Var(&bf, jsonTagToFlagName(tag.Get("json")), tag.Get("desc"))
fsValMap[cfgVal.Field(i)] = &bf
}
}
configFile := fs.String("config", "", "Configuration file")
// Parse
if err := fs.Parse(args); err != nil {
os.Exit(1)
}
// Put together the config
if len(*configFile) > 0 {
cb, err := ioutil.ReadFile(*configFile)
if err != nil {
return err
}
if err := json.Unmarshal(cb, cfg); err != nil {
return err
}
}
// Flags override config from file
for field, val := range fsValMap {
switch v := val.(type) {
case *string:
if len(*v) > 0 {
field.SetString(*v)
}
case *int:
if *v != 0 {
field.SetInt(int64(*v))
}
case *uint64:
if *v != 0 {
field.SetUint(*v)
}
case *optionalBoolFlag:
if v.Exists {
field.SetBool(v.Value)
}
}
}
return nil
}
func jsonTagToFlagName(tag string) string {
return strings.ReplaceAll(tag, "_", "-")
}

View file

@ -1,54 +0,0 @@
package main
import (
"fmt"
"os"
"strings"
)
// Injected when compiling
var (
appVersion = "Unknown"
appCommit = "Unknown"
appDate = "Unknown"
)
var modeMap = map[string]func(args []string){
"relay server": relayServer,
"relay client": relayClient,
"proxy server": proxyServer,
"proxy client": proxyClient,
}
func main() {
if len(os.Args) == 2 && strings.ToLower(strings.TrimSpace(os.Args[1])) == "version" {
// Print version and quit
fmt.Printf("%-10s%s\n", "Version:", appVersion)
fmt.Printf("%-10s%s\n", "Commit:", appCommit)
fmt.Printf("%-10s%s\n", "Date:", appDate)
return
}
if len(os.Args) < 3 {
fmt.Println()
fmt.Printf("Usage: %s MODE SUBMODE [OPTIONS]\n\n"+
"Available mode/submode combinations: "+getModes()+"\n"+
"Use -h to see the available options for a mode.\n\n", os.Args[0])
return
}
modeStr := fmt.Sprintf("%s %s", strings.ToLower(strings.TrimSpace(os.Args[1])),
strings.ToLower(strings.TrimSpace(os.Args[2])))
f := modeMap[modeStr]
if f != nil {
f(os.Args[3:])
} else {
fmt.Println("Invalid mode:", modeStr)
}
}
func getModes() string {
modes := make([]string, 0, len(modeMap))
for mode := range modeMap {
modes = append(modes, mode)
}
return strings.Join(modes, ", ")
}

View file

@ -1,81 +0,0 @@
package main
import (
"crypto/tls"
"crypto/x509"
"github.com/lucas-clemente/quic-go"
"github.com/lucas-clemente/quic-go/congestion"
hyCongestion "github.com/tobyxdd/hysteria/pkg/congestion"
"github.com/tobyxdd/hysteria/pkg/core"
"github.com/tobyxdd/hysteria/pkg/socks5"
"io/ioutil"
"log"
)
func proxyClient(args []string) {
var config proxyClientConfig
err := loadConfig(&config, args)
if err != nil {
log.Fatalln("Unable to load configuration:", err)
}
if err := config.Check(); err != nil {
log.Fatalln("Configuration error:", err)
}
log.Printf("Configuration loaded: %+v\n", config)
tlsConfig := &tls.Config{
NextProtos: []string{proxyTLSProtocol},
MinVersion: tls.VersionTLS13,
}
// Load CA
if len(config.CustomCAFile) > 0 {
bs, err := ioutil.ReadFile(config.CustomCAFile)
if err != nil {
log.Fatalln("Unable to load CA file:", err)
}
cp := x509.NewCertPool()
if !cp.AppendCertsFromPEM(bs) {
log.Fatalln("Unable to parse CA file", config.CustomCAFile)
}
tlsConfig.RootCAs = cp
}
quicConfig := &quic.Config{
MaxReceiveStreamFlowControlWindow: config.ReceiveWindowConn,
MaxReceiveConnectionFlowControlWindow: config.ReceiveWindow,
KeepAlive: true,
}
if quicConfig.MaxReceiveStreamFlowControlWindow == 0 {
quicConfig.MaxReceiveStreamFlowControlWindow = DefaultMaxReceiveStreamFlowControlWindow
}
if quicConfig.MaxReceiveConnectionFlowControlWindow == 0 {
quicConfig.MaxReceiveConnectionFlowControlWindow = DefaultMaxReceiveConnectionFlowControlWindow
}
client, err := core.NewClient(config.ServerAddr, config.Username, config.Password, tlsConfig, quicConfig,
uint64(config.UpMbps)*mbpsToBps, uint64(config.DownMbps)*mbpsToBps,
func(refBPS uint64) congestion.SendAlgorithmWithDebugInfos {
return hyCongestion.NewBrutalSender(congestion.ByteCount(refBPS))
})
if err != nil {
log.Fatalln("Client initialization failed:", err)
}
defer client.Close()
log.Println("Connected to", config.ServerAddr)
socks5server, err := socks5.NewServer(config.SOCKS5Addr, "", nil, config.SOCKS5Timeout, 0, 0)
if err != nil {
log.Fatalln("SOCKS5 server initialization failed:", err)
}
log.Println("SOCKS5 server up and running on", config.SOCKS5Addr)
log.Fatalln(socks5server.ListenAndServe(&socks5.HyHandler{
Client: client,
NewTCPRequestFunc: func(addr, reqAddr string) {
log.Printf("[TCP] %s <-> %s\n", addr, reqAddr)
},
TCPRequestClosedFunc: func(addr, reqAddr string, err error) {
log.Printf("Closed [TCP] %s <-> %s: %s\n", addr, reqAddr, err.Error())
},
}))
}

View file

@ -1,71 +0,0 @@
package main
import "errors"
const proxyTLSProtocol = "hysteria-proxy"
type proxyClientConfig struct {
SOCKS5Addr string `json:"socks5_addr" desc:"SOCKS5 listen address"`
SOCKS5Timeout int `json:"socks5_timeout" desc:"SOCKS5 connection timeout in seconds"`
ServerAddr string `json:"server" desc:"Server address"`
Username string `json:"username" desc:"Authentication username"`
Password string `json:"password" desc:"Authentication password"`
Insecure bool `json:"insecure" desc:"Ignore TLS certificate errors"`
CustomCAFile string `json:"ca" desc:"Specify a trusted CA file"`
UpMbps int `json:"up_mbps" desc:"Upload speed in Mbps"`
DownMbps int `json:"down_mbps" desc:"Download speed in Mbps"`
ReceiveWindowConn uint64 `json:"recv_window_conn" desc:"Max receive window size per connection"`
ReceiveWindow uint64 `json:"recv_window" desc:"Max receive window size"`
}
func (c *proxyClientConfig) Check() error {
if len(c.SOCKS5Addr) == 0 {
return errors.New("no SOCKS5 listen address")
}
if c.SOCKS5Timeout != 0 && c.SOCKS5Timeout <= 4 {
return errors.New("invalid SOCKS5 timeout")
}
if len(c.ServerAddr) == 0 {
return errors.New("no server address")
}
if c.UpMbps <= 0 || c.DownMbps <= 0 {
return errors.New("invalid speed")
}
if (c.ReceiveWindowConn != 0 && c.ReceiveWindowConn < 65536) ||
(c.ReceiveWindow != 0 && c.ReceiveWindow < 65536) {
return errors.New("invalid receive window size")
}
return nil
}
type proxyServerConfig struct {
ListenAddr string `json:"listen" desc:"Server listen address"`
CertFile string `json:"cert" desc:"TLS certificate file"`
KeyFile string `json:"key" desc:"TLS key file"`
AuthFile string `json:"auth" desc:"Authentication file"`
UpMbps int `json:"up_mbps" desc:"Max upload speed per client in Mbps"`
DownMbps int `json:"down_mbps" desc:"Max download speed per client in Mbps"`
ReceiveWindowConn uint64 `json:"recv_window_conn" desc:"Max receive window size per connection"`
ReceiveWindowClient uint64 `json:"recv_window_client" desc:"Max receive window size per client"`
MaxConnClient int `json:"max_conn_client" desc:"Max simultaneous connections allowed per client"`
}
func (c *proxyServerConfig) Check() error {
if len(c.ListenAddr) == 0 {
return errors.New("no listen address")
}
if len(c.CertFile) == 0 || len(c.KeyFile) == 0 {
return errors.New("TLS cert or key not provided")
}
if c.UpMbps < 0 || c.DownMbps < 0 {
return errors.New("invalid speed")
}
if (c.ReceiveWindowConn != 0 && c.ReceiveWindowConn < 65536) ||
(c.ReceiveWindowClient != 0 && c.ReceiveWindowClient < 65536) {
return errors.New("invalid receive window size")
}
if c.MaxConnClient < 0 {
return errors.New("invalid max connections per client")
}
return nil
}

View file

@ -1,144 +0,0 @@
package main
import (
"bufio"
"crypto/tls"
"github.com/lucas-clemente/quic-go"
"github.com/lucas-clemente/quic-go/congestion"
hyCongestion "github.com/tobyxdd/hysteria/pkg/congestion"
"github.com/tobyxdd/hysteria/pkg/core"
"io"
"log"
"net"
"os"
"strings"
)
func proxyServer(args []string) {
var config proxyServerConfig
err := loadConfig(&config, args)
if err != nil {
log.Fatalln("Unable to load configuration:", err)
}
if err := config.Check(); err != nil {
log.Fatalln("Configuration error:", err.Error())
}
log.Printf("Configuration loaded: %+v\n", config)
// Load cert
cert, err := tls.LoadX509KeyPair(config.CertFile, config.KeyFile)
if err != nil {
log.Fatalln("Unable to load the certificate:", err)
}
tlsConfig := &tls.Config{
Certificates: []tls.Certificate{cert},
NextProtos: []string{proxyTLSProtocol},
MinVersion: tls.VersionTLS13,
}
quicConfig := &quic.Config{
MaxReceiveStreamFlowControlWindow: config.ReceiveWindowConn,
MaxReceiveConnectionFlowControlWindow: config.ReceiveWindowClient,
MaxIncomingStreams: config.MaxConnClient,
KeepAlive: true,
}
if quicConfig.MaxReceiveStreamFlowControlWindow == 0 {
quicConfig.MaxReceiveStreamFlowControlWindow = DefaultMaxReceiveStreamFlowControlWindow
}
if quicConfig.MaxReceiveConnectionFlowControlWindow == 0 {
quicConfig.MaxReceiveConnectionFlowControlWindow = DefaultMaxReceiveConnectionFlowControlWindow
}
if quicConfig.MaxIncomingStreams == 0 {
quicConfig.MaxIncomingStreams = DefaultMaxIncomingStreams
}
if len(config.AuthFile) == 0 {
log.Println("WARNING: No authentication configured. This server can be used by anyone!")
}
server, err := core.NewServer(config.ListenAddr, tlsConfig, quicConfig,
uint64(config.UpMbps)*mbpsToBps, uint64(config.DownMbps)*mbpsToBps,
func(refBPS uint64) congestion.SendAlgorithmWithDebugInfos {
return hyCongestion.NewBrutalSender(congestion.ByteCount(refBPS))
},
func(addr net.Addr, username string, password string, sSend uint64, sRecv uint64) (core.AuthResult, string) {
if len(config.AuthFile) == 0 {
log.Printf("%s (%s) connected, negotiated speed (Mbps): Up %d / Down %d\n",
addr.String(), username, sSend/mbpsToBps, sRecv/mbpsToBps)
return core.AuthSuccess, ""
} else {
// Need auth
ok, err := checkAuth(config.AuthFile, username, password)
if err != nil {
log.Printf("%s (%s) auth error: %s\n", addr.String(), username, err.Error())
return core.AuthInternalError, "Server auth error"
}
if ok {
log.Printf("%s (%s) authenticated, negotiated speed (Mbps): Up %d / Down %d\n",
addr.String(), username, sSend/mbpsToBps, sRecv/mbpsToBps)
return core.AuthSuccess, ""
} else {
log.Printf("%s (%s) auth failed (invalid credential)\n", addr.String(), username)
return core.AuthInvalidCred, "Invalid credential"
}
}
},
func(addr net.Addr, username string, err error) {
log.Printf("%s (%s) disconnected: %s\n", addr.String(), username, err.Error())
},
func(addr net.Addr, username string, id int, packet bool, reqAddr string) (core.ConnectResult, string, io.ReadWriteCloser) {
if !packet {
// TCP
log.Printf("%s (%s): [TCP] %s\n", addr.String(), username, reqAddr)
conn, err := net.Dial("tcp", reqAddr)
if err != nil {
log.Printf("TCP error %s: %s\n", reqAddr, err.Error())
return core.ConnFailed, err.Error(), nil
}
return core.ConnSuccess, "", conn
} else {
// UDP
log.Printf("%s (%s): [UDP] %s\n", addr.String(), username, reqAddr)
conn, err := net.Dial("udp", reqAddr)
if err != nil {
log.Printf("UDP error %s: %s\n", reqAddr, err.Error())
return core.ConnFailed, err.Error(), nil
}
return core.ConnSuccess, "", conn
}
},
func(addr net.Addr, username string, id int, packet bool, reqAddr string, err error) {
if !packet {
log.Printf("%s (%s): closed [TCP] %s: %s\n", addr.String(), username, reqAddr, err.Error())
} else {
log.Printf("%s (%s): closed [UDP] %s: %s\n", addr.String(), username, reqAddr, err.Error())
}
},
)
if err != nil {
log.Fatalln("Server initialization failed:", err)
}
defer server.Close()
log.Println("Up and running on", config.ListenAddr)
log.Fatalln(server.Serve())
}
func checkAuth(authFile, username, password string) (bool, error) {
f, err := os.Open(authFile)
if err != nil {
return false, err
}
defer f.Close()
scanner := bufio.NewScanner(f)
for scanner.Scan() {
pair := strings.Fields(scanner.Text())
if len(pair) != 2 {
// Invalid format
continue
}
if username == pair[0] && password == pair[1] {
return true, nil
}
}
return false, nil
}

View file

@ -1,104 +0,0 @@
package main
import (
"crypto/tls"
"crypto/x509"
"github.com/lucas-clemente/quic-go"
"github.com/lucas-clemente/quic-go/congestion"
"github.com/tobyxdd/hysteria/internal/utils"
hyCongestion "github.com/tobyxdd/hysteria/pkg/congestion"
"github.com/tobyxdd/hysteria/pkg/core"
"io/ioutil"
"log"
"net"
"os/user"
)
func relayClient(args []string) {
var config relayClientConfig
err := loadConfig(&config, args)
if err != nil {
log.Fatalln("Unable to load configuration:", err)
}
if err := config.Check(); err != nil {
log.Fatalln("Configuration error:", err)
}
if len(config.Name) == 0 {
usr, err := user.Current()
if err == nil {
config.Name = usr.Name
}
}
log.Printf("Configuration loaded: %+v\n", config)
tlsConfig := &tls.Config{
NextProtos: []string{relayTLSProtocol},
MinVersion: tls.VersionTLS13,
}
// Load CA
if len(config.CustomCAFile) > 0 {
bs, err := ioutil.ReadFile(config.CustomCAFile)
if err != nil {
log.Fatalln("Unable to load CA file:", err)
}
cp := x509.NewCertPool()
if !cp.AppendCertsFromPEM(bs) {
log.Fatalln("Unable to parse CA file", config.CustomCAFile)
}
tlsConfig.RootCAs = cp
}
quicConfig := &quic.Config{
MaxReceiveStreamFlowControlWindow: config.ReceiveWindowConn,
MaxReceiveConnectionFlowControlWindow: config.ReceiveWindow,
KeepAlive: true,
}
if quicConfig.MaxReceiveStreamFlowControlWindow == 0 {
quicConfig.MaxReceiveStreamFlowControlWindow = DefaultMaxReceiveStreamFlowControlWindow
}
if quicConfig.MaxReceiveConnectionFlowControlWindow == 0 {
quicConfig.MaxReceiveConnectionFlowControlWindow = DefaultMaxReceiveConnectionFlowControlWindow
}
client, err := core.NewClient(config.ServerAddr, config.Name, "", tlsConfig, quicConfig,
uint64(config.UpMbps)*mbpsToBps, uint64(config.DownMbps)*mbpsToBps,
func(refBPS uint64) congestion.SendAlgorithmWithDebugInfos {
return hyCongestion.NewBrutalSender(congestion.ByteCount(refBPS))
})
if err != nil {
log.Fatalln("Client initialization failed:", err)
}
defer client.Close()
log.Println("Connected to", config.ServerAddr)
listener, err := net.Listen("tcp", config.ListenAddr)
if err != nil {
log.Fatalln("TCP listen failed:", err)
}
defer listener.Close()
log.Println("TCP listening on", listener.Addr().String())
for {
conn, err := listener.Accept()
if err != nil {
log.Fatalln("TCP accept failed:", err)
}
go relayClientHandleConn(conn, client)
}
}
func relayClientHandleConn(conn net.Conn, client core.Client) {
log.Println("New connection", conn.RemoteAddr().String())
var closeErr error
defer func() {
_ = conn.Close()
log.Println("Connection", conn.RemoteAddr().String(), "closed", closeErr)
}()
rwc, err := client.Dial(false, "")
if err != nil {
closeErr = err
return
}
defer rwc.Close()
closeErr = utils.PipePair(conn, rwc, nil, nil)
}

View file

@ -1,69 +0,0 @@
package main
import "errors"
const relayTLSProtocol = "hysteria-relay"
type relayClientConfig struct {
ListenAddr string `json:"listen" desc:"TCP listen address"`
ServerAddr string `json:"server" desc:"Server address"`
Name string `json:"name" desc:"Client name presented to the server"`
Insecure bool `json:"insecure" desc:"Ignore TLS certificate errors"`
CustomCAFile string `json:"ca" desc:"Specify a trusted CA file"`
UpMbps int `json:"up_mbps" desc:"Upload speed in Mbps"`
DownMbps int `json:"down_mbps" desc:"Download speed in Mbps"`
ReceiveWindowConn uint64 `json:"recv_window_conn" desc:"Max receive window size per connection"`
ReceiveWindow uint64 `json:"recv_window" desc:"Max receive window size"`
}
func (c *relayClientConfig) Check() error {
if len(c.ListenAddr) == 0 {
return errors.New("no listen address")
}
if len(c.ServerAddr) == 0 {
return errors.New("no server address")
}
if c.UpMbps <= 0 || c.DownMbps <= 0 {
return errors.New("invalid speed")
}
if (c.ReceiveWindowConn != 0 && c.ReceiveWindowConn < 65536) ||
(c.ReceiveWindow != 0 && c.ReceiveWindow < 65536) {
return errors.New("invalid receive window size")
}
return nil
}
type relayServerConfig struct {
ListenAddr string `json:"listen" desc:"Server listen address"`
RemoteAddr string `json:"remote" desc:"Remote relay address"`
CertFile string `json:"cert" desc:"TLS certificate file"`
KeyFile string `json:"key" desc:"TLS key file"`
UpMbps int `json:"up_mbps" desc:"Max upload speed per client in Mbps"`
DownMbps int `json:"down_mbps" desc:"Max download speed per client in Mbps"`
ReceiveWindowConn uint64 `json:"recv_window_conn" desc:"Max receive window size per connection"`
ReceiveWindowClient uint64 `json:"recv_window_client" desc:"Max receive window size per client"`
MaxConnClient int `json:"max_conn_client" desc:"Max simultaneous connections allowed per client"`
}
func (c *relayServerConfig) Check() error {
if len(c.ListenAddr) == 0 {
return errors.New("no listen address")
}
if len(c.RemoteAddr) == 0 {
return errors.New("no remote address")
}
if len(c.CertFile) == 0 || len(c.KeyFile) == 0 {
return errors.New("TLS cert or key not provided")
}
if c.UpMbps < 0 || c.DownMbps < 0 {
return errors.New("invalid speed")
}
if (c.ReceiveWindowConn != 0 && c.ReceiveWindowConn < 65536) ||
(c.ReceiveWindowClient != 0 && c.ReceiveWindowClient < 65536) {
return errors.New("invalid receive window size")
}
if c.MaxConnClient < 0 {
return errors.New("invalid max connections per client")
}
return nil
}

View file

@ -1,88 +0,0 @@
package main
import (
"crypto/tls"
"github.com/lucas-clemente/quic-go"
"github.com/lucas-clemente/quic-go/congestion"
hyCongestion "github.com/tobyxdd/hysteria/pkg/congestion"
"github.com/tobyxdd/hysteria/pkg/core"
"io"
"log"
"net"
)
func relayServer(args []string) {
var config relayServerConfig
err := loadConfig(&config, args)
if err != nil {
log.Fatalln("Unable to load configuration:", err)
}
if err := config.Check(); err != nil {
log.Fatalln("Configuration error:", err.Error())
}
log.Printf("Configuration loaded: %+v\n", config)
// Load cert
cert, err := tls.LoadX509KeyPair(config.CertFile, config.KeyFile)
if err != nil {
log.Fatalln("Unable to load the certificate:", err)
}
tlsConfig := &tls.Config{
Certificates: []tls.Certificate{cert},
NextProtos: []string{relayTLSProtocol},
MinVersion: tls.VersionTLS13,
}
quicConfig := &quic.Config{
MaxReceiveStreamFlowControlWindow: config.ReceiveWindowConn,
MaxReceiveConnectionFlowControlWindow: config.ReceiveWindowClient,
MaxIncomingStreams: config.MaxConnClient,
KeepAlive: true,
}
if quicConfig.MaxReceiveStreamFlowControlWindow == 0 {
quicConfig.MaxReceiveStreamFlowControlWindow = DefaultMaxReceiveStreamFlowControlWindow
}
if quicConfig.MaxReceiveConnectionFlowControlWindow == 0 {
quicConfig.MaxReceiveConnectionFlowControlWindow = DefaultMaxReceiveConnectionFlowControlWindow
}
if quicConfig.MaxIncomingStreams == 0 {
quicConfig.MaxIncomingStreams = DefaultMaxIncomingStreams
}
server, err := core.NewServer(config.ListenAddr, tlsConfig, quicConfig,
uint64(config.UpMbps)*mbpsToBps, uint64(config.DownMbps)*mbpsToBps,
func(refBPS uint64) congestion.SendAlgorithmWithDebugInfos {
return hyCongestion.NewBrutalSender(congestion.ByteCount(refBPS))
},
func(addr net.Addr, username string, password string, sSend uint64, sRecv uint64) (core.AuthResult, string) {
// No authentication logic in relay, just log username and speed
log.Printf("%s (%s) connected, negotiated speed (Mbps): Up %d / Down %d\n",
addr.String(), username, sSend/mbpsToBps, sRecv/mbpsToBps)
return core.AuthSuccess, ""
},
func(addr net.Addr, username string, err error) {
log.Printf("%s (%s) disconnected: %s\n", addr.String(), username, err.Error())
},
func(addr net.Addr, username string, id int, packet bool, reqAddr string) (core.ConnectResult, string, io.ReadWriteCloser) {
log.Printf("%s (%s): new stream ID %d\n", addr.String(), username, id)
if packet {
return core.ConnBlocked, "unsupported", nil
}
conn, err := net.Dial("tcp", config.RemoteAddr)
if err != nil {
log.Printf("TCP error %s: %s\n", config.RemoteAddr, err.Error())
return core.ConnFailed, err.Error(), nil
}
return core.ConnSuccess, "", conn
},
func(addr net.Addr, username string, id int, packet bool, reqAddr string, err error) {
log.Printf("%s (%s): closed stream ID %d: %s\n", addr.String(), username, id, err.Error())
},
)
if err != nil {
log.Fatalln("Server initialization failed:", err)
}
defer server.Close()
log.Println("Up and running on", config.ListenAddr)
log.Fatalln(server.Serve())
}

View file

@ -1,9 +0,0 @@
{
"listen": ":36712",
"remote": "localhost:1080",
"cert": "/home/ubuntu/.caddy/acme/acme-v02.api.letsencrypt.org/sites/toby.moe/toby.moe.crt",
"key": "/home/ubuntu/.caddy/acme/acme-v02.api.letsencrypt.org/sites/toby.moe/toby.moe.key",
"up_mbps": 100,
"down_mbps": 100,
"max_conn_client": 200
}

View file

@ -1,28 +0,0 @@
package main
import (
"strconv"
)
type optionalBoolFlag struct {
Exists bool
Value bool
}
func (flag *optionalBoolFlag) String() string {
return strconv.FormatBool(flag.Value)
}
func (flag *optionalBoolFlag) Set(s string) error {
v, err := strconv.ParseBool(s)
if err != nil {
return err
}
flag.Exists = true
flag.Value = v
return nil
}
func (flag *optionalBoolFlag) IsBoolFlag() bool {
return true
}

7
core/LICENSE.md Normal file
View file

@ -0,0 +1,7 @@
Copyright 2023 Toby
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View file

@ -0,0 +1,9 @@
with-expecter: true
inpackage: true
dir: .
packages:
github.com/apernet/hysteria/core/v2/client:
interfaces:
udpIO:
config:
mockname: mockUDPIO

315
core/client/client.go Normal file
View file

@ -0,0 +1,315 @@
package client
import (
"context"
"crypto/tls"
"net"
"net/http"
"net/url"
"time"
coreErrs "github.com/apernet/hysteria/core/v2/errors"
"github.com/apernet/hysteria/core/v2/internal/congestion"
"github.com/apernet/hysteria/core/v2/internal/protocol"
"github.com/apernet/hysteria/core/v2/internal/utils"
"github.com/apernet/quic-go"
"github.com/apernet/quic-go/http3"
)
const (
closeErrCodeOK = 0x100 // HTTP3 ErrCodeNoError
closeErrCodeProtocolError = 0x101 // HTTP3 ErrCodeGeneralProtocolError
)
type Client interface {
TCP(addr string) (net.Conn, error)
UDP() (HyUDPConn, error)
Close() error
}
type HyUDPConn interface {
Receive() ([]byte, string, error)
Send([]byte, string) error
Close() error
}
type HandshakeInfo struct {
UDPEnabled bool
Tx uint64 // 0 if using BBR
}
func NewClient(config *Config) (Client, *HandshakeInfo, error) {
if err := config.verifyAndFill(); err != nil {
return nil, nil, err
}
c := &clientImpl{
config: config,
}
info, err := c.connect()
if err != nil {
return nil, nil, err
}
return c, info, nil
}
type clientImpl struct {
config *Config
pktConn net.PacketConn
conn quic.Connection
udpSM *udpSessionManager
}
func (c *clientImpl) connect() (*HandshakeInfo, error) {
pktConn, err := c.config.ConnFactory.New(c.config.ServerAddr)
if err != nil {
return nil, err
}
// Convert config to TLS config & QUIC config
tlsConfig := &tls.Config{
ServerName: c.config.TLSConfig.ServerName,
InsecureSkipVerify: c.config.TLSConfig.InsecureSkipVerify,
VerifyPeerCertificate: c.config.TLSConfig.VerifyPeerCertificate,
RootCAs: c.config.TLSConfig.RootCAs,
}
quicConfig := &quic.Config{
InitialStreamReceiveWindow: c.config.QUICConfig.InitialStreamReceiveWindow,
MaxStreamReceiveWindow: c.config.QUICConfig.MaxStreamReceiveWindow,
InitialConnectionReceiveWindow: c.config.QUICConfig.InitialConnectionReceiveWindow,
MaxConnectionReceiveWindow: c.config.QUICConfig.MaxConnectionReceiveWindow,
MaxIdleTimeout: c.config.QUICConfig.MaxIdleTimeout,
KeepAlivePeriod: c.config.QUICConfig.KeepAlivePeriod,
DisablePathMTUDiscovery: c.config.QUICConfig.DisablePathMTUDiscovery,
EnableDatagrams: true,
}
// Prepare RoundTripper
var conn quic.EarlyConnection
rt := &http3.RoundTripper{
TLSClientConfig: tlsConfig,
QUICConfig: quicConfig,
Dial: func(ctx context.Context, _ string, tlsCfg *tls.Config, cfg *quic.Config) (quic.EarlyConnection, error) {
qc, err := quic.DialEarly(ctx, pktConn, c.config.ServerAddr, tlsCfg, cfg)
if err != nil {
return nil, err
}
conn = qc
return qc, nil
},
}
// Send auth HTTP request
req := &http.Request{
Method: http.MethodPost,
URL: &url.URL{
Scheme: "https",
Host: protocol.URLHost,
Path: protocol.URLPath,
},
Header: make(http.Header),
}
protocol.AuthRequestToHeader(req.Header, protocol.AuthRequest{
Auth: c.config.Auth,
Rx: c.config.BandwidthConfig.MaxRx,
})
resp, err := rt.RoundTrip(req)
if err != nil {
if conn != nil {
_ = conn.CloseWithError(closeErrCodeProtocolError, "")
}
_ = pktConn.Close()
return nil, coreErrs.ConnectError{Err: err}
}
if resp.StatusCode != protocol.StatusAuthOK {
_ = conn.CloseWithError(closeErrCodeProtocolError, "")
_ = pktConn.Close()
return nil, coreErrs.AuthError{StatusCode: resp.StatusCode}
}
// Auth OK
authResp := protocol.AuthResponseFromHeader(resp.Header)
var actualTx uint64
if authResp.RxAuto {
// Server asks client to use bandwidth detection,
// ignore local bandwidth config and use BBR
congestion.UseBBR(conn)
} else {
// actualTx = min(serverRx, clientTx)
actualTx = authResp.Rx
if actualTx == 0 || actualTx > c.config.BandwidthConfig.MaxTx {
// Server doesn't have a limit, or our clientTx is smaller than serverRx
actualTx = c.config.BandwidthConfig.MaxTx
}
if actualTx > 0 {
congestion.UseBrutal(conn, actualTx)
} else {
// We don't know our own bandwidth either, use BBR
congestion.UseBBR(conn)
}
}
_ = resp.Body.Close()
c.pktConn = pktConn
c.conn = conn
if authResp.UDPEnabled {
c.udpSM = newUDPSessionManager(&udpIOImpl{Conn: conn})
}
return &HandshakeInfo{
UDPEnabled: authResp.UDPEnabled,
Tx: actualTx,
}, nil
}
// openStream wraps the stream with QStream, which handles Close() properly
func (c *clientImpl) openStream() (quic.Stream, error) {
stream, err := c.conn.OpenStream()
if err != nil {
return nil, err
}
return &utils.QStream{Stream: stream}, nil
}
func (c *clientImpl) TCP(addr string) (net.Conn, error) {
stream, err := c.openStream()
if err != nil {
return nil, wrapIfConnectionClosed(err)
}
// Send request
err = protocol.WriteTCPRequest(stream, addr)
if err != nil {
_ = stream.Close()
return nil, wrapIfConnectionClosed(err)
}
if c.config.FastOpen {
// Don't wait for the response when fast open is enabled.
// Return the connection immediately, defer the response handling
// to the first Read() call.
return &tcpConn{
Orig: stream,
PseudoLocalAddr: c.conn.LocalAddr(),
PseudoRemoteAddr: c.conn.RemoteAddr(),
Established: false,
}, nil
}
// Read response
ok, msg, err := protocol.ReadTCPResponse(stream)
if err != nil {
_ = stream.Close()
return nil, wrapIfConnectionClosed(err)
}
if !ok {
_ = stream.Close()
return nil, coreErrs.DialError{Message: msg}
}
return &tcpConn{
Orig: stream,
PseudoLocalAddr: c.conn.LocalAddr(),
PseudoRemoteAddr: c.conn.RemoteAddr(),
Established: true,
}, nil
}
func (c *clientImpl) UDP() (HyUDPConn, error) {
if c.udpSM == nil {
return nil, coreErrs.DialError{Message: "UDP not enabled"}
}
return c.udpSM.NewUDP()
}
func (c *clientImpl) Close() error {
_ = c.conn.CloseWithError(closeErrCodeOK, "")
_ = c.pktConn.Close()
return nil
}
// wrapIfConnectionClosed checks if the error returned by quic-go
// indicates that the QUIC connection has been permanently closed,
// and if so, wraps the error with coreErrs.ClosedError.
// PITFALL: sometimes quic-go has "internal errors" that are not net.Error,
// but we still need to treat them as ClosedError.
func wrapIfConnectionClosed(err error) error {
netErr, ok := err.(net.Error)
if !ok || !netErr.Temporary() {
return coreErrs.ClosedError{Err: err}
} else {
return err
}
}
type tcpConn struct {
Orig quic.Stream
PseudoLocalAddr net.Addr
PseudoRemoteAddr net.Addr
Established bool
}
func (c *tcpConn) Read(b []byte) (n int, err error) {
if !c.Established {
// Read response
ok, msg, err := protocol.ReadTCPResponse(c.Orig)
if err != nil {
return 0, err
}
if !ok {
return 0, coreErrs.DialError{Message: msg}
}
c.Established = true
}
return c.Orig.Read(b)
}
func (c *tcpConn) Write(b []byte) (n int, err error) {
return c.Orig.Write(b)
}
func (c *tcpConn) Close() error {
return c.Orig.Close()
}
func (c *tcpConn) LocalAddr() net.Addr {
return c.PseudoLocalAddr
}
func (c *tcpConn) RemoteAddr() net.Addr {
return c.PseudoRemoteAddr
}
func (c *tcpConn) SetDeadline(t time.Time) error {
return c.Orig.SetDeadline(t)
}
func (c *tcpConn) SetReadDeadline(t time.Time) error {
return c.Orig.SetReadDeadline(t)
}
func (c *tcpConn) SetWriteDeadline(t time.Time) error {
return c.Orig.SetWriteDeadline(t)
}
type udpIOImpl struct {
Conn quic.Connection
}
func (io *udpIOImpl) ReceiveMessage() (*protocol.UDPMessage, error) {
for {
msg, err := io.Conn.ReceiveDatagram(context.Background())
if err != nil {
// Connection error, this will stop the session manager
return nil, err
}
udpMsg, err := protocol.ParseUDPMessage(msg)
if err != nil {
// Invalid message, this is fine - just wait for the next
continue
}
return udpMsg, nil
}
}
func (io *udpIOImpl) SendMessage(buf []byte, msg *protocol.UDPMessage) error {
msgN := msg.Serialize(buf)
if msgN < 0 {
// Message larger than buffer, silent drop
return nil
}
return io.Conn.SendDatagram(buf[:msgN])
}

Some files were not shown because too many files have changed in this diff Show more