Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
陈曦
sub2api
Commits
36becd97
Unverified
Commit
36becd97
authored
Feb 05, 2026
by
Wesley Liddick
Committed by
GitHub
Feb 05, 2026
Browse files
Merge pull request #485 from LemonZuo/mod
feat: add support for HTTP/2 Cleartext (h2c) connections
parents
49a3c437
7498035d
Changes
8
Hide whitespace changes
Inline
Side-by-side
backend/go.mod
View file @
36becd97
...
...
@@ -25,10 +25,10 @@ require (
github.com/tidwall/gjson v1.18.0
github.com/tidwall/sjson v1.2.5
github.com/zeromicro/go-zero v1.9.4
golang.org/x/crypto v0.4
6
.0
golang.org/x/net v0.4
8
.0
golang.org/x/crypto v0.4
7
.0
golang.org/x/net v0.4
9
.0
golang.org/x/sync v0.19.0
golang.org/x/term v0.3
8
.0
golang.org/x/term v0.3
9
.0
gopkg.in/yaml.v3 v3.0.1
modernc.org/sqlite v1.44.3
)
...
...
@@ -75,12 +75,10 @@ require (
github.com/goccy/go-json v0.10.2 // indirect
github.com/google/go-cmp v0.7.0 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/subcommands v1.2.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.3 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hashicorp/hcl/v2 v2.18.1 // indirect
github.com/icholy/digest v1.1.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.18.2 // indirect
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
...
...
@@ -89,7 +87,6 @@ require (
github.com/magiconair/properties v1.8.10 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/mdelapenya/tlscert v0.2.0 // indirect
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
...
...
@@ -104,7 +101,6 @@ require (
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/morikuni/aec v1.0.0 // indirect
github.com/ncruces/go-strftime v1.0.0 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.1 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
...
...
@@ -114,7 +110,6 @@ require (
github.com/quic-go/qpack v0.6.0 // indirect
github.com/quic-go/quic-go v0.57.1 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
...
...
@@ -122,7 +117,6 @@ require (
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.6.0 // indirect
github.com/spf13/cobra v1.7.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/testcontainers/testcontainers-go v0.40.0 // indirect
...
...
@@ -146,10 +140,9 @@ require (
go.uber.org/multierr v1.9.0 // indirect
golang.org/x/arch v0.3.0 // indirect
golang.org/x/exp v0.0.0-20251023183803-a4bb9ffd2546 // indirect
golang.org/x/mod v0.30.0 // indirect
golang.org/x/sys v0.39.0 // indirect
golang.org/x/text v0.32.0 // indirect
golang.org/x/tools v0.39.0 // indirect
golang.org/x/mod v0.31.0 // indirect
golang.org/x/sys v0.40.0 // indirect
golang.org/x/text v0.33.0 // indirect
google.golang.org/grpc v1.75.1 // indirect
google.golang.org/protobuf v1.36.10 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
...
...
backend/go.sum
View file @
36becd97
...
...
@@ -46,7 +46,6 @@ github.com/containerd/platforms v0.2.1 h1:zvwtM3rz2YHPQsF2CHYM8+KtB5dvhISiXh5ZpS
github.com/containerd/platforms v0.2.1/go.mod h1:XHCb+2/hzowdiut9rkudds9bE5yJ7npe7dG/wG+uFPw=
github.com/cpuguy83/dockercfg v0.3.2 h1:DlJTyZGBDlXqUZ2Dk2Q3xHs/FtnooJJVaad2S9GKorA=
github.com/cpuguy83/dockercfg v0.3.2/go.mod h1:sugsbF4//dDlL/i+S+rtpIWp+5h0BHJHfjj5/jFyUJc=
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY=
github.com/creack/pty v1.1.18/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
...
...
@@ -117,8 +116,6 @@ github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e h1:ijClszYn+mADRFY17kjQEVQ1XRhq2/JR1M3sGqeJoxs=
github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e/go.mod h1:boTsfXsheKC2y+lKOCMpSfarhxDeIzfZG1jqGcPl3cA=
github.com/google/subcommands v1.2.0 h1:vWQspBTo2nEqTUFita5/KeEWlUL8kQObDFbub/EN9oE=
github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/wire v0.7.0 h1:JxUKI6+CVBgCO2WToKy/nQk0sS+amI9z9EjVmdaocj4=
...
...
@@ -138,8 +135,6 @@ github.com/icholy/digest v1.1.0 h1:HfGg9Irj7i+IX1o1QAmPfIBNu/Q5A5Tu3n/MED9k9H4=
github.com/icholy/digest v1.1.0/go.mod h1:QNrsSGQ5v7v9cReDI0+eyjsXGUoRSUZQHeQ5C4XLa0Y=
github.com/imroc/req/v3 v3.57.0 h1:LMTUjNRUybUkTPn8oJDq8Kg3JRBOBTcnDhKu7mzupKI=
github.com/imroc/req/v3 v3.57.0/go.mod h1:JL62ey1nvSLq81HORNcosvlf7SxZStONNqOprg0Pz00=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo=
...
...
@@ -175,9 +170,6 @@ github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovk
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
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/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/mattn/go-sqlite3 v1.14.17 h1:mCRHCLDUBXgpKAqIKsaAaAsrAlbkeomtRFKXh2L6YIM=
github.com/mattn/go-sqlite3 v1.14.17/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
github.com/mdelapenya/tlscert v0.2.0 h1:7H81W6Z/4weDvZBNOfQte5GpIMo0lGYEeWbkGp5LJHI=
...
...
@@ -211,8 +203,6 @@ github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A=
github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc=
github.com/ncruces/go-strftime v1.0.0 h1:HMFp8mLCTPp341M/ZnA4qaf7ZlsbTc+miZjCLOFAw7w=
github.com/ncruces/go-strftime v1.0.0/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=
github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
github.com/opencontainers/image-spec v1.1.1 h1:y0fUlFfIZhPF1W537XOLg0/fcx6zcHCJwooC2xJA040=
...
...
@@ -240,13 +230,10 @@ github.com/refraction-networking/utls v1.8.1 h1:yNY1kapmQU8JeM1sSw2H2asfTIwWxIkr
github.com/refraction-networking/utls v1.8.1/go.mod h1:jkSOEkLqn+S/jtpEHPOsVv/4V4EVnelwbMQl4vCWXAM=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs=
github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=
github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII=
github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ=
github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4=
github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE=
...
...
@@ -265,8 +252,6 @@ github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8=
github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY=
github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0=
github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo=
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/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.18.2 h1:LUXCnvUvSM6FXAsj6nnfc8Q2tp1dIgUfY9Kc8GsSOiQ=
...
...
@@ -350,14 +335,14 @@ go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTV
golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
golang.org/x/arch v0.3.0 h1:02VY4/ZcO/gBOH6PUaoiptASxtXU10jazRCP865E97k=
golang.org/x/arch v0.3.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
golang.org/x/crypto v0.4
6
.0 h1:
cKRW/pmt1pKAfetfu+RCEvjvZkA9RimPbh7bhFjGVBU
=
golang.org/x/crypto v0.4
6
.0/go.mod h1:
Evb/oLKmMraqjZ2iQTwDwvCtJkczlDuTmdJXoZVzqU0
=
golang.org/x/crypto v0.4
7
.0 h1:
V6e3FRj+n4dbpw86FJ8Fv7XVOql7TEwpHapKoMJ/GO8
=
golang.org/x/crypto v0.4
7
.0/go.mod h1:
ff3Y9VzzKbwSSEzWqJsJVBnWmRwRSHt/6Op5n9bQc4A
=
golang.org/x/exp v0.0.0-20251023183803-a4bb9ffd2546 h1:mgKeJMpvi0yx/sU5GsxQ7p6s2wtOnGAHZWCHUM4KGzY=
golang.org/x/exp v0.0.0-20251023183803-a4bb9ffd2546/go.mod h1:j/pmGrbnkbPtQfxEe5D0VQhZC6qKbfKifgD0oM7sR70=
golang.org/x/mod v0.3
0
.0 h1:
fDEXFVZ/fmCKProc/yAXXUijritrDzahmwwefnjoPFk
=
golang.org/x/mod v0.3
0
.0/go.mod h1:
lAsf5O2EvJeSFMiBxXDki7sCgAxEUcZHXoXMKT4GJKc
=
golang.org/x/net v0.4
8
.0 h1:
zyQRTTrjc33Lhh0fBgT/H3oZq9WuvRR5gPC70xpDiQU
=
golang.org/x/net v0.4
8
.0/go.mod h1:
+ndRgGjkh8FGtu1w1FGbEC31if4VrNVMuKTgcAAnQRY
=
golang.org/x/mod v0.3
1
.0 h1:
HaW9xtz0+kOcWKwli0ZXy79Ix+UW/vOfmWI5QVd2tgI
=
golang.org/x/mod v0.3
1
.0/go.mod h1:
43JraMp9cGx1Rx3AqioxrbrhNsLl2l/iNAvuBkrezpg
=
golang.org/x/net v0.4
9
.0 h1:
eeHFmOGUTtaaPSGNmjBKpbng9MulQsJURQUAfUwY++o
=
golang.org/x/net v0.4
9
.0/go.mod h1:
/ysNB2EvaqvesRkuLAyjI1ycPZlQHM3q01F02UY/MV8
=
golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4=
golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
...
...
@@ -369,20 +354,16 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.
39
.0 h1:
CvCKL8MeisomCi6qNZ+wbb0DN9E5AATixKsvNtMoMFk
=
golang.org/x/sys v0.
39
.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/term v0.3
8
.0 h1:
PQ5pkm/rLO6HnxFR7N2lJHOZX6Kez5Y1gDSJla6jo7Q
=
golang.org/x/term v0.3
8
.0/go.mod h1:
bSEAKrOT1W+VSu9TSCMtoGEOUcKxOKgl3LE5QEF/xVg
=
golang.org/x/text v0.3
2
.0 h1:
ZD01bjUt1FQ9WJ0ClOL5vxgxOI/sVCNgX1YtKwcY0mU
=
golang.org/x/text v0.3
2
.0/go.mod h1:
o/rUWzghvpD5TXrTIBuJU77MTaN0ljMWE47kxGJQ7jY
=
golang.org/x/sys v0.
40
.0 h1:
DBZZqJ2Rkml6QMQsZywtnjnnGvHza6BTfYFWY9kjEWQ
=
golang.org/x/sys v0.
40
.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/term v0.3
9
.0 h1:
RclSuaJf32jOqZz74CkPA9qFuVTX7vhLlpfj/IGWlqY
=
golang.org/x/term v0.3
9
.0/go.mod h1:
yxzUCTP/U+FzoxfdKmLaA0RV1WgE0VY7hXBwKtY/4ww
=
golang.org/x/text v0.3
3
.0 h1:
B3njUFyqtHDUI5jMn1YIr5B0IE2U0qck04r6d4KPAxE
=
golang.org/x/text v0.3
3
.0/go.mod h1:
LuMebE6+rBincTi9+xWTY8TztLzKHc/9C1uBCG27+q8
=
golang.org/x/time v0.12.0 h1:ScB/8o8olJvc+CQPWrK3fPZNfh7qgwCrY0zJmoEQLSE=
golang.org/x/time v0.12.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg=
golang.org/x/tools v0.39.0 h1:ik4ho21kwuQln40uelmciQPp9SipgNDdrafrYA4TmQQ=
golang.org/x/tools v0.39.0/go.mod h1:JnefbkDPyD8UU2kI5fuf8ZX4/yUeh9W877ZeBONxUqQ=
golang.org/x/tools/go/expect v0.1.1-deprecated h1:jpBZDwmgPhXsKZC6WhL20P4b/wmnpsEAGHaNy0n/rJM=
golang.org/x/tools/go/expect v0.1.1-deprecated/go.mod h1:eihoPOH+FgIqa3FpoTwguz/bVUSGBlGQU67vpBeOrBY=
golang.org/x/tools/go/packages/packagestest v0.1.1-deprecated h1:1h2MnaIAIXISqTFKdENegdpAgUXz6NrPEsbIeWaBRvM=
golang.org/x/tools/go/packages/packagestest v0.1.1-deprecated/go.mod h1:RVAQXBGNv1ib0J382/DPCRS/BPnsGebyM1Gj5VSDpG8=
golang.org/x/tools v0.40.0 h1:yLkxfA+Qnul4cs9QA3KnlFu0lVmd8JJfoq+E41uSutA=
golang.org/x/tools v0.40.0/go.mod h1:Ik/tzLRlbscWpqqMRjyWYDisX8bG13FrdXp3o4Sr9lc=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17 h1:wpZ8pe2x1Q3f2KyT5f8oP/fa9rHAKgFPr/HZdNuS+PQ=
google.golang.org/genproto/googleapis/api v0.0.0-20250929231259-57b25ae835d4 h1:8XJ4pajGwOlasW+L13MnEGA8W4115jJySQtVfS2/IBU=
...
...
backend/internal/config/config.go
View file @
36becd97
...
...
@@ -144,12 +144,24 @@ type PricingConfig struct {
}
type
ServerConfig
struct
{
Host
string
`mapstructure:"host"`
Port
int
`mapstructure:"port"`
Mode
string
`mapstructure:"mode"`
// debug/release
ReadHeaderTimeout
int
`mapstructure:"read_header_timeout"`
// 读取请求头超时(秒)
IdleTimeout
int
`mapstructure:"idle_timeout"`
// 空闲连接超时(秒)
TrustedProxies
[]
string
`mapstructure:"trusted_proxies"`
// 可信代理列表(CIDR/IP)
Host
string
`mapstructure:"host"`
Port
int
`mapstructure:"port"`
Mode
string
`mapstructure:"mode"`
// debug/release
ReadHeaderTimeout
int
`mapstructure:"read_header_timeout"`
// 读取请求头超时(秒)
IdleTimeout
int
`mapstructure:"idle_timeout"`
// 空闲连接超时(秒)
TrustedProxies
[]
string
`mapstructure:"trusted_proxies"`
// 可信代理列表(CIDR/IP)
MaxRequestBodySize
int64
`mapstructure:"max_request_body_size"`
// 全局最大请求体限制
H2C
H2CConfig
`mapstructure:"h2c"`
// HTTP/2 Cleartext 配置
}
// H2CConfig HTTP/2 Cleartext 配置
type
H2CConfig
struct
{
Enabled
bool
`mapstructure:"enabled"`
// 是否启用 H2C
MaxConcurrentStreams
uint32
`mapstructure:"max_concurrent_streams"`
// 最大并发流数量
IdleTimeout
int
`mapstructure:"idle_timeout"`
// 空闲超时(秒)
MaxReadFrameSize
int
`mapstructure:"max_read_frame_size"`
// 最大帧大小(字节)
MaxUploadBufferPerConnection
int
`mapstructure:"max_upload_buffer_per_connection"`
// 每个连接的上传缓冲区(字节)
MaxUploadBufferPerStream
int
`mapstructure:"max_upload_buffer_per_stream"`
// 每个流的上传缓冲区(字节)
}
type
CORSConfig
struct
{
...
...
@@ -694,6 +706,14 @@ func setDefaults() {
viper
.
SetDefault
(
"server.read_header_timeout"
,
30
)
// 30秒读取请求头
viper
.
SetDefault
(
"server.idle_timeout"
,
120
)
// 120秒空闲超时
viper
.
SetDefault
(
"server.trusted_proxies"
,
[]
string
{})
viper
.
SetDefault
(
"server.max_request_body_size"
,
int64
(
100
*
1024
*
1024
))
// H2C 默认配置
viper
.
SetDefault
(
"server.h2c.enabled"
,
false
)
viper
.
SetDefault
(
"server.h2c.max_concurrent_streams"
,
uint32
(
50
))
// 50 个并发流
viper
.
SetDefault
(
"server.h2c.idle_timeout"
,
75
)
// 75 秒
viper
.
SetDefault
(
"server.h2c.max_read_frame_size"
,
1
<<
20
)
// 1MB(够用)
viper
.
SetDefault
(
"server.h2c.max_upload_buffer_per_connection"
,
2
<<
20
)
// 2MB
viper
.
SetDefault
(
"server.h2c.max_upload_buffer_per_stream"
,
512
<<
10
)
// 512KB
// CORS
viper
.
SetDefault
(
"cors.allowed_origins"
,
[]
string
{})
...
...
backend/internal/server/http.go
View file @
36becd97
...
...
@@ -14,6 +14,8 @@ import (
"github.com/gin-gonic/gin"
"github.com/google/wire"
"github.com/redis/go-redis/v9"
"golang.org/x/net/http2"
"golang.org/x/net/http2/h2c"
)
// ProviderSet 提供服务器层的依赖
...
...
@@ -56,9 +58,39 @@ func ProvideRouter(
// ProvideHTTPServer 提供 HTTP 服务器
func
ProvideHTTPServer
(
cfg
*
config
.
Config
,
router
*
gin
.
Engine
)
*
http
.
Server
{
httpHandler
:=
http
.
Handler
(
router
)
globalMaxSize
:=
cfg
.
Server
.
MaxRequestBodySize
if
globalMaxSize
<=
0
{
globalMaxSize
=
cfg
.
Gateway
.
MaxBodySize
}
if
globalMaxSize
>
0
{
httpHandler
=
http
.
MaxBytesHandler
(
httpHandler
,
globalMaxSize
)
log
.
Printf
(
"Global max request body size: %d bytes (%.2f MB)"
,
globalMaxSize
,
float64
(
globalMaxSize
)
/
(
1
<<
20
))
}
// 根据配置决定是否启用 H2C
if
cfg
.
Server
.
H2C
.
Enabled
{
h2cConfig
:=
cfg
.
Server
.
H2C
httpHandler
=
h2c
.
NewHandler
(
router
,
&
http2
.
Server
{
MaxConcurrentStreams
:
h2cConfig
.
MaxConcurrentStreams
,
IdleTimeout
:
time
.
Duration
(
h2cConfig
.
IdleTimeout
)
*
time
.
Second
,
MaxReadFrameSize
:
uint32
(
h2cConfig
.
MaxReadFrameSize
),
MaxUploadBufferPerConnection
:
int32
(
h2cConfig
.
MaxUploadBufferPerConnection
),
MaxUploadBufferPerStream
:
int32
(
h2cConfig
.
MaxUploadBufferPerStream
),
})
log
.
Printf
(
"HTTP/2 Cleartext (h2c) enabled: max_concurrent_streams=%d, idle_timeout=%ds, max_read_frame_size=%d, max_upload_buffer_per_connection=%d, max_upload_buffer_per_stream=%d"
,
h2cConfig
.
MaxConcurrentStreams
,
h2cConfig
.
IdleTimeout
,
h2cConfig
.
MaxReadFrameSize
,
h2cConfig
.
MaxUploadBufferPerConnection
,
h2cConfig
.
MaxUploadBufferPerStream
,
)
}
return
&
http
.
Server
{
Addr
:
cfg
.
Server
.
Address
(),
Handler
:
rout
er
,
Handler
:
httpHandl
er
,
// ReadHeaderTimeout: 读取请求头的超时时间,防止慢速请求头攻击
ReadHeaderTimeout
:
time
.
Duration
(
cfg
.
Server
.
ReadHeaderTimeout
)
*
time
.
Second
,
// IdleTimeout: 空闲连接超时时间,释放不活跃的连接资源
...
...
backend/internal/server/middleware/logger.go
View file @
36becd97
...
...
@@ -34,12 +34,16 @@ func Logger() gin.HandlerFunc {
// 客户端IP
clientIP
:=
c
.
ClientIP
()
// 日志格式: [时间] 状态码 | 延迟 | IP | 方法 路径
log
.
Printf
(
"[GIN] %v | %3d | %13v | %15s | %-7s %s"
,
// 协议版本
protocol
:=
c
.
Request
.
Proto
// 日志格式: [时间] 状态码 | 延迟 | IP | 协议 | 方法 路径
log
.
Printf
(
"[GIN] %v | %3d | %13v | %15s | %-6s | %-7s %s"
,
endTime
.
Format
(
"2006/01/02 - 15:04:05"
),
statusCode
,
latency
,
clientIP
,
protocol
,
method
,
path
,
)
...
...
config.yaml
View file @
36becd97
...
...
@@ -23,6 +23,32 @@ server:
# Trusted proxies for X-Forwarded-For parsing (CIDR/IP). Empty disables trusted proxies.
# 信任的代理地址(CIDR/IP 格式),用于解析 X-Forwarded-For 头。留空则禁用代理信任。
trusted_proxies
:
[]
# Global max request body size in bytes (default: 100MB)
# 全局最大请求体大小(字节,默认 100MB)
# Applies to all requests, especially important for h2c first request memory protection
# 适用于所有请求,对 h2c 第一请求的内存保护尤为重要
max_request_body_size
:
104857600
# HTTP/2 Cleartext (h2c) configuration
# HTTP/2 Cleartext (h2c) 配置
h2c
:
# Enable HTTP/2 Cleartext for client connections
# 启用 HTTP/2 Cleartext 客户端连接
enabled
:
true
# Max concurrent streams per connection
# 每个连接的最大并发流数量
max_concurrent_streams
:
50
# Idle timeout for connections (seconds)
# 连接空闲超时时间(秒)
idle_timeout
:
75
# Max frame size in bytes (default: 1MB)
# 最大帧大小(字节,默认 1MB)
max_read_frame_size
:
1048576
# Max upload buffer per connection in bytes (default: 2MB)
# 每个连接的最大上传缓冲区(字节,默认 2MB)
max_upload_buffer_per_connection
:
2097152
# Max upload buffer per stream in bytes (default: 512KB)
# 每个流的最大上传缓冲区(字节,默认 512KB)
max_upload_buffer_per_stream
:
524288
# =============================================================================
# Run Mode Configuration
...
...
deploy/.env.example
View file @
36becd97
...
...
@@ -20,6 +20,31 @@ SERVER_PORT=8080
# Server mode: release or debug
SERVER_MODE=release
# Global max request body size in bytes (default: 100MB)
# 全局最大请求体大小(字节,默认 100MB)
# Applies to all requests, especially important for h2c first request memory protection
# 适用于所有请求,对 h2c 第一请求的内存保护尤为重要
SERVER_MAX_REQUEST_BODY_SIZE=104857600
# Enable HTTP/2 Cleartext (h2c) for client connections
# 启用 HTTP/2 Cleartext (h2c) 客户端连接
SERVER_H2C_ENABLED=true
# H2C max concurrent streams (default: 50)
# H2C 最大并发流数量(默认 50)
SERVER_H2C_MAX_CONCURRENT_STREAMS=50
# H2C idle timeout in seconds (default: 75)
# H2C 空闲超时时间(秒,默认 75)
SERVER_H2C_IDLE_TIMEOUT=75
# H2C max read frame size in bytes (default: 1048576 = 1MB)
# H2C 最大帧大小(字节,默认 1048576 = 1MB)
SERVER_H2C_MAX_READ_FRAME_SIZE=1048576
# H2C max upload buffer per connection in bytes (default: 2097152 = 2MB)
# H2C 每个连接的最大上传缓冲区(字节,默认 2097152 = 2MB)
SERVER_H2C_MAX_UPLOAD_BUFFER_PER_CONNECTION=2097152
# H2C max upload buffer per stream in bytes (default: 524288 = 512KB)
# H2C 每个流的最大上传缓冲区(字节,默认 524288 = 512KB)
SERVER_H2C_MAX_UPLOAD_BUFFER_PER_STREAM=524288
# 运行模式: standard (默认) 或 simple (内部自用)
# standard: 完整 SaaS 功能,包含计费/余额校验;simple: 隐藏 SaaS 功能并跳过计费/余额校验
RUN_MODE=standard
...
...
deploy/config.example.yaml
View file @
36becd97
...
...
@@ -23,6 +23,32 @@ server:
# Trusted proxies for X-Forwarded-For parsing (CIDR/IP). Empty disables trusted proxies.
# 信任的代理地址(CIDR/IP 格式),用于解析 X-Forwarded-For 头。留空则禁用代理信任。
trusted_proxies
:
[]
# Global max request body size in bytes (default: 100MB)
# 全局最大请求体大小(字节,默认 100MB)
# Applies to all requests, especially important for h2c first request memory protection
# 适用于所有请求,对 h2c 第一请求的内存保护尤为重要
max_request_body_size
:
104857600
# HTTP/2 Cleartext (h2c) configuration
# HTTP/2 Cleartext (h2c) 配置
h2c
:
# Enable HTTP/2 Cleartext for client connections
# 启用 HTTP/2 Cleartext 客户端连接
enabled
:
true
# Max concurrent streams per connection
# 每个连接的最大并发流数量
max_concurrent_streams
:
50
# Idle timeout for connections (seconds)
# 连接空闲超时时间(秒)
idle_timeout
:
75
# Max frame size in bytes (default: 1MB)
# 最大帧大小(字节,默认 1MB)
max_read_frame_size
:
1048576
# Max upload buffer per connection in bytes (default: 2MB)
# 每个连接的最大上传缓冲区(字节,默认 2MB)
max_upload_buffer_per_connection
:
2097152
# Max upload buffer per stream in bytes (default: 512KB)
# 每个流的最大上传缓冲区(字节,默认 512KB)
max_upload_buffer_per_stream
:
524288
# =============================================================================
# Run Mode Configuration
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment