Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit047d1c0

Browse files
committed
feat: add experimental http2 support
Closes#4
1 parent7d7c644 commit047d1c0

File tree

26 files changed

+1415
-224
lines changed

26 files changed

+1415
-224
lines changed

‎.github/workflows/ci.yml‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ jobs:
1717
-uses:actions/checkout@v4
1818
-uses:actions/setup-go@v5
1919
with:
20-
go-version-file:./go.mod
20+
# HACK(mafredri): The exampels and thirdparty library require Go 1.24
21+
# due to `golang.org/x/crypto` import, so lint tools must be built by
22+
# the highest version of Go used.
23+
go-version-file:./internal/thirdparty/go.mod
2124
-run:make fmt
2225

2326
lint:
@@ -27,7 +30,10 @@ jobs:
2730
-run:go version
2831
-uses:actions/setup-go@v5
2932
with:
30-
go-version-file:./go.mod
33+
# HACK(mafredri): The exampels and thirdparty library require Go 1.24
34+
# due to `golang.org/x/crypto` import, so lint tools must be built by
35+
# the highest version of Go used.
36+
go-version-file:./internal/thirdparty/go.mod
3137
-run:make lint
3238

3339
test:

‎.github/workflows/daily.yml‎

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -34,33 +34,3 @@ jobs:
3434
with:
3535
name:coverage.html
3636
path:./ci/out/coverage.html
37-
bench-dev:
38-
runs-on:ubuntu-latest
39-
steps:
40-
-uses:actions/checkout@v4
41-
with:
42-
ref:dev
43-
-uses:actions/setup-go@v5
44-
with:
45-
go-version-file:./go.mod
46-
-run:AUTOBAHN=1 make bench
47-
test-dev:
48-
runs-on:ubuntu-latest
49-
steps:
50-
-name:Disable AppArmor
51-
if:runner.os == 'Linux'
52-
run:|
53-
# Disable AppArmor for Ubuntu 23.10+.
54-
# https://chromium.googlesource.com/chromium/src/+/main/docs/security/apparmor-userns-restrictions.md
55-
echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns
56-
-uses:actions/checkout@v4
57-
with:
58-
ref:dev
59-
-uses:actions/setup-go@v5
60-
with:
61-
go-version-file:./go.mod
62-
-run:AUTOBAHN=1 make test
63-
-uses:actions/upload-artifact@v4
64-
with:
65-
name:coverage-dev.html
66-
path:./ci/out/coverage.html

‎.github/workflows/static.yml‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,7 @@ jobs:
3838
go-version-file:./go.mod
3939
-name:Generate coverage and badge
4040
run:|
41-
make test
42-
mkdir -p ./ci/out/static
43-
cp ./ci/out/coverage.html ./ci/out/static/coverage.html
44-
percent=$(go tool cover -func ./ci/out/coverage.prof | tail -n1 | awk '{print $3}' | tr -d '%')
45-
wget -O ./ci/out/static/coverage.svg "https://img.shields.io/badge/coverage-${percent}%25-success"
41+
make static
4642
-name:Upload artifact
4743
uses:actions/upload-pages-artifact@v3
4844
with:

‎Makefile‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ lint:
1313
test:
1414
./ci/test.sh
1515

16+
.PHONY: static
17+
static:
18+
maketest
19+
./ci/static.sh
20+
1621
.PHONY: bench
1722
bench:
18-
./ci/bench.sh
23+
./ci/bench.sh

‎README.md‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ go get github.com/coder/websocket
3131
-[RFC 7692](https://tools.ietf.org/html/rfc7692) permessage-deflate compression
3232
-[CloseRead](https://pkg.go.dev/github.com/coder/websocket#Conn.CloseRead) helper for write only connections
3333
- Compile to[Wasm](https://pkg.go.dev/github.com/coder/websocket#hdr-Wasm)
34+
- Experimental support for HTTP/2 extended CONNECT (RFC 8441)
35+
- Requires opt-in via the[AcceptOptions](https://pkg.go.dev/github.com/coder/websocket#AcceptOptions) and[DialOptions](https://pkg.go.dev/github.com/coder/websocket#DialOptions) Protocol option
36+
- Clients must provide a`http2.Transport`
37+
- Servers must be started with`GODEBUG=http2xconnect=1`, seehttps://github.com/golang/go/issues/53208
38+
- See the[http2 example](./internal/examples/http2)
3439

3540
##Roadmap
3641

@@ -43,7 +48,7 @@ See GitHub issues for minor issues but the major future enhancements are:
4348
-[ ] Graceful shutdown helpers[#209](https://github.com/nhooyr/websocket/issues/209)
4449
-[ ] Assembly for WebSocket masking[#16](https://github.com/nhooyr/websocket/issues/16)
4550
- WIP at[#326](https://github.com/nhooyr/websocket/pull/326), about 3x faster
46-
-[] HTTP/2[#4](https://github.com/nhooyr/websocket/issues/4)
51+
-[x] HTTP/2extended CONNECT (RFC 8441)[#4](https://github.com/coder/websocket/issues/4)
4752
-[ ] The holy grail[#402](https://github.com/nhooyr/websocket/issues/402)
4853

4954
##Examples
@@ -53,6 +58,8 @@ For a production quality example that demonstrates the complete API, see the
5358

5459
For a full stack example, see the[chat example](./internal/examples/chat).
5560

61+
For a HTTP/2 WebSocket example, see the[http2 example](./internal/examples/http2).
62+
5663
###Server
5764

5865
```go

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp