Update dependencies
Also add a stupid script to update external font and style sources.
This commit is contained in:
parent
0556b2592c
commit
a015e29ea8
|
@ -10,3 +10,7 @@ trim_trailing_whitespace = true
|
||||||
|
|
||||||
[{*.templ,*.go}]
|
[{*.templ,*.go}]
|
||||||
indent_style = tab
|
indent_style = tab
|
||||||
|
|
||||||
|
[*.sh]
|
||||||
|
indent_style = tab
|
||||||
|
indent_size = 4
|
||||||
|
|
18
flake.lock
18
flake.lock
|
@ -5,11 +5,11 @@
|
||||||
"systems": "systems"
|
"systems": "systems"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1694529238,
|
"lastModified": 1701680307,
|
||||||
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
|
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "flake-utils",
|
"repo": "flake-utils",
|
||||||
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
|
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -55,11 +55,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1700612854,
|
"lastModified": 1703013332,
|
||||||
"narHash": "sha256-yrQ8osMD+vDLGFX7pcwsY/Qr5PUd6OmDMYJZzZi0+zc=",
|
"narHash": "sha256-+tFNwMvlXLbJZXiMHqYq77z/RfmpfpiI3yjL6o/Zo9M=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "19cbff58383a4ae384dea4d1d0c823d72b49d614",
|
"rev": "54aac082a4d9bb5bbc5c4e899603abfb76a3f6d6",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -103,11 +103,11 @@
|
||||||
"xc": "xc"
|
"xc": "xc"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1700556837,
|
"lastModified": 1703263828,
|
||||||
"narHash": "sha256-795qIrNeHC0Z0oD+FIAxJvUrKT94LTX8m4Ufoq93Y20=",
|
"narHash": "sha256-MkSGQZo2Zv6aCVANh2ETXoCXETkp+xk8jWAW4Wj+y2s=",
|
||||||
"owner": "a-h",
|
"owner": "a-h",
|
||||||
"repo": "templ",
|
"repo": "templ",
|
||||||
"rev": "802881f56f69c01a8bf0bd75ec30c0c4b53b5567",
|
"rev": "92557cd1c50153da439fce00944519dd6038f9f4",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -58,6 +58,10 @@
|
||||||
result/
|
result/
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
update-src = {
|
||||||
|
runtimeInputs = [ curl openssl unzip ];
|
||||||
|
script = builtins.readFile ./update-src.sh;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
@ -98,7 +102,7 @@
|
||||||
|
|
||||||
devShells.default = with pkgs; mkShell {
|
devShells.default = with pkgs; mkShell {
|
||||||
inherit shellHook;
|
inherit shellHook;
|
||||||
nativeBuildInputs = buildInputs ++ [ nodePackages.wrangler ];
|
packages = buildInputs ++ [ nodePackages.wrangler ];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
22
go.mod
22
go.mod
|
@ -3,19 +3,19 @@ module cdn
|
||||||
go 1.21.4
|
go 1.21.4
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/a-h/templ v0.2.476
|
github.com/a-h/templ v0.2.501
|
||||||
github.com/charmbracelet/lipgloss v0.9.1
|
github.com/charmbracelet/lipgloss v0.9.1
|
||||||
github.com/charmbracelet/log v0.3.0
|
github.com/charmbracelet/log v0.3.1
|
||||||
github.com/dustin/go-humanize v1.0.1
|
github.com/dustin/go-humanize v1.0.1
|
||||||
github.com/labstack/echo/v4 v4.11.3
|
github.com/labstack/echo/v4 v4.11.4
|
||||||
github.com/tdewolff/minify/v2 v2.20.7
|
github.com/tdewolff/minify/v2 v2.20.10
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
|
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
|
||||||
github.com/go-logfmt/logfmt v0.6.0 // indirect
|
github.com/go-logfmt/logfmt v0.6.0 // indirect
|
||||||
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
|
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
|
||||||
github.com/labstack/gommon v0.4.0 // indirect
|
github.com/labstack/gommon v0.4.2 // indirect
|
||||||
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
|
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
|
||||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||||
|
@ -23,13 +23,13 @@ require (
|
||||||
github.com/muesli/reflow v0.3.0 // indirect
|
github.com/muesli/reflow v0.3.0 // indirect
|
||||||
github.com/muesli/termenv v0.15.2 // indirect
|
github.com/muesli/termenv v0.15.2 // indirect
|
||||||
github.com/rivo/uniseg v0.2.0 // indirect
|
github.com/rivo/uniseg v0.2.0 // indirect
|
||||||
github.com/tdewolff/parse/v2 v2.7.5 // indirect
|
github.com/tdewolff/parse/v2 v2.7.7 // indirect
|
||||||
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
||||||
github.com/valyala/fasttemplate v1.2.2 // indirect
|
github.com/valyala/fasttemplate v1.2.2 // indirect
|
||||||
golang.org/x/crypto v0.14.0 // indirect
|
golang.org/x/crypto v0.17.0 // indirect
|
||||||
golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect
|
golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect
|
||||||
golang.org/x/net v0.17.0 // indirect
|
golang.org/x/net v0.19.0 // indirect
|
||||||
golang.org/x/sys v0.14.0 // indirect
|
golang.org/x/sys v0.15.0 // indirect
|
||||||
golang.org/x/text v0.13.0 // indirect
|
golang.org/x/text v0.14.0 // indirect
|
||||||
golang.org/x/time v0.3.0 // indirect
|
golang.org/x/time v0.5.0 // indirect
|
||||||
)
|
)
|
||||||
|
|
56
go.sum
56
go.sum
|
@ -1,12 +1,11 @@
|
||||||
github.com/a-h/templ v0.2.476 h1:+H4hP4CwK4kfJwXsE6kHeFWMGtcVOVoOm/I64uzARBk=
|
github.com/a-h/templ v0.2.501 h1:9rIo5u+B+NDJIkbHGthckUGRguCuWKY/7ri8e2ckn9M=
|
||||||
github.com/a-h/templ v0.2.476/go.mod h1:zQ95mSyadNTGHv6k5Fm+wQU8zkBMMbHCHg7eAvUZKNM=
|
github.com/a-h/templ v0.2.501/go.mod h1:9gZxTLtRzM3gQxO8jr09Na0v8/jfliS97S9W5SScanM=
|
||||||
github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k=
|
github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k=
|
||||||
github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8=
|
github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8=
|
||||||
github.com/charmbracelet/lipgloss v0.9.1 h1:PNyd3jvaJbg4jRHKWXnCj1akQm4rh8dbEzN1p/u1KWg=
|
github.com/charmbracelet/lipgloss v0.9.1 h1:PNyd3jvaJbg4jRHKWXnCj1akQm4rh8dbEzN1p/u1KWg=
|
||||||
github.com/charmbracelet/lipgloss v0.9.1/go.mod h1:1mPmG4cxScwUQALAAnacHaigiiHB9Pmr+v1VEawJl6I=
|
github.com/charmbracelet/lipgloss v0.9.1/go.mod h1:1mPmG4cxScwUQALAAnacHaigiiHB9Pmr+v1VEawJl6I=
|
||||||
github.com/charmbracelet/log v0.3.0 h1:u5aB2KJDgNZo4WOfOC8C+KvGIkJ2rCFNlPWDu6xhnqI=
|
github.com/charmbracelet/log v0.3.1 h1:TjuY4OBNbxmHWSwO3tosgqs5I3biyY8sQPny/eCMTYw=
|
||||||
github.com/charmbracelet/log v0.3.0/go.mod h1:OR4E1hutLsax3ZKpXbgUqPtTjQfrh1pG3zwHGWuuq8g=
|
github.com/charmbracelet/log v0.3.1/go.mod h1:OR4E1hutLsax3ZKpXbgUqPtTjQfrh1pG3zwHGWuuq8g=
|
||||||
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 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
|
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
|
||||||
|
@ -17,16 +16,14 @@ github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keL
|
||||||
github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
|
github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
|
||||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
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-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||||
github.com/labstack/echo/v4 v4.11.3 h1:Upyu3olaqSHkCjs1EJJwQ3WId8b8b1hxbogyommKktM=
|
github.com/labstack/echo/v4 v4.11.4 h1:vDZmA+qNeh1pd/cCkEicDMrjtrnMGQ1QFI9gWN1zGq8=
|
||||||
github.com/labstack/echo/v4 v4.11.3/go.mod h1:UcGuQ8V6ZNRmSweBIJkPvGfwCMIlFmiqrPqiEBfPYws=
|
github.com/labstack/echo/v4 v4.11.4/go.mod h1:noh7EvLwqDsmh/X/HWKPUl1AjzJrhyptRyEbQJfxen8=
|
||||||
github.com/labstack/gommon v0.4.0 h1:y7cvthEAEbU0yHOf4axH8ZG2NH8knB9iNSoTO8dyIk8=
|
github.com/labstack/gommon v0.4.2 h1:F8qTUNXgG1+6WQmqoUWnz8WiEU60mXVVw0P4ht1WRA0=
|
||||||
github.com/labstack/gommon v0.4.0/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3MFxTMTM=
|
github.com/labstack/gommon v0.4.2/go.mod h1:QlUFxVM+SNXhDL/Z7YhocGIBYOiwB0mXm1+1bAPHPyU=
|
||||||
github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=
|
github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=
|
||||||
github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
|
github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
|
||||||
github.com/mattn/go-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
|
|
||||||
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
|
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-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
|
||||||
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
|
|
||||||
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
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 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||||
|
@ -42,40 +39,31 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
|
||||||
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||||
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
|
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
|
||||||
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
|
||||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
|
||||||
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
||||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||||
github.com/tdewolff/minify/v2 v2.20.7 h1:NUkuzJ9dvQUNJjSdmmrfELa/ZpnMdyMR/ZKU2bw7N/E=
|
github.com/tdewolff/minify/v2 v2.20.10 h1:iz9IkdRqD2pyneib/AvTas23RRG5TnuUFNcNVKmL/jU=
|
||||||
github.com/tdewolff/minify/v2 v2.20.7/go.mod h1:bj2NpP3zoUhsPzE4oM4JYwuUyVCU/uMaCYZ6/riEjIo=
|
github.com/tdewolff/minify/v2 v2.20.10/go.mod h1:xSJ9fXIfyuEMex88JT4jl8GvXnl/RzWNdqD96AqKlX0=
|
||||||
github.com/tdewolff/parse/v2 v2.7.5 h1:RdcN3Ja6zAMSvnxxO047xRoWexX3RrXKi3H6EQHzXto=
|
github.com/tdewolff/parse/v2 v2.7.7 h1:V+50eFDH7Piw4IBwH8D8FtYeYbZp3T4SCtIvmBSIMyc=
|
||||||
github.com/tdewolff/parse/v2 v2.7.5/go.mod h1:3FbJWZp3XT9OWVN3Hmfp0p/a08v4h8J9W1aghka0soA=
|
github.com/tdewolff/parse/v2 v2.7.7/go.mod h1:3FbJWZp3XT9OWVN3Hmfp0p/a08v4h8J9W1aghka0soA=
|
||||||
github.com/tdewolff/test v1.0.11-0.20231101010635-f1265d231d52 h1:gAQliwn+zJrkjAHVcBEYW/RFvd2St4yYimisvozAYlA=
|
github.com/tdewolff/test v1.0.11-0.20231101010635-f1265d231d52 h1:gAQliwn+zJrkjAHVcBEYW/RFvd2St4yYimisvozAYlA=
|
||||||
github.com/tdewolff/test v1.0.11-0.20231101010635-f1265d231d52/go.mod h1:6DAvZliBAAnD7rhVgwaM7DE5/d9NMOAJ09SqYqeK4QE=
|
github.com/tdewolff/test v1.0.11-0.20231101010635-f1265d231d52/go.mod h1:6DAvZliBAAnD7rhVgwaM7DE5/d9NMOAJ09SqYqeK4QE=
|
||||||
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
|
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
|
||||||
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
||||||
github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
|
|
||||||
github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo=
|
github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo=
|
||||||
github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
|
github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
|
||||||
golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc=
|
golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k=
|
||||||
golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=
|
golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
|
||||||
golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI=
|
golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI=
|
||||||
golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo=
|
golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo=
|
||||||
golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM=
|
golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c=
|
||||||
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
|
golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U=
|
||||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/sys v0.0.0-20211103235746-7861aae1554b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q=
|
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
|
||||||
golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
|
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
|
||||||
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||||
golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4=
|
golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk=
|
||||||
golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
|
||||||
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 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
|
|
@ -24,10 +24,10 @@ templ pageTemplate(path string) {
|
||||||
<link rel="stylesheet" href="/styles/self.css" integrity="sha256-T3aZjYlhGVVQtRtuoRVDQryPntqVvabgIMEiW9z+Nww=" crossorigin="anonymous"/>
|
<link rel="stylesheet" href="/styles/self.css" integrity="sha256-T3aZjYlhGVVQtRtuoRVDQryPntqVvabgIMEiW9z+Nww=" crossorigin="anonymous"/>
|
||||||
<link rel="stylesheet" href="/fonts/iosevka/iosevka-aile.css" integrity="sha256-20HRMpRlRW2+dk9R7asoOl5/z8Xyc2BbjeLZsButUww=" crossorigin="anonymous"/>
|
<link rel="stylesheet" href="/fonts/iosevka/iosevka-aile.css" integrity="sha256-20HRMpRlRW2+dk9R7asoOl5/z8Xyc2BbjeLZsButUww=" crossorigin="anonymous"/>
|
||||||
<link rel="stylesheet" href="/fonts/font-awesome/solid.css" integrity="sha256-xuw8YIIudFiLKxnOSDufxt0N2CFAJQXsK2lnTUPbofE=" crossorigin="anonymous"/>
|
<link rel="stylesheet" href="/fonts/font-awesome/solid.css" integrity="sha256-xuw8YIIudFiLKxnOSDufxt0N2CFAJQXsK2lnTUPbofE=" crossorigin="anonymous"/>
|
||||||
<link rel="preload" href="/fonts/iosevka/iosevka-aile-bold.woff2" as="font" type="font/woff2" integrity="sha256-Hu4sqJ4m0rjWqqKYxhGKw1Lqz/VpftqKe0CeHACkSto=" crossorigin="anonymous"/>
|
<link rel="preload" href="/fonts/iosevka/iosevka-aile-bold.woff2" as="font" type="font/woff2" integrity="sha256-DuGKe2X6v5c7zEUTPac4E0YsDAgVwnQIjGvlFnpjf9k=" crossorigin="anonymous"/>
|
||||||
<link rel="preload" href="/fonts/iosevka/iosevka-aile-bolditalic.woff2" as="font" type="font/woff2" integrity="sha256-fRJP2kQFy+xRyveNgFHkYWfHUG/DSkoUrXdfx7RGJMk=" crossorigin="anonymous"/>
|
<link rel="preload" href="/fonts/iosevka/iosevka-aile-bolditalic.woff2" as="font" type="font/woff2" integrity="sha256-bUL/H2s3kec8IKscAruHp8INfSltr0lxJqtbrGPkOyc=" crossorigin="anonymous"/>
|
||||||
<link rel="preload" href="/fonts/iosevka/iosevka-aile-italic.woff2" as="font" type="font/woff2" integrity="sha256-gH5Tq4ZWU0MJJQjXsdC00d++xrM842dN8pCVRmBnf0k=" crossorigin="anonymous"/>
|
<link rel="preload" href="/fonts/iosevka/iosevka-aile-italic.woff2" as="font" type="font/woff2" integrity="sha256-5FhfAR7p4YDsdyaqORi+i8aoykqOd1xVvV230JbNfto=" crossorigin="anonymous"/>
|
||||||
<link rel="preload" href="/fonts/iosevka/iosevka-aile-regular.woff2" as="font" type="font/woff2" integrity="sha256-y6fQ+gvBFZWjeNgxiWQrYYgni3T5H+TLAwHCsSFSjKE=" crossorigin="anonymous"/>
|
<link rel="preload" href="/fonts/iosevka/iosevka-aile-regular.woff2" as="font" type="font/woff2" integrity="sha256-3uZFySN5a/MXFQxgc3ueGKX2BJOso6kQDLZE2q3zQpY=" crossorigin="anonymous"/>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<main>
|
<main>
|
||||||
|
|
BIN
src/fonts/font-awesome/fa-brands-400.woff2 (Stored with Git LFS)
BIN
src/fonts/font-awesome/fa-brands-400.woff2 (Stored with Git LFS)
Binary file not shown.
BIN
src/fonts/font-awesome/fa-solid-900.woff2 (Stored with Git LFS)
BIN
src/fonts/font-awesome/fa-solid-900.woff2 (Stored with Git LFS)
Binary file not shown.
BIN
src/fonts/font-logos/font-logos.woff2 (Stored with Git LFS)
BIN
src/fonts/font-logos/font-logos.woff2 (Stored with Git LFS)
Binary file not shown.
BIN
src/fonts/iosevka/iosevka-aile-bold.woff2 (Stored with Git LFS)
BIN
src/fonts/iosevka/iosevka-aile-bold.woff2 (Stored with Git LFS)
Binary file not shown.
BIN
src/fonts/iosevka/iosevka-aile-bolditalic.woff2 (Stored with Git LFS)
BIN
src/fonts/iosevka/iosevka-aile-bolditalic.woff2 (Stored with Git LFS)
Binary file not shown.
BIN
src/fonts/iosevka/iosevka-aile-italic.woff2 (Stored with Git LFS)
BIN
src/fonts/iosevka/iosevka-aile-italic.woff2 (Stored with Git LFS)
Binary file not shown.
BIN
src/fonts/iosevka/iosevka-aile-regular.woff2 (Stored with Git LFS)
BIN
src/fonts/iosevka/iosevka-aile-regular.woff2 (Stored with Git LFS)
Binary file not shown.
BIN
src/fonts/iosevka/iosevka-bold.woff2 (Stored with Git LFS)
BIN
src/fonts/iosevka/iosevka-bold.woff2 (Stored with Git LFS)
Binary file not shown.
BIN
src/fonts/iosevka/iosevka-bolditalic.woff2 (Stored with Git LFS)
BIN
src/fonts/iosevka/iosevka-bolditalic.woff2 (Stored with Git LFS)
Binary file not shown.
BIN
src/fonts/iosevka/iosevka-italic.woff2 (Stored with Git LFS)
BIN
src/fonts/iosevka/iosevka-italic.woff2 (Stored with Git LFS)
Binary file not shown.
BIN
src/fonts/iosevka/iosevka-regular.woff2 (Stored with Git LFS)
BIN
src/fonts/iosevka/iosevka-regular.woff2 (Stored with Git LFS)
Binary file not shown.
|
@ -0,0 +1,51 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
FONT_LOGOS_VERSION="1.1.1"
|
||||||
|
FONT_AWESOME_VERSION="6.5.1"
|
||||||
|
FONT_IOSEVKA_VERSION="28.0.1"
|
||||||
|
|
||||||
|
echo "==> Update normalize.css"
|
||||||
|
curl -fsSL \
|
||||||
|
-o ./src/styles/normalize.css \
|
||||||
|
https://github.com/necolas/normalize.css/raw/master/normalize.css
|
||||||
|
|
||||||
|
echo "==> Update devicon.woff"
|
||||||
|
curl -fsSL \
|
||||||
|
-o ./src/fonts/devicon/devicon.woff \
|
||||||
|
https://github.com/devicons/devicon/raw/master/fonts/devicon.woff
|
||||||
|
|
||||||
|
echo "==> Update font-logos.woff2"
|
||||||
|
curl -fsSL \
|
||||||
|
-o /tmp/font-logos.zip \
|
||||||
|
https://github.com/lukas-w/font-logos/releases/download/"v${FONT_LOGOS_VERSION}/font-logos-${FONT_LOGOS_VERSION}".zip
|
||||||
|
unzip -q /tmp/font-logos.zip -d /tmp
|
||||||
|
cp -f /tmp/font-logos-"${FONT_LOGOS_VERSION}"/assets/font-logos.woff2 ./src/fonts/font-logos/font-logos.woff2
|
||||||
|
|
||||||
|
echo "==> Update FontAwesome Free"
|
||||||
|
curl -fsSL \
|
||||||
|
-o /tmp/font-awesome.zip \
|
||||||
|
https://github.com/FortAwesome/Font-Awesome/releases/download/"${FONT_AWESOME_VERSION}/fontawesome-free-${FONT_AWESOME_VERSION}-web".zip
|
||||||
|
unzip -q /tmp/font-awesome.zip -d /tmp
|
||||||
|
for variant in brands-400 solid-900; do
|
||||||
|
cp -f /tmp/fontawesome-free-"${FONT_AWESOME_VERSION}-web/webfonts/fa-${variant}".woff2 ./src/fonts/font-awesome/
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "==> Update Iosevka fonts"
|
||||||
|
for variant in Iosevka IosevkaAile; do
|
||||||
|
curl -fsSL \
|
||||||
|
-o /tmp/"${variant}.zip" \
|
||||||
|
https://github.com/be5invis/Iosevka/releases/download/"v${FONT_IOSEVKA_VERSION}/PkgWebFont-${variant}-${FONT_IOSEVKA_VERSION}".zip
|
||||||
|
unzip -q /tmp/"${variant}.zip" -d /tmp
|
||||||
|
for style in Bold BoldItalic Italic Regular; do
|
||||||
|
cp -f /tmp/WOFF2/"${variant}-${style}".woff2 ./src/fonts/iosevka/"${variant,,}-${style,,}".woff2
|
||||||
|
done
|
||||||
|
done
|
||||||
|
for style in bold bolditalic italic regular; do
|
||||||
|
mv -f ./src/fonts/iosevka/"iosevkaaile-${style}".woff2 ./src/fonts/iosevka/"iosevka-aile-${style}".woff2
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "==> Calculate font checksums"
|
||||||
|
# shellcheck disable=2044
|
||||||
|
for file in $(find ./src/fonts/ -type f -name "*.woff" -or -name "*.woff2"); do
|
||||||
|
echo "${file}: $(openssl dgst -sha256 -binary "${file}" | openssl base64 -A)"
|
||||||
|
done
|
|
@ -1 +1 @@
|
||||||
0.2.476
|
0.2.501
|
|
@ -30,12 +30,18 @@ go build
|
||||||
|
|
||||||
### install-snapshot
|
### install-snapshot
|
||||||
|
|
||||||
Build and install to ~/bin
|
Build and install current version.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
rm cmd/templ/lspcmd/*.txt || true
|
# Remove templ from the non-standard ~/bin/templ path
|
||||||
|
# that this command previously used.
|
||||||
|
rm -f ~/bin/templ
|
||||||
|
# Clear LSP logs.
|
||||||
|
rm -f cmd/templ/lspcmd/*.txt
|
||||||
|
# Update version.
|
||||||
go run ./get-version > .version
|
go run ./get-version > .version
|
||||||
cd cmd/templ && go build -o ~/bin/templ
|
# Install to $GOPATH/bin or $HOME/go/bin
|
||||||
|
cd cmd/templ && go install
|
||||||
```
|
```
|
||||||
|
|
||||||
### build-snapshot
|
### build-snapshot
|
||||||
|
|
|
@ -15,21 +15,18 @@
|
||||||
|
|
||||||
outputs = { self, nixpkgs, gitignore, xc }:
|
outputs = { self, nixpkgs, gitignore, xc }:
|
||||||
let
|
let
|
||||||
# Systems supported
|
|
||||||
allSystems = [
|
allSystems = [
|
||||||
"x86_64-linux" # 64-bit Intel/AMD Linux
|
"x86_64-linux" # 64-bit Intel/AMD Linux
|
||||||
"aarch64-linux" # 64-bit ARM Linux
|
"aarch64-linux" # 64-bit ARM Linux
|
||||||
"x86_64-darwin" # 64-bit Intel macOS
|
"x86_64-darwin" # 64-bit Intel macOS
|
||||||
"aarch64-darwin" # 64-bit ARM macOS
|
"aarch64-darwin" # 64-bit ARM macOS
|
||||||
];
|
];
|
||||||
|
|
||||||
# Helper to provide system-specific attributes
|
|
||||||
forAllSystems = f: nixpkgs.lib.genAttrs allSystems (system: f {
|
forAllSystems = f: nixpkgs.lib.genAttrs allSystems (system: f {
|
||||||
inherit system;
|
inherit system;
|
||||||
pkgs = import nixpkgs { inherit system; };
|
pkgs = import nixpkgs { inherit system; };
|
||||||
});
|
});
|
||||||
in
|
in
|
||||||
rec {
|
{
|
||||||
packages = forAllSystems ({ pkgs, ... }: rec {
|
packages = forAllSystems ({ pkgs, ... }: rec {
|
||||||
default = templ;
|
default = templ;
|
||||||
|
|
||||||
|
@ -37,13 +34,11 @@
|
||||||
name = "templ";
|
name = "templ";
|
||||||
src = gitignore.lib.gitignoreSource ./.;
|
src = gitignore.lib.gitignoreSource ./.;
|
||||||
subPackages = [ "cmd/templ" ];
|
subPackages = [ "cmd/templ" ];
|
||||||
vendorSha256 = "sha256-hbXKWWwrlv0w3SxMgPtDBpluvrbjDRGiJ/9QnRKlwCE=";
|
vendorHash = "sha256-buJArvaaKGRg3yS7BdcVY0ydyi4zah57ABeo+CHkZQU=";
|
||||||
CGO_ENALBED = 0;
|
CGO_ENABLED = 0;
|
||||||
|
|
||||||
flags = [
|
flags = [
|
||||||
"-trimpath"
|
"-trimpath"
|
||||||
];
|
];
|
||||||
|
|
||||||
ldflags = [
|
ldflags = [
|
||||||
"-s"
|
"-s"
|
||||||
"-w"
|
"-w"
|
||||||
|
@ -55,7 +50,6 @@
|
||||||
name = "templ-docs";
|
name = "templ-docs";
|
||||||
src = gitignore.lib.gitignoreSource ./docs;
|
src = gitignore.lib.gitignoreSource ./docs;
|
||||||
npmDepsHash = "sha256-i6clvSyHtQEGl2C/wcCXonl1W/Kxq7WPTYH46AhUvDM=";
|
npmDepsHash = "sha256-i6clvSyHtQEGl2C/wcCXonl1W/Kxq7WPTYH46AhUvDM=";
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
mkdir -p $out/share
|
mkdir -p $out/share
|
||||||
cp -r build/ $out/share/docs
|
cp -r build/ $out/share/docs
|
||||||
|
@ -63,7 +57,7 @@
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
# `nix develop` provides a shell containing required tools for development
|
# `nix develop` provides a shell containing development tools.
|
||||||
devShell = forAllSystems ({ system, pkgs }:
|
devShell = forAllSystems ({ system, pkgs }:
|
||||||
pkgs.mkShell {
|
pkgs.mkShell {
|
||||||
buildInputs = with pkgs; [
|
buildInputs = with pkgs; [
|
||||||
|
@ -75,11 +69,18 @@
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
# Allows users to install the package on their system in an easy way
|
# This flake outputs an overlay that can be used to add templ and
|
||||||
overlays.default = final: prev:
|
# templ-docs to nixpkgs as per https://templ.guide/quick-start/installation/#nix
|
||||||
forAllSystems ({ system, ... }: {
|
#
|
||||||
templ = packages.${system}.templ;
|
# Example usage:
|
||||||
templ-docs = packages.${system}.templ-docs;
|
#
|
||||||
});
|
# nixpkgs.overlays = [
|
||||||
|
# inputs.templ.overlays.default
|
||||||
|
# ];
|
||||||
|
overlays.default = final: prev: {
|
||||||
|
templ = self.packages.${final.stdenv.system}.templ;
|
||||||
|
templ-docs = self.packages.${final.stdenv.system}.templ-docs;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,10 @@ import (
|
||||||
"crypto/sha256"
|
"crypto/sha256"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"html"
|
"html"
|
||||||
|
"html/template"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"sort"
|
"sort"
|
||||||
|
@ -70,18 +72,27 @@ const componentHandlerErrorMessage = "templ: failed to render template"
|
||||||
|
|
||||||
// ServeHTTP implements the http.Handler interface.
|
// ServeHTTP implements the http.Handler interface.
|
||||||
func (ch ComponentHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
func (ch ComponentHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
if ch.Status != 0 {
|
// Since the component may error, write to a buffer first.
|
||||||
w.WriteHeader(ch.Status)
|
// This prevents partial responses from being written to the client.
|
||||||
}
|
buf := GetBuffer()
|
||||||
w.Header().Add("Content-Type", ch.ContentType)
|
defer ReleaseBuffer(buf)
|
||||||
err := ch.Component.Render(r.Context(), w)
|
err := ch.Component.Render(r.Context(), buf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if ch.ErrorHandler != nil {
|
if ch.ErrorHandler != nil {
|
||||||
|
w.Header().Set("Content-Type", ch.ContentType)
|
||||||
ch.ErrorHandler(r, err).ServeHTTP(w, r)
|
ch.ErrorHandler(r, err).ServeHTTP(w, r)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
http.Error(w, componentHandlerErrorMessage, http.StatusInternalServerError)
|
http.Error(w, componentHandlerErrorMessage, http.StatusInternalServerError)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
w.Header().Set("Content-Type", ch.ContentType)
|
||||||
|
if ch.Status != 0 {
|
||||||
|
w.WriteHeader(ch.Status)
|
||||||
|
}
|
||||||
|
// Ignore write error like http.Error() does, because there is
|
||||||
|
// no way to recover at this point.
|
||||||
|
_, _ = w.Write(buf.Bytes())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handler creates a http.Handler that renders the template.
|
// Handler creates a http.Handler that renders the template.
|
||||||
|
@ -289,7 +300,10 @@ func (css ComponentCSSClass) ClassName() string {
|
||||||
func CSSID(name string, css string) string {
|
func CSSID(name string, css string) string {
|
||||||
sum := sha256.Sum256([]byte(css))
|
sum := sha256.Sum256([]byte(css))
|
||||||
hp := hex.EncodeToString(sum[:])[0:4]
|
hp := hex.EncodeToString(sum[:])[0:4]
|
||||||
return fmt.Sprintf("%s_%s", name, hp)
|
// Benchmarking showed this was fastest, and with fewest allocations (1).
|
||||||
|
// Using strings.Builder (2 allocs).
|
||||||
|
// Using fmt.Sprintf (3 allocs).
|
||||||
|
return name + "_" + hp
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewCSSMiddleware creates HTTP middleware that renders a global stylesheet of ComponentCSSClass
|
// NewCSSMiddleware creates HTTP middleware that renders a global stylesheet of ComponentCSSClass
|
||||||
|
@ -454,6 +468,67 @@ func URL(s string) SafeURL {
|
||||||
// SafeURL is a URL that has been sanitized.
|
// SafeURL is a URL that has been sanitized.
|
||||||
type SafeURL string
|
type SafeURL string
|
||||||
|
|
||||||
|
// Attributes is an alias to map[string]any made for spread attributes.
|
||||||
|
type Attributes map[string]any
|
||||||
|
|
||||||
|
// sortedKeys returns the keys of a map in sorted order.
|
||||||
|
func sortedKeys(m map[string]any) (keys []string) {
|
||||||
|
keys = make([]string, len(m))
|
||||||
|
var i int
|
||||||
|
for k := range m {
|
||||||
|
keys[i] = k
|
||||||
|
i++
|
||||||
|
}
|
||||||
|
sort.Strings(keys)
|
||||||
|
return keys
|
||||||
|
}
|
||||||
|
|
||||||
|
func writeStrings(w io.Writer, ss ...string) (err error) {
|
||||||
|
for _, s := range ss {
|
||||||
|
if _, err = io.WriteString(w, s); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func RenderAttributes(ctx context.Context, w io.Writer, attributes Attributes) (err error) {
|
||||||
|
for _, key := range sortedKeys(attributes) {
|
||||||
|
value := attributes[key]
|
||||||
|
switch value := value.(type) {
|
||||||
|
case string:
|
||||||
|
if err = writeStrings(w, ` `, EscapeString(key), `="`, EscapeString(value), `"`); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
case bool:
|
||||||
|
if value {
|
||||||
|
if err = writeStrings(w, ` `, EscapeString(key)); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case KeyValue[string, bool]:
|
||||||
|
if value.Value {
|
||||||
|
if err = writeStrings(w, ` `, EscapeString(key), `="`, EscapeString(value.Key), `"`); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case KeyValue[bool, bool]:
|
||||||
|
if value.Value && value.Key {
|
||||||
|
if err = writeStrings(w, ` `, EscapeString(key)); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case func() bool:
|
||||||
|
if value() {
|
||||||
|
if err = writeStrings(w, ` `, EscapeString(key)); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// Script handling.
|
// Script handling.
|
||||||
|
|
||||||
func safeEncodeScriptParams(escapeHTML bool, params []any) []string {
|
func safeEncodeScriptParams(escapeHTML bool, params []any) []string {
|
||||||
|
@ -643,3 +718,62 @@ func ReleaseBuffer(b *bytes.Buffer) {
|
||||||
b.Reset()
|
b.Reset()
|
||||||
bufferPool.Put(b)
|
bufferPool.Put(b)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// JoinStringErrs joins an optional list of errors.
|
||||||
|
func JoinStringErrs(s string, errs ...error) (string, error) {
|
||||||
|
return s, errors.Join(errs...)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Error returned during template rendering.
|
||||||
|
type Error struct {
|
||||||
|
Err error
|
||||||
|
// FileName of the template file.
|
||||||
|
FileName string
|
||||||
|
// Line index of the error.
|
||||||
|
Line int
|
||||||
|
// Col index of the error.
|
||||||
|
Col int
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e Error) Error() string {
|
||||||
|
if e.FileName == "" {
|
||||||
|
e.FileName = "templ"
|
||||||
|
}
|
||||||
|
return fmt.Sprintf("%s: error at line %d, col %d: %v", e.FileName, e.Line, e.Col, e.Err)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e Error) Unwrap() error {
|
||||||
|
return e.Err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Raw renders the input HTML to the output without applying HTML escaping.
|
||||||
|
//
|
||||||
|
// Use of this component presents a security risk - the HTML should come from
|
||||||
|
// a trusted source, because it will be included as-is in the output.
|
||||||
|
func Raw[T ~string](html T, errs ...error) Component {
|
||||||
|
return ComponentFunc(func(ctx context.Context, w io.Writer) (err error) {
|
||||||
|
if err = errors.Join(errs...); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
_, err = io.WriteString(w, string(html))
|
||||||
|
return err
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// FromGoHTML creates a templ Component from a Go html/template template.
|
||||||
|
func FromGoHTML(t *template.Template, data any) Component {
|
||||||
|
return ComponentFunc(func(ctx context.Context, w io.Writer) (err error) {
|
||||||
|
return t.Execute(w, data)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// ToGoHTML renders the component to a Go html/template template.HTML string.
|
||||||
|
func ToGoHTML(ctx context.Context, c Component) (s template.HTML, err error) {
|
||||||
|
b := GetBuffer()
|
||||||
|
defer ReleaseBuffer(b)
|
||||||
|
if err = c.Render(ctx, b); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
s = template.HTML(b.String())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
|
@ -3,4 +3,8 @@ package templ
|
||||||
import _ "embed"
|
import _ "embed"
|
||||||
|
|
||||||
//go:embed .version
|
//go:embed .version
|
||||||
var Version string
|
var version string
|
||||||
|
|
||||||
|
func Version() string {
|
||||||
|
return "v" + version
|
||||||
|
}
|
||||||
|
|
|
@ -168,7 +168,7 @@ logger := log.NewWithOptions(os.Stderr, log.Options{
|
||||||
ReportCaller: true,
|
ReportCaller: true,
|
||||||
ReportTimestamp: true,
|
ReportTimestamp: true,
|
||||||
TimeFormat: time.Kitchen,
|
TimeFormat: time.Kitchen,
|
||||||
Prefix: "Baking 🍪 "
|
Prefix: "Baking 🍪 ",
|
||||||
})
|
})
|
||||||
logger.Info("Starting oven!", "degree", 375)
|
logger.Info("Starting oven!", "degree", 375)
|
||||||
time.Sleep(10 * time.Minute)
|
time.Sleep(10 * time.Minute)
|
||||||
|
@ -341,6 +341,16 @@ stdlog.Printf("Failed to make bake request, %s", fmt.Errorf("temperature is too
|
||||||
// ERROR http: Failed to make bake request, temperature is too low
|
// ERROR http: Failed to make bake request, temperature is too low
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Gum
|
||||||
|
|
||||||
|
<img src="https://vhs.charm.sh/vhs-6jupuFM0s2fXiUrBE0I1vU.gif" width="600" alt="Running gum log with debug and error levels" />
|
||||||
|
|
||||||
|
Log integrates with [Gum][gum] to log messages to output. Use `gum log [flags]
|
||||||
|
[message]` to handle logging in your shell scripts. See
|
||||||
|
[charmbracelet/gum](https://github.com/charmbracelet/gum#log) for more
|
||||||
|
information.
|
||||||
|
|
||||||
|
[gum]: https://github.com/charmbracelet/gum
|
||||||
[lipgloss]: https://github.com/charmbracelet/lipgloss
|
[lipgloss]: https://github.com/charmbracelet/lipgloss
|
||||||
[stdlog]: https://pkg.go.dev/log
|
[stdlog]: https://pkg.go.dev/log
|
||||||
|
|
||||||
|
|
|
@ -54,42 +54,27 @@ func DefaultStyles() *Styles {
|
||||||
SetString(strings.ToUpper(DebugLevel.String())).
|
SetString(strings.ToUpper(DebugLevel.String())).
|
||||||
Bold(true).
|
Bold(true).
|
||||||
MaxWidth(4).
|
MaxWidth(4).
|
||||||
Foreground(lipgloss.AdaptiveColor{
|
Foreground(lipgloss.Color("63")),
|
||||||
Light: "63",
|
|
||||||
Dark: "63",
|
|
||||||
}),
|
|
||||||
InfoLevel: lipgloss.NewStyle().
|
InfoLevel: lipgloss.NewStyle().
|
||||||
SetString(strings.ToUpper(InfoLevel.String())).
|
SetString(strings.ToUpper(InfoLevel.String())).
|
||||||
Bold(true).
|
Bold(true).
|
||||||
MaxWidth(4).
|
MaxWidth(4).
|
||||||
Foreground(lipgloss.AdaptiveColor{
|
Foreground(lipgloss.Color("86")),
|
||||||
Light: "39",
|
|
||||||
Dark: "86",
|
|
||||||
}),
|
|
||||||
WarnLevel: lipgloss.NewStyle().
|
WarnLevel: lipgloss.NewStyle().
|
||||||
SetString(strings.ToUpper(WarnLevel.String())).
|
SetString(strings.ToUpper(WarnLevel.String())).
|
||||||
Bold(true).
|
Bold(true).
|
||||||
MaxWidth(4).
|
MaxWidth(4).
|
||||||
Foreground(lipgloss.AdaptiveColor{
|
Foreground(lipgloss.Color("192")),
|
||||||
Light: "208",
|
|
||||||
Dark: "192",
|
|
||||||
}),
|
|
||||||
ErrorLevel: lipgloss.NewStyle().
|
ErrorLevel: lipgloss.NewStyle().
|
||||||
SetString(strings.ToUpper(ErrorLevel.String())).
|
SetString(strings.ToUpper(ErrorLevel.String())).
|
||||||
Bold(true).
|
Bold(true).
|
||||||
MaxWidth(4).
|
MaxWidth(4).
|
||||||
Foreground(lipgloss.AdaptiveColor{
|
Foreground(lipgloss.Color("204")),
|
||||||
Light: "203",
|
|
||||||
Dark: "204",
|
|
||||||
}),
|
|
||||||
FatalLevel: lipgloss.NewStyle().
|
FatalLevel: lipgloss.NewStyle().
|
||||||
SetString(strings.ToUpper(FatalLevel.String())).
|
SetString(strings.ToUpper(FatalLevel.String())).
|
||||||
Bold(true).
|
Bold(true).
|
||||||
MaxWidth(4).
|
MaxWidth(4).
|
||||||
Foreground(lipgloss.AdaptiveColor{
|
Foreground(lipgloss.Color("134")),
|
||||||
Light: "133",
|
|
||||||
Dark: "134",
|
|
||||||
}),
|
|
||||||
},
|
},
|
||||||
Keys: map[string]lipgloss.Style{},
|
Keys: map[string]lipgloss.Style{},
|
||||||
Values: map[string]lipgloss.Style{},
|
Values: map[string]lipgloss.Style{},
|
||||||
|
|
|
@ -1,5 +1,17 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## v4.11.4 - 2023-12-20
|
||||||
|
|
||||||
|
**Security**
|
||||||
|
|
||||||
|
* Upgrade golang.org/x/crypto to v0.17.0 to fix vulnerability [issue](https://pkg.go.dev/vuln/GO-2023-2402) [#2562](https://github.com/labstack/echo/pull/2562)
|
||||||
|
|
||||||
|
**Enhancements**
|
||||||
|
|
||||||
|
* Update deps and mark Go version to 1.18 as this is what golang.org/x/* use [#2563](https://github.com/labstack/echo/pull/2563)
|
||||||
|
* Request logger: add example for Slog https://pkg.go.dev/log/slog [#2543](https://github.com/labstack/echo/pull/2543)
|
||||||
|
|
||||||
|
|
||||||
## v4.11.3 - 2023-11-07
|
## v4.11.3 - 2023-11-07
|
||||||
|
|
||||||
**Security**
|
**Security**
|
||||||
|
|
|
@ -259,7 +259,7 @@ const (
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// Version of Echo
|
// Version of Echo
|
||||||
Version = "4.11.3"
|
Version = "4.11.4"
|
||||||
website = "https://echo.labstack.com"
|
website = "https://echo.labstack.com"
|
||||||
// http://patorjk.com/software/taag/#p=display&f=Small%20Slant&t=Echo
|
// http://patorjk.com/software/taag/#p=display&f=Small%20Slant&t=Echo
|
||||||
banner = `
|
banner = `
|
||||||
|
|
|
@ -8,6 +8,30 @@ import (
|
||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Example for `slog` https://pkg.go.dev/log/slog
|
||||||
|
// logger := slog.New(slog.NewJSONHandler(os.Stdout, nil))
|
||||||
|
// e.Use(middleware.RequestLoggerWithConfig(middleware.RequestLoggerConfig{
|
||||||
|
// LogStatus: true,
|
||||||
|
// LogURI: true,
|
||||||
|
// LogError: true,
|
||||||
|
// HandleError: true, // forwards error to the global error handler, so it can decide appropriate status code
|
||||||
|
// LogValuesFunc: func(c echo.Context, v middleware.RequestLoggerValues) error {
|
||||||
|
// if v.Error == nil {
|
||||||
|
// logger.LogAttrs(context.Background(), slog.LevelInfo, "REQUEST",
|
||||||
|
// slog.String("uri", v.URI),
|
||||||
|
// slog.Int("status", v.Status),
|
||||||
|
// )
|
||||||
|
// } else {
|
||||||
|
// logger.LogAttrs(context.Background(), slog.LevelError, "REQUEST_ERROR",
|
||||||
|
// slog.String("uri", v.URI),
|
||||||
|
// slog.Int("status", v.Status),
|
||||||
|
// slog.String("err", v.Error.Error()),
|
||||||
|
// )
|
||||||
|
// }
|
||||||
|
// return nil
|
||||||
|
// },
|
||||||
|
// }))
|
||||||
|
//
|
||||||
// Example for `fmt.Printf`
|
// Example for `fmt.Printf`
|
||||||
// e.Use(middleware.RequestLoggerWithConfig(middleware.RequestLoggerConfig{
|
// e.Use(middleware.RequestLoggerWithConfig(middleware.RequestLoggerConfig{
|
||||||
// LogStatus: true,
|
// LogStatus: true,
|
||||||
|
|
|
@ -204,6 +204,7 @@ Options:
|
||||||
- `KeepEndTags` preserve all end tags
|
- `KeepEndTags` preserve all end tags
|
||||||
- `KeepQuotes` preserve quotes around attribute values
|
- `KeepQuotes` preserve quotes around attribute values
|
||||||
- `KeepWhitespace` preserve whitespace between inline tags but still collapse multiple whitespace characters into one
|
- `KeepWhitespace` preserve whitespace between inline tags but still collapse multiple whitespace characters into one
|
||||||
|
- `TemplateDelims` preserve context within and surrounding the given opening and closing delimiters
|
||||||
|
|
||||||
After recent benchmarking and profiling it became really fast and minifies pages in the 10ms range, making it viable for on-the-fly minification.
|
After recent benchmarking and profiling it became really fast and minifies pages in the 10ms range, making it viable for on-the-fly minification.
|
||||||
|
|
||||||
|
|
|
@ -166,6 +166,7 @@ func (l *Lexer) Next() (TokenType, []byte) {
|
||||||
isEndTag := c == '/' && l.r.Peek(2) != '>' && (l.r.Peek(2) != 0 || l.r.PeekErr(2) == nil)
|
isEndTag := c == '/' && l.r.Peek(2) != '>' && (l.r.Peek(2) != 0 || l.r.PeekErr(2) == nil)
|
||||||
if !isEndTag && (c < 'a' || 'z' < c) && (c < 'A' || 'Z' < c) && c != '!' && c != '?' {
|
if !isEndTag && (c < 'a' || 'z' < c) && (c < 'A' || 'Z' < c) && c != '!' && c != '?' {
|
||||||
// not a tag
|
// not a tag
|
||||||
|
l.r.Move(1)
|
||||||
} else if 0 < l.r.Pos() {
|
} else if 0 < l.r.Pos() {
|
||||||
// return currently buffered texttoken so that we can return tag next iteration
|
// return currently buffered texttoken so that we can return tag next iteration
|
||||||
l.text = l.r.Shift()
|
l.text = l.r.Shift()
|
||||||
|
@ -184,6 +185,10 @@ func (l *Lexer) Next() (TokenType, []byte) {
|
||||||
} else if c == '!' {
|
} else if c == '!' {
|
||||||
l.r.Move(2)
|
l.r.Move(2)
|
||||||
return l.readMarkup()
|
return l.readMarkup()
|
||||||
|
} else if 0 < len(l.tmplBegin) && l.at(l.tmplBegin...) {
|
||||||
|
l.r.Move(len(l.tmplBegin))
|
||||||
|
l.moveTemplate()
|
||||||
|
l.hasTmpl = true
|
||||||
} else if c == '?' {
|
} else if c == '?' {
|
||||||
l.r.Move(1)
|
l.r.Move(1)
|
||||||
return CommentToken, l.shiftBogusComment()
|
return CommentToken, l.shiftBogusComment()
|
||||||
|
@ -198,8 +203,9 @@ func (l *Lexer) Next() (TokenType, []byte) {
|
||||||
return TextToken, l.text
|
return TextToken, l.text
|
||||||
}
|
}
|
||||||
return ErrorToken, nil
|
return ErrorToken, nil
|
||||||
|
} else {
|
||||||
|
l.r.Move(1)
|
||||||
}
|
}
|
||||||
l.r.Move(1)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -535,19 +541,19 @@ func (l *Lexer) shiftXML(rawTag Hash) []byte {
|
||||||
|
|
||||||
func (l *Lexer) moveTemplate() {
|
func (l *Lexer) moveTemplate() {
|
||||||
for {
|
for {
|
||||||
if c := l.r.Peek(0); l.at(l.tmplEnd...) || c == 0 && l.r.Err() != nil {
|
if c := l.r.Peek(0); c == 0 && l.r.Err() != nil {
|
||||||
if c != 0 {
|
return
|
||||||
l.r.Move(len(l.tmplEnd))
|
} else if l.at(l.tmplEnd...) {
|
||||||
}
|
l.r.Move(len(l.tmplEnd))
|
||||||
break
|
return
|
||||||
} else if c == '"' || c == '\'' {
|
} else if c == '"' || c == '\'' {
|
||||||
l.r.Move(1)
|
l.r.Move(1)
|
||||||
escape := false
|
escape := false
|
||||||
for {
|
for {
|
||||||
if c2 := l.r.Peek(0); !escape && c2 == c || c2 == 0 && l.r.Err() != nil {
|
if c2 := l.r.Peek(0); c2 == 0 && l.r.Err() != nil {
|
||||||
if c2 != 0 {
|
return
|
||||||
l.r.Move(1)
|
} else if !escape && c2 == c {
|
||||||
}
|
l.r.Move(1)
|
||||||
break
|
break
|
||||||
} else if c2 == '\\' {
|
} else if c2 == '\\' {
|
||||||
escape = !escape
|
escape = !escape
|
||||||
|
|
|
@ -0,0 +1,403 @@
|
||||||
|
package html
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/tdewolff/parse/v2"
|
||||||
|
"github.com/tdewolff/parse/v2/css"
|
||||||
|
)
|
||||||
|
|
||||||
|
type AST struct {
|
||||||
|
Children []*Tag
|
||||||
|
Text []byte
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ast *AST) String() string {
|
||||||
|
sb := strings.Builder{}
|
||||||
|
for i, child := range ast.Children {
|
||||||
|
if i != 0 {
|
||||||
|
sb.WriteString("\n")
|
||||||
|
}
|
||||||
|
sb.WriteString(child.ASTString())
|
||||||
|
}
|
||||||
|
return sb.String()
|
||||||
|
}
|
||||||
|
|
||||||
|
type Attr struct {
|
||||||
|
Key, Val []byte
|
||||||
|
}
|
||||||
|
|
||||||
|
func (attr *Attr) String() string {
|
||||||
|
return fmt.Sprintf(`%s="%s"`, string(attr.Key), string(attr.Val))
|
||||||
|
}
|
||||||
|
|
||||||
|
type Tag struct {
|
||||||
|
Root *AST
|
||||||
|
Parent *Tag
|
||||||
|
Prev, Next *Tag
|
||||||
|
Children []*Tag
|
||||||
|
Index int
|
||||||
|
|
||||||
|
Name []byte
|
||||||
|
Attrs []Attr
|
||||||
|
textStart, textEnd int
|
||||||
|
}
|
||||||
|
|
||||||
|
func (tag *Tag) getAttr(key []byte) ([]byte, bool) {
|
||||||
|
for _, attr := range tag.Attrs {
|
||||||
|
if bytes.Equal(key, attr.Key) {
|
||||||
|
return attr.Val, true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil, false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (tag *Tag) GetAttr(key string) (string, bool) {
|
||||||
|
val, ok := tag.getAttr([]byte(key))
|
||||||
|
return string(val), ok
|
||||||
|
}
|
||||||
|
|
||||||
|
func (tag *Tag) Text() string {
|
||||||
|
return string(tag.Root.Text[tag.textStart:tag.textEnd])
|
||||||
|
}
|
||||||
|
|
||||||
|
func (tag *Tag) String() string {
|
||||||
|
sb := strings.Builder{}
|
||||||
|
sb.WriteString("<")
|
||||||
|
sb.Write(tag.Name)
|
||||||
|
for _, attr := range tag.Attrs {
|
||||||
|
sb.WriteString(" ")
|
||||||
|
sb.WriteString(attr.String())
|
||||||
|
}
|
||||||
|
sb.WriteString(">")
|
||||||
|
return sb.String()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (tag *Tag) ASTString() string {
|
||||||
|
sb := strings.Builder{}
|
||||||
|
sb.WriteString(tag.String())
|
||||||
|
for _, child := range tag.Children {
|
||||||
|
sb.WriteString("\n ")
|
||||||
|
s := child.ASTString()
|
||||||
|
s = strings.ReplaceAll(s, "\n", "\n ")
|
||||||
|
sb.WriteString(s)
|
||||||
|
}
|
||||||
|
return sb.String()
|
||||||
|
}
|
||||||
|
|
||||||
|
func Parse(r *parse.Input) (*AST, error) {
|
||||||
|
ast := &AST{}
|
||||||
|
root := &Tag{}
|
||||||
|
cur := root
|
||||||
|
|
||||||
|
l := NewLexer(r)
|
||||||
|
for {
|
||||||
|
tt, data := l.Next()
|
||||||
|
switch tt {
|
||||||
|
case ErrorToken:
|
||||||
|
if err := l.Err(); err != io.EOF {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
ast.Children = root.Children
|
||||||
|
return ast, nil
|
||||||
|
case TextToken:
|
||||||
|
ast.Text = append(ast.Text, data...)
|
||||||
|
case StartTagToken:
|
||||||
|
child := &Tag{
|
||||||
|
Root: ast,
|
||||||
|
Parent: cur,
|
||||||
|
Index: len(cur.Children),
|
||||||
|
Name: l.Text(),
|
||||||
|
textStart: len(ast.Text),
|
||||||
|
}
|
||||||
|
if 0 < len(cur.Children) {
|
||||||
|
child.Prev = cur.Children[len(cur.Children)-1]
|
||||||
|
child.Prev.Next = child
|
||||||
|
}
|
||||||
|
cur.Children = append(cur.Children, child)
|
||||||
|
cur = child
|
||||||
|
case AttributeToken:
|
||||||
|
val := l.AttrVal()
|
||||||
|
if 0 < len(val) && (val[0] == '"' || val[0] == '\'') {
|
||||||
|
val = val[1 : len(val)-1]
|
||||||
|
}
|
||||||
|
cur.Attrs = append(cur.Attrs, Attr{l.AttrKey(), val})
|
||||||
|
case StartTagCloseToken:
|
||||||
|
if voidTags[string(cur.Name)] {
|
||||||
|
cur.textEnd = len(ast.Text)
|
||||||
|
cur = cur.Parent
|
||||||
|
}
|
||||||
|
case EndTagToken, StartTagVoidToken:
|
||||||
|
start := cur
|
||||||
|
for start != root && !bytes.Equal(l.Text(), start.Name) {
|
||||||
|
start = start.Parent
|
||||||
|
}
|
||||||
|
if start == root {
|
||||||
|
// ignore
|
||||||
|
} else {
|
||||||
|
parent := start.Parent
|
||||||
|
for cur != parent {
|
||||||
|
cur.textEnd = len(ast.Text)
|
||||||
|
cur = cur.Parent
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ast *AST) Query(s string) (*Tag, error) {
|
||||||
|
sel, err := ParseSelector(s)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, child := range ast.Children {
|
||||||
|
if match := child.query(sel); match != nil {
|
||||||
|
return match, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (tag *Tag) query(sel selector) *Tag {
|
||||||
|
if sel.AppliesTo(tag) {
|
||||||
|
return tag
|
||||||
|
}
|
||||||
|
for _, child := range tag.Children {
|
||||||
|
if match := child.query(sel); match != nil {
|
||||||
|
return match
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ast *AST) QueryAll(s string) ([]*Tag, error) {
|
||||||
|
sel, err := ParseSelector(s)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
matches := []*Tag{}
|
||||||
|
for _, child := range ast.Children {
|
||||||
|
child.queryAll(&matches, sel)
|
||||||
|
}
|
||||||
|
return matches, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (tag *Tag) queryAll(matches *[]*Tag, sel selector) {
|
||||||
|
if sel.AppliesTo(tag) {
|
||||||
|
*matches = append(*matches, tag)
|
||||||
|
}
|
||||||
|
for _, child := range tag.Children {
|
||||||
|
child.queryAll(matches, sel)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type attrSelector struct {
|
||||||
|
op byte // empty, =, ~, |
|
||||||
|
attr []byte
|
||||||
|
val []byte
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sel attrSelector) AppliesTo(tag *Tag) bool {
|
||||||
|
val, ok := tag.getAttr(sel.attr)
|
||||||
|
if !ok {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
switch sel.op {
|
||||||
|
case 0:
|
||||||
|
return true
|
||||||
|
case '=':
|
||||||
|
return bytes.Equal(val, sel.val)
|
||||||
|
case '~':
|
||||||
|
if 0 < len(sel.val) {
|
||||||
|
vals := bytes.Split(val, []byte(" "))
|
||||||
|
for _, val := range vals {
|
||||||
|
if bytes.Equal(val, sel.val) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case '|':
|
||||||
|
return bytes.Equal(val, sel.val) || bytes.HasPrefix(val, append(sel.val, '-'))
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (attr attrSelector) String() string {
|
||||||
|
sb := strings.Builder{}
|
||||||
|
sb.Write(attr.attr)
|
||||||
|
if attr.op != 0 {
|
||||||
|
sb.WriteByte(attr.op)
|
||||||
|
if attr.op != '=' {
|
||||||
|
sb.WriteByte('=')
|
||||||
|
}
|
||||||
|
sb.WriteByte('"')
|
||||||
|
sb.Write(attr.val)
|
||||||
|
sb.WriteByte('"')
|
||||||
|
}
|
||||||
|
return sb.String()
|
||||||
|
}
|
||||||
|
|
||||||
|
type selectorNode struct {
|
||||||
|
typ []byte // is * for universal
|
||||||
|
attrs []attrSelector
|
||||||
|
op byte // space or >, last is NULL
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sel selectorNode) AppliesTo(tag *Tag) bool {
|
||||||
|
if 0 < len(sel.typ) && !bytes.Equal(sel.typ, []byte("*")) && !bytes.Equal(sel.typ, tag.Name) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
for _, attr := range sel.attrs {
|
||||||
|
if !attr.AppliesTo(tag) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sel selectorNode) String() string {
|
||||||
|
sb := strings.Builder{}
|
||||||
|
sb.Write(sel.typ)
|
||||||
|
for _, attr := range sel.attrs {
|
||||||
|
if bytes.Equal(attr.attr, []byte("id")) && attr.op == '=' {
|
||||||
|
sb.WriteByte('#')
|
||||||
|
sb.Write(attr.val)
|
||||||
|
} else if bytes.Equal(attr.attr, []byte("class")) && attr.op == '~' {
|
||||||
|
sb.WriteByte('.')
|
||||||
|
sb.Write(attr.val)
|
||||||
|
} else {
|
||||||
|
sb.WriteByte('[')
|
||||||
|
sb.WriteString(attr.String())
|
||||||
|
sb.WriteByte(']')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if sel.op != 0 {
|
||||||
|
sb.WriteByte(' ')
|
||||||
|
sb.WriteByte(sel.op)
|
||||||
|
sb.WriteByte(' ')
|
||||||
|
}
|
||||||
|
return sb.String()
|
||||||
|
}
|
||||||
|
|
||||||
|
type token struct {
|
||||||
|
tt css.TokenType
|
||||||
|
data []byte
|
||||||
|
}
|
||||||
|
|
||||||
|
type selector []selectorNode
|
||||||
|
|
||||||
|
func ParseSelector(s string) (selector, error) {
|
||||||
|
ts := []token{}
|
||||||
|
l := css.NewLexer(parse.NewInputString(s))
|
||||||
|
for {
|
||||||
|
tt, data := l.Next()
|
||||||
|
if tt == css.ErrorToken {
|
||||||
|
if err := l.Err(); err != io.EOF {
|
||||||
|
return selector{}, err
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
ts = append(ts, token{
|
||||||
|
tt: tt,
|
||||||
|
data: data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
sel := selector{}
|
||||||
|
node := selectorNode{}
|
||||||
|
for i := 0; i < len(ts); i++ {
|
||||||
|
t := ts[i]
|
||||||
|
if 0 < i && (t.tt == css.WhitespaceToken || t.tt == css.DelimToken && t.data[0] == '>') {
|
||||||
|
if t.tt == css.DelimToken {
|
||||||
|
node.op = '>'
|
||||||
|
} else {
|
||||||
|
node.op = ' '
|
||||||
|
}
|
||||||
|
sel = append(sel, node)
|
||||||
|
node = selectorNode{}
|
||||||
|
} else if t.tt == css.IdentToken || t.tt == css.DelimToken && t.data[0] == '*' {
|
||||||
|
node.typ = t.data
|
||||||
|
} else if t.tt == css.DelimToken && (t.data[0] == '.' || t.data[0] == '#') && i+1 < len(ts) && ts[i+1].tt == css.IdentToken {
|
||||||
|
if t.data[0] == '#' {
|
||||||
|
node.attrs = append(node.attrs, attrSelector{op: '=', attr: []byte("id"), val: ts[i+1].data})
|
||||||
|
} else {
|
||||||
|
node.attrs = append(node.attrs, attrSelector{op: '~', attr: []byte("class"), val: ts[i+1].data})
|
||||||
|
}
|
||||||
|
i++
|
||||||
|
} else if t.tt == css.DelimToken && t.data[0] == '[' && i+2 < len(ts) && ts[i+1].tt == css.IdentToken && ts[i+2].tt == css.DelimToken {
|
||||||
|
if ts[i+2].data[0] == ']' {
|
||||||
|
node.attrs = append(node.attrs, attrSelector{op: 0, attr: ts[i+1].data})
|
||||||
|
i += 2
|
||||||
|
} else if i+4 < len(ts) && ts[i+3].tt == css.IdentToken && ts[i+4].tt == css.DelimToken && ts[i+4].data[0] == ']' {
|
||||||
|
node.attrs = append(node.attrs, attrSelector{op: ts[i+2].data[0], attr: ts[i+1].data, val: ts[i+3].data})
|
||||||
|
i += 4
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sel = append(sel, node)
|
||||||
|
return sel, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sels selector) AppliesTo(tag *Tag) bool {
|
||||||
|
if len(sels) == 0 {
|
||||||
|
return true
|
||||||
|
} else if !sels[len(sels)-1].AppliesTo(tag) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
tag = tag.Parent
|
||||||
|
isel := len(sels) - 2
|
||||||
|
for 0 <= isel && tag != nil {
|
||||||
|
switch sels[isel].op {
|
||||||
|
case ' ':
|
||||||
|
for tag != nil {
|
||||||
|
if sels[isel].AppliesTo(tag) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
tag = tag.Parent
|
||||||
|
}
|
||||||
|
case '>':
|
||||||
|
if !sels[isel].AppliesTo(tag) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
tag = tag.Parent
|
||||||
|
default:
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
isel--
|
||||||
|
}
|
||||||
|
return len(sels) != 0 && isel == -1
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sels selector) String() string {
|
||||||
|
if len(sels) == 0 {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
sb := strings.Builder{}
|
||||||
|
for _, sel := range sels {
|
||||||
|
sb.WriteString(sel.String())
|
||||||
|
}
|
||||||
|
return sb.String()[1:]
|
||||||
|
}
|
||||||
|
|
||||||
|
var voidTags = map[string]bool{
|
||||||
|
"area": true,
|
||||||
|
"base": true,
|
||||||
|
"br": true,
|
||||||
|
"col": true,
|
||||||
|
"embed": true,
|
||||||
|
"hr": true,
|
||||||
|
"img": true,
|
||||||
|
"input": true,
|
||||||
|
"link": true,
|
||||||
|
"meta": true,
|
||||||
|
"source": true,
|
||||||
|
"track": true,
|
||||||
|
"wbr": true,
|
||||||
|
}
|
|
@ -3,7 +3,6 @@
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build go1.12
|
//go:build go1.12
|
||||||
// +build go1.12
|
|
||||||
|
|
||||||
package acme
|
package acme
|
||||||
|
|
||||||
|
|
|
@ -20,41 +20,44 @@ import (
|
||||||
// TODO: Benchmark to determine if the pools are necessary. The GC may have
|
// TODO: Benchmark to determine if the pools are necessary. The GC may have
|
||||||
// improved enough that we can instead allocate chunks like this:
|
// improved enough that we can instead allocate chunks like this:
|
||||||
// make([]byte, max(16<<10, expectedBytesRemaining))
|
// make([]byte, max(16<<10, expectedBytesRemaining))
|
||||||
var (
|
var dataChunkPools = [...]sync.Pool{
|
||||||
dataChunkSizeClasses = []int{
|
{New: func() interface{} { return new([1 << 10]byte) }},
|
||||||
1 << 10,
|
{New: func() interface{} { return new([2 << 10]byte) }},
|
||||||
2 << 10,
|
{New: func() interface{} { return new([4 << 10]byte) }},
|
||||||
4 << 10,
|
{New: func() interface{} { return new([8 << 10]byte) }},
|
||||||
8 << 10,
|
{New: func() interface{} { return new([16 << 10]byte) }},
|
||||||
16 << 10,
|
}
|
||||||
}
|
|
||||||
dataChunkPools = [...]sync.Pool{
|
|
||||||
{New: func() interface{} { return make([]byte, 1<<10) }},
|
|
||||||
{New: func() interface{} { return make([]byte, 2<<10) }},
|
|
||||||
{New: func() interface{} { return make([]byte, 4<<10) }},
|
|
||||||
{New: func() interface{} { return make([]byte, 8<<10) }},
|
|
||||||
{New: func() interface{} { return make([]byte, 16<<10) }},
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
func getDataBufferChunk(size int64) []byte {
|
func getDataBufferChunk(size int64) []byte {
|
||||||
i := 0
|
switch {
|
||||||
for ; i < len(dataChunkSizeClasses)-1; i++ {
|
case size <= 1<<10:
|
||||||
if size <= int64(dataChunkSizeClasses[i]) {
|
return dataChunkPools[0].Get().(*[1 << 10]byte)[:]
|
||||||
break
|
case size <= 2<<10:
|
||||||
}
|
return dataChunkPools[1].Get().(*[2 << 10]byte)[:]
|
||||||
|
case size <= 4<<10:
|
||||||
|
return dataChunkPools[2].Get().(*[4 << 10]byte)[:]
|
||||||
|
case size <= 8<<10:
|
||||||
|
return dataChunkPools[3].Get().(*[8 << 10]byte)[:]
|
||||||
|
default:
|
||||||
|
return dataChunkPools[4].Get().(*[16 << 10]byte)[:]
|
||||||
}
|
}
|
||||||
return dataChunkPools[i].Get().([]byte)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func putDataBufferChunk(p []byte) {
|
func putDataBufferChunk(p []byte) {
|
||||||
for i, n := range dataChunkSizeClasses {
|
switch len(p) {
|
||||||
if len(p) == n {
|
case 1 << 10:
|
||||||
dataChunkPools[i].Put(p)
|
dataChunkPools[0].Put((*[1 << 10]byte)(p))
|
||||||
return
|
case 2 << 10:
|
||||||
}
|
dataChunkPools[1].Put((*[2 << 10]byte)(p))
|
||||||
|
case 4 << 10:
|
||||||
|
dataChunkPools[2].Put((*[4 << 10]byte)(p))
|
||||||
|
case 8 << 10:
|
||||||
|
dataChunkPools[3].Put((*[8 << 10]byte)(p))
|
||||||
|
case 16 << 10:
|
||||||
|
dataChunkPools[4].Put((*[16 << 10]byte)(p))
|
||||||
|
default:
|
||||||
|
panic(fmt.Sprintf("unexpected buffer len=%v", len(p)))
|
||||||
}
|
}
|
||||||
panic(fmt.Sprintf("unexpected buffer len=%v", len(p)))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// dataBuffer is an io.ReadWriter backed by a list of data chunks.
|
// dataBuffer is an io.ReadWriter backed by a list of data chunks.
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
// Copyright 2018 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
//go:build go1.11
|
|
||||||
// +build go1.11
|
|
||||||
|
|
||||||
package http2
|
|
||||||
|
|
||||||
import (
|
|
||||||
"net/http/httptrace"
|
|
||||||
"net/textproto"
|
|
||||||
)
|
|
||||||
|
|
||||||
func traceHasWroteHeaderField(trace *httptrace.ClientTrace) bool {
|
|
||||||
return trace != nil && trace.WroteHeaderField != nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func traceWroteHeaderField(trace *httptrace.ClientTrace, k, v string) {
|
|
||||||
if trace != nil && trace.WroteHeaderField != nil {
|
|
||||||
trace.WroteHeaderField(k, []string{v})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func traceGot1xxResponseFunc(trace *httptrace.ClientTrace) func(int, textproto.MIMEHeader) error {
|
|
||||||
if trace != nil {
|
|
||||||
return trace.Got1xxResponse
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
|
@ -1,27 +0,0 @@
|
||||||
// Copyright 2021 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
//go:build go1.15
|
|
||||||
// +build go1.15
|
|
||||||
|
|
||||||
package http2
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"crypto/tls"
|
|
||||||
)
|
|
||||||
|
|
||||||
// dialTLSWithContext uses tls.Dialer, added in Go 1.15, to open a TLS
|
|
||||||
// connection.
|
|
||||||
func (t *Transport) dialTLSWithContext(ctx context.Context, network, addr string, cfg *tls.Config) (*tls.Conn, error) {
|
|
||||||
dialer := &tls.Dialer{
|
|
||||||
Config: cfg,
|
|
||||||
}
|
|
||||||
cn, err := dialer.DialContext(ctx, network, addr)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
tlsCn := cn.(*tls.Conn) // DialContext comment promises this will always succeed
|
|
||||||
return tlsCn, nil
|
|
||||||
}
|
|
|
@ -1,17 +0,0 @@
|
||||||
// Copyright 2021 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
//go:build go1.18
|
|
||||||
// +build go1.18
|
|
||||||
|
|
||||||
package http2
|
|
||||||
|
|
||||||
import (
|
|
||||||
"crypto/tls"
|
|
||||||
"net"
|
|
||||||
)
|
|
||||||
|
|
||||||
func tlsUnderlyingConn(tc *tls.Conn) net.Conn {
|
|
||||||
return tc.NetConn()
|
|
||||||
}
|
|
|
@ -1,21 +0,0 @@
|
||||||
// Copyright 2018 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
//go:build !go1.11
|
|
||||||
// +build !go1.11
|
|
||||||
|
|
||||||
package http2
|
|
||||||
|
|
||||||
import (
|
|
||||||
"net/http/httptrace"
|
|
||||||
"net/textproto"
|
|
||||||
)
|
|
||||||
|
|
||||||
func traceHasWroteHeaderField(trace *httptrace.ClientTrace) bool { return false }
|
|
||||||
|
|
||||||
func traceWroteHeaderField(trace *httptrace.ClientTrace, k, v string) {}
|
|
||||||
|
|
||||||
func traceGot1xxResponseFunc(trace *httptrace.ClientTrace) func(int, textproto.MIMEHeader) error {
|
|
||||||
return nil
|
|
||||||
}
|
|
|
@ -1,31 +0,0 @@
|
||||||
// Copyright 2021 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
//go:build !go1.15
|
|
||||||
// +build !go1.15
|
|
||||||
|
|
||||||
package http2
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"crypto/tls"
|
|
||||||
)
|
|
||||||
|
|
||||||
// dialTLSWithContext opens a TLS connection.
|
|
||||||
func (t *Transport) dialTLSWithContext(ctx context.Context, network, addr string, cfg *tls.Config) (*tls.Conn, error) {
|
|
||||||
cn, err := tls.Dial(network, addr, cfg)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if err := cn.Handshake(); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if cfg.InsecureSkipVerify {
|
|
||||||
return cn, nil
|
|
||||||
}
|
|
||||||
if err := cn.VerifyHostname(cfg.ServerName); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return cn, nil
|
|
||||||
}
|
|
|
@ -1,17 +0,0 @@
|
||||||
// Copyright 2021 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
//go:build !go1.18
|
|
||||||
// +build !go1.18
|
|
||||||
|
|
||||||
package http2
|
|
||||||
|
|
||||||
import (
|
|
||||||
"crypto/tls"
|
|
||||||
"net"
|
|
||||||
)
|
|
||||||
|
|
||||||
func tlsUnderlyingConn(tc *tls.Conn) net.Conn {
|
|
||||||
return nil
|
|
||||||
}
|
|
|
@ -2549,7 +2549,6 @@ type responseWriterState struct {
|
||||||
wroteHeader bool // WriteHeader called (explicitly or implicitly). Not necessarily sent to user yet.
|
wroteHeader bool // WriteHeader called (explicitly or implicitly). Not necessarily sent to user yet.
|
||||||
sentHeader bool // have we sent the header frame?
|
sentHeader bool // have we sent the header frame?
|
||||||
handlerDone bool // handler has finished
|
handlerDone bool // handler has finished
|
||||||
dirty bool // a Write failed; don't reuse this responseWriterState
|
|
||||||
|
|
||||||
sentContentLen int64 // non-zero if handler set a Content-Length header
|
sentContentLen int64 // non-zero if handler set a Content-Length header
|
||||||
wroteBytes int64
|
wroteBytes int64
|
||||||
|
@ -2669,7 +2668,6 @@ func (rws *responseWriterState) writeChunk(p []byte) (n int, err error) {
|
||||||
date: date,
|
date: date,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
rws.dirty = true
|
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
if endStream {
|
if endStream {
|
||||||
|
@ -2690,7 +2688,6 @@ func (rws *responseWriterState) writeChunk(p []byte) (n int, err error) {
|
||||||
if len(p) > 0 || endStream {
|
if len(p) > 0 || endStream {
|
||||||
// only send a 0 byte DATA frame if we're ending the stream.
|
// only send a 0 byte DATA frame if we're ending the stream.
|
||||||
if err := rws.conn.writeDataFromHandler(rws.stream, p, endStream); err != nil {
|
if err := rws.conn.writeDataFromHandler(rws.stream, p, endStream); err != nil {
|
||||||
rws.dirty = true
|
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2702,9 +2699,6 @@ func (rws *responseWriterState) writeChunk(p []byte) (n int, err error) {
|
||||||
trailers: rws.trailers,
|
trailers: rws.trailers,
|
||||||
endStream: true,
|
endStream: true,
|
||||||
})
|
})
|
||||||
if err != nil {
|
|
||||||
rws.dirty = true
|
|
||||||
}
|
|
||||||
return len(p), err
|
return len(p), err
|
||||||
}
|
}
|
||||||
return len(p), nil
|
return len(p), nil
|
||||||
|
@ -2920,14 +2914,12 @@ func (rws *responseWriterState) writeHeader(code int) {
|
||||||
h.Del("Transfer-Encoding")
|
h.Del("Transfer-Encoding")
|
||||||
}
|
}
|
||||||
|
|
||||||
if rws.conn.writeHeaders(rws.stream, &writeResHeaders{
|
rws.conn.writeHeaders(rws.stream, &writeResHeaders{
|
||||||
streamID: rws.stream.id,
|
streamID: rws.stream.id,
|
||||||
httpResCode: code,
|
httpResCode: code,
|
||||||
h: h,
|
h: h,
|
||||||
endStream: rws.handlerDone && !rws.hasTrailers(),
|
endStream: rws.handlerDone && !rws.hasTrailers(),
|
||||||
}) != nil {
|
})
|
||||||
rws.dirty = true
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -2992,19 +2984,10 @@ func (w *responseWriter) write(lenData int, dataB []byte, dataS string) (n int,
|
||||||
|
|
||||||
func (w *responseWriter) handlerDone() {
|
func (w *responseWriter) handlerDone() {
|
||||||
rws := w.rws
|
rws := w.rws
|
||||||
dirty := rws.dirty
|
|
||||||
rws.handlerDone = true
|
rws.handlerDone = true
|
||||||
w.Flush()
|
w.Flush()
|
||||||
w.rws = nil
|
w.rws = nil
|
||||||
if !dirty {
|
responseWriterStatePool.Put(rws)
|
||||||
// Only recycle the pool if all prior Write calls to
|
|
||||||
// the serverConn goroutine completed successfully. If
|
|
||||||
// they returned earlier due to resets from the peer
|
|
||||||
// there might still be write goroutines outstanding
|
|
||||||
// from the serverConn referencing the rws memory. See
|
|
||||||
// issue 20704.
|
|
||||||
responseWriterStatePool.Put(rws)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Push errors.
|
// Push errors.
|
||||||
|
@ -3187,6 +3170,7 @@ func (sc *serverConn) startPush(msg *startPushRequest) {
|
||||||
panic(fmt.Sprintf("newWriterAndRequestNoBody(%+v): %v", msg.url, err))
|
panic(fmt.Sprintf("newWriterAndRequestNoBody(%+v): %v", msg.url, err))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sc.curHandlers++
|
||||||
go sc.runHandler(rw, req, sc.handler.ServeHTTP)
|
go sc.runHandler(rw, req, sc.handler.ServeHTTP)
|
||||||
return promisedID, nil
|
return promisedID, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -1018,7 +1018,7 @@ func (cc *ClientConn) forceCloseConn() {
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if nc := tlsUnderlyingConn(tc); nc != nil {
|
if nc := tc.NetConn(); nc != nil {
|
||||||
nc.Close()
|
nc.Close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3201,3 +3201,34 @@ func traceFirstResponseByte(trace *httptrace.ClientTrace) {
|
||||||
trace.GotFirstResponseByte()
|
trace.GotFirstResponseByte()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func traceHasWroteHeaderField(trace *httptrace.ClientTrace) bool {
|
||||||
|
return trace != nil && trace.WroteHeaderField != nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func traceWroteHeaderField(trace *httptrace.ClientTrace, k, v string) {
|
||||||
|
if trace != nil && trace.WroteHeaderField != nil {
|
||||||
|
trace.WroteHeaderField(k, []string{v})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func traceGot1xxResponseFunc(trace *httptrace.ClientTrace) func(int, textproto.MIMEHeader) error {
|
||||||
|
if trace != nil {
|
||||||
|
return trace.Got1xxResponse
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// dialTLSWithContext uses tls.Dialer, added in Go 1.15, to open a TLS
|
||||||
|
// connection.
|
||||||
|
func (t *Transport) dialTLSWithContext(ctx context.Context, network, addr string, cfg *tls.Config) (*tls.Conn, error) {
|
||||||
|
dialer := &tls.Dialer{
|
||||||
|
Config: cfg,
|
||||||
|
}
|
||||||
|
cn, err := dialer.DialContext(ctx, network, addr)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
tlsCn := cn.(*tls.Conn) // DialContext comment promises this will always succeed
|
||||||
|
return tlsCn, nil
|
||||||
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build go1.18
|
//go:build go1.18
|
||||||
// +build go1.18
|
|
||||||
|
|
||||||
package idna
|
package idna
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build go1.10
|
//go:build go1.10
|
||||||
// +build go1.10
|
|
||||||
|
|
||||||
// Package idna implements IDNA2008 using the compatibility processing
|
// Package idna implements IDNA2008 using the compatibility processing
|
||||||
// defined by UTS (Unicode Technical Standard) #46, which defines a standard to
|
// defined by UTS (Unicode Technical Standard) #46, which defines a standard to
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build !go1.10
|
//go:build !go1.10
|
||||||
// +build !go1.10
|
|
||||||
|
|
||||||
// Package idna implements IDNA2008 using the compatibility processing
|
// Package idna implements IDNA2008 using the compatibility processing
|
||||||
// defined by UTS (Unicode Technical Standard) #46, which defines a standard to
|
// defined by UTS (Unicode Technical Standard) #46, which defines a standard to
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build !go1.18
|
//go:build !go1.18
|
||||||
// +build !go1.18
|
|
||||||
|
|
||||||
package idna
|
package idna
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
|
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
|
||||||
|
|
||||||
//go:build go1.10 && !go1.13
|
//go:build go1.10 && !go1.13
|
||||||
// +build go1.10,!go1.13
|
|
||||||
|
|
||||||
package idna
|
package idna
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
|
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
|
||||||
|
|
||||||
//go:build go1.13 && !go1.14
|
//go:build go1.13 && !go1.14
|
||||||
// +build go1.13,!go1.14
|
|
||||||
|
|
||||||
package idna
|
package idna
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
|
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
|
||||||
|
|
||||||
//go:build go1.14 && !go1.16
|
//go:build go1.14 && !go1.16
|
||||||
// +build go1.14,!go1.16
|
|
||||||
|
|
||||||
package idna
|
package idna
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
|
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
|
||||||
|
|
||||||
//go:build go1.16 && !go1.21
|
//go:build go1.16 && !go1.21
|
||||||
// +build go1.16,!go1.21
|
|
||||||
|
|
||||||
package idna
|
package idna
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
|
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
|
||||||
|
|
||||||
//go:build go1.21
|
//go:build go1.21
|
||||||
// +build go1.21
|
|
||||||
|
|
||||||
package idna
|
package idna
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
|
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
|
||||||
|
|
||||||
//go:build !go1.10
|
//go:build !go1.10
|
||||||
// +build !go1.10
|
|
||||||
|
|
||||||
package idna
|
package idna
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build !go1.16
|
//go:build !go1.16
|
||||||
// +build !go1.16
|
|
||||||
|
|
||||||
package idna
|
package idna
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build go1.16
|
//go:build go1.16
|
||||||
// +build go1.16
|
|
||||||
|
|
||||||
package idna
|
package idna
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build dragonfly || freebsd || linux || netbsd || openbsd
|
//go:build dragonfly || freebsd || linux || netbsd
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
|
|
@ -231,3 +231,8 @@ func IoctlLoopGetStatus64(fd int) (*LoopInfo64, error) {
|
||||||
func IoctlLoopSetStatus64(fd int, value *LoopInfo64) error {
|
func IoctlLoopSetStatus64(fd int, value *LoopInfo64) error {
|
||||||
return ioctlPtr(fd, LOOP_SET_STATUS64, unsafe.Pointer(value))
|
return ioctlPtr(fd, LOOP_SET_STATUS64, unsafe.Pointer(value))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IoctlLoopConfigure configures all loop device parameters in a single step
|
||||||
|
func IoctlLoopConfigure(fd int, value *LoopConfig) error {
|
||||||
|
return ioctlPtr(fd, LOOP_CONFIGURE, unsafe.Pointer(value))
|
||||||
|
}
|
||||||
|
|
|
@ -519,6 +519,7 @@ ccflags="$@"
|
||||||
$2 ~ /^LOCK_(SH|EX|NB|UN)$/ ||
|
$2 ~ /^LOCK_(SH|EX|NB|UN)$/ ||
|
||||||
$2 ~ /^LO_(KEY|NAME)_SIZE$/ ||
|
$2 ~ /^LO_(KEY|NAME)_SIZE$/ ||
|
||||||
$2 ~ /^LOOP_(CLR|CTL|GET|SET)_/ ||
|
$2 ~ /^LOOP_(CLR|CTL|GET|SET)_/ ||
|
||||||
|
$2 == "LOOP_CONFIGURE" ||
|
||||||
$2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|TCP|MCAST|EVFILT|NOTE|SHUT|PROT|MAP|MREMAP|MFD|T?PACKET|MSG|SCM|MCL|DT|MADV|PR|LOCAL|TCPOPT|UDP)_/ ||
|
$2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|TCP|MCAST|EVFILT|NOTE|SHUT|PROT|MAP|MREMAP|MFD|T?PACKET|MSG|SCM|MCL|DT|MADV|PR|LOCAL|TCPOPT|UDP)_/ ||
|
||||||
$2 ~ /^NFC_(GENL|PROTO|COMM|RF|SE|DIRECTION|LLCP|SOCKPROTO)_/ ||
|
$2 ~ /^NFC_(GENL|PROTO|COMM|RF|SE|DIRECTION|LLCP|SOCKPROTO)_/ ||
|
||||||
$2 ~ /^NFC_.*_(MAX)?SIZE$/ ||
|
$2 ~ /^NFC_.*_(MAX)?SIZE$/ ||
|
||||||
|
@ -560,7 +561,7 @@ ccflags="$@"
|
||||||
$2 ~ /^RLIMIT_(AS|CORE|CPU|DATA|FSIZE|LOCKS|MEMLOCK|MSGQUEUE|NICE|NOFILE|NPROC|RSS|RTPRIO|RTTIME|SIGPENDING|STACK)|RLIM_INFINITY/ ||
|
$2 ~ /^RLIMIT_(AS|CORE|CPU|DATA|FSIZE|LOCKS|MEMLOCK|MSGQUEUE|NICE|NOFILE|NPROC|RSS|RTPRIO|RTTIME|SIGPENDING|STACK)|RLIM_INFINITY/ ||
|
||||||
$2 ~ /^PRIO_(PROCESS|PGRP|USER)/ ||
|
$2 ~ /^PRIO_(PROCESS|PGRP|USER)/ ||
|
||||||
$2 ~ /^CLONE_[A-Z_]+/ ||
|
$2 ~ /^CLONE_[A-Z_]+/ ||
|
||||||
$2 !~ /^(BPF_TIMEVAL|BPF_FIB_LOOKUP_[A-Z]+)$/ &&
|
$2 !~ /^(BPF_TIMEVAL|BPF_FIB_LOOKUP_[A-Z]+|BPF_F_LINK)$/ &&
|
||||||
$2 ~ /^(BPF|DLT)_/ ||
|
$2 ~ /^(BPF|DLT)_/ ||
|
||||||
$2 ~ /^AUDIT_/ ||
|
$2 ~ /^AUDIT_/ ||
|
||||||
$2 ~ /^(CLOCK|TIMER)_/ ||
|
$2 ~ /^(CLOCK|TIMER)_/ ||
|
||||||
|
|
|
@ -316,7 +316,7 @@ func GetsockoptString(fd, level, opt int) (string, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
return string(buf[:vallen-1]), nil
|
return ByteSliceToString(buf[:vallen]), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error)
|
//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error)
|
||||||
|
|
|
@ -61,15 +61,23 @@ func FanotifyMark(fd int, flags uint, mask uint64, dirFd int, pathname string) (
|
||||||
}
|
}
|
||||||
|
|
||||||
//sys fchmodat(dirfd int, path string, mode uint32) (err error)
|
//sys fchmodat(dirfd int, path string, mode uint32) (err error)
|
||||||
|
//sys fchmodat2(dirfd int, path string, mode uint32, flags int) (err error)
|
||||||
|
|
||||||
func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) {
|
func Fchmodat(dirfd int, path string, mode uint32, flags int) error {
|
||||||
// Linux fchmodat doesn't support the flags parameter. Mimick glibc's behavior
|
// Linux fchmodat doesn't support the flags parameter, but fchmodat2 does.
|
||||||
// and check the flags. Otherwise the mode would be applied to the symlink
|
// Try fchmodat2 if flags are specified.
|
||||||
// destination which is not what the user expects.
|
if flags != 0 {
|
||||||
if flags&^AT_SYMLINK_NOFOLLOW != 0 {
|
err := fchmodat2(dirfd, path, mode, flags)
|
||||||
return EINVAL
|
if err == ENOSYS {
|
||||||
} else if flags&AT_SYMLINK_NOFOLLOW != 0 {
|
// fchmodat2 isn't available. If the flags are known to be valid,
|
||||||
return EOPNOTSUPP
|
// return EOPNOTSUPP to indicate that fchmodat doesn't support them.
|
||||||
|
if flags&^(AT_SYMLINK_NOFOLLOW|AT_EMPTY_PATH) != 0 {
|
||||||
|
return EINVAL
|
||||||
|
} else if flags&(AT_SYMLINK_NOFOLLOW|AT_EMPTY_PATH) != 0 {
|
||||||
|
return EOPNOTSUPP
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
return fchmodat(dirfd, path, mode)
|
return fchmodat(dirfd, path, mode)
|
||||||
}
|
}
|
||||||
|
@ -1302,7 +1310,7 @@ func GetsockoptString(fd, level, opt int) (string, error) {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return string(buf[:vallen-1]), nil
|
return ByteSliceToString(buf[:vallen]), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetsockoptTpacketStats(fd, level, opt int) (*TpacketStats, error) {
|
func GetsockoptTpacketStats(fd, level, opt int) (*TpacketStats, error) {
|
||||||
|
|
|
@ -166,6 +166,20 @@ func Getresgid() (rgid, egid, sgid int) {
|
||||||
|
|
||||||
//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL
|
//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL
|
||||||
|
|
||||||
|
//sys fcntl(fd int, cmd int, arg int) (n int, err error)
|
||||||
|
//sys fcntlPtr(fd int, cmd int, arg unsafe.Pointer) (n int, err error) = SYS_FCNTL
|
||||||
|
|
||||||
|
// FcntlInt performs a fcntl syscall on fd with the provided command and argument.
|
||||||
|
func FcntlInt(fd uintptr, cmd, arg int) (int, error) {
|
||||||
|
return fcntl(int(fd), cmd, arg)
|
||||||
|
}
|
||||||
|
|
||||||
|
// FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command.
|
||||||
|
func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error {
|
||||||
|
_, err := fcntlPtr(int(fd), cmd, unsafe.Pointer(lk))
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
//sys ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error)
|
//sys ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error)
|
||||||
|
|
||||||
func Ppoll(fds []PollFd, timeout *Timespec, sigmask *Sigset_t) (n int, err error) {
|
func Ppoll(fds []PollFd, timeout *Timespec, sigmask *Sigset_t) (n int, err error) {
|
||||||
|
|
|
@ -158,7 +158,7 @@ func GetsockoptString(fd, level, opt int) (string, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
return string(buf[:vallen-1]), nil
|
return ByteSliceToString(buf[:vallen]), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
const ImplementsGetwd = true
|
const ImplementsGetwd = true
|
||||||
|
|
|
@ -1104,7 +1104,7 @@ func GetsockoptString(fd, level, opt int) (string, error) {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
return string(buf[:vallen-1]), nil
|
return ByteSliceToString(buf[:vallen]), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from Sockaddr, err error) {
|
func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from Sockaddr, err error) {
|
||||||
|
|
|
@ -486,7 +486,6 @@ const (
|
||||||
BPF_F_ANY_ALIGNMENT = 0x2
|
BPF_F_ANY_ALIGNMENT = 0x2
|
||||||
BPF_F_BEFORE = 0x8
|
BPF_F_BEFORE = 0x8
|
||||||
BPF_F_ID = 0x20
|
BPF_F_ID = 0x20
|
||||||
BPF_F_LINK = 0x2000
|
|
||||||
BPF_F_NETFILTER_IP_DEFRAG = 0x1
|
BPF_F_NETFILTER_IP_DEFRAG = 0x1
|
||||||
BPF_F_QUERY_EFFECTIVE = 0x1
|
BPF_F_QUERY_EFFECTIVE = 0x1
|
||||||
BPF_F_REPLACE = 0x4
|
BPF_F_REPLACE = 0x4
|
||||||
|
@ -1802,6 +1801,7 @@ const (
|
||||||
LOCK_SH = 0x1
|
LOCK_SH = 0x1
|
||||||
LOCK_UN = 0x8
|
LOCK_UN = 0x8
|
||||||
LOOP_CLR_FD = 0x4c01
|
LOOP_CLR_FD = 0x4c01
|
||||||
|
LOOP_CONFIGURE = 0x4c0a
|
||||||
LOOP_CTL_ADD = 0x4c80
|
LOOP_CTL_ADD = 0x4c80
|
||||||
LOOP_CTL_GET_FREE = 0x4c82
|
LOOP_CTL_GET_FREE = 0x4c82
|
||||||
LOOP_CTL_REMOVE = 0x4c81
|
LOOP_CTL_REMOVE = 0x4c81
|
||||||
|
|
|
@ -37,6 +37,21 @@ func fchmodat(dirfd int, path string, mode uint32) (err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func fchmodat2(dirfd int, path string, mode uint32, flags int) (err error) {
|
||||||
|
var _p0 *byte
|
||||||
|
_p0, err = BytePtrFromString(path)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
_, _, e1 := Syscall6(SYS_FCHMODAT2, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func ioctl(fd int, req uint, arg uintptr) (err error) {
|
func ioctl(fd int, req uint, arg uintptr) (err error) {
|
||||||
_, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg))
|
_, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg))
|
||||||
if e1 != 0 {
|
if e1 != 0 {
|
||||||
|
|
|
@ -584,6 +584,32 @@ var libc_sysctl_trampoline_addr uintptr
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func fcntl(fd int, cmd int, arg int) (n int, err error) {
|
||||||
|
r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg))
|
||||||
|
n = int(r0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var libc_fcntl_trampoline_addr uintptr
|
||||||
|
|
||||||
|
//go:cgo_import_dynamic libc_fcntl fcntl "libc.so"
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func fcntlPtr(fd int, cmd int, arg unsafe.Pointer) (n int, err error) {
|
||||||
|
r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg))
|
||||||
|
n = int(r0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) {
|
func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) {
|
||||||
r0, _, e1 := syscall_syscall6(libc_ppoll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0)
|
r0, _, e1 := syscall_syscall6(libc_ppoll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0)
|
||||||
n = int(r0)
|
n = int(r0)
|
||||||
|
|
|
@ -178,6 +178,11 @@ TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0
|
||||||
GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $4
|
GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $4
|
||||||
DATA ·libc_sysctl_trampoline_addr(SB)/4, $libc_sysctl_trampoline<>(SB)
|
DATA ·libc_sysctl_trampoline_addr(SB)/4, $libc_sysctl_trampoline<>(SB)
|
||||||
|
|
||||||
|
TEXT libc_fcntl_trampoline<>(SB),NOSPLIT,$0-0
|
||||||
|
JMP libc_fcntl(SB)
|
||||||
|
GLOBL ·libc_fcntl_trampoline_addr(SB), RODATA, $4
|
||||||
|
DATA ·libc_fcntl_trampoline_addr(SB)/4, $libc_fcntl_trampoline<>(SB)
|
||||||
|
|
||||||
TEXT libc_ppoll_trampoline<>(SB),NOSPLIT,$0-0
|
TEXT libc_ppoll_trampoline<>(SB),NOSPLIT,$0-0
|
||||||
JMP libc_ppoll(SB)
|
JMP libc_ppoll(SB)
|
||||||
GLOBL ·libc_ppoll_trampoline_addr(SB), RODATA, $4
|
GLOBL ·libc_ppoll_trampoline_addr(SB), RODATA, $4
|
||||||
|
|
|
@ -584,6 +584,32 @@ var libc_sysctl_trampoline_addr uintptr
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func fcntl(fd int, cmd int, arg int) (n int, err error) {
|
||||||
|
r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg))
|
||||||
|
n = int(r0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var libc_fcntl_trampoline_addr uintptr
|
||||||
|
|
||||||
|
//go:cgo_import_dynamic libc_fcntl fcntl "libc.so"
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func fcntlPtr(fd int, cmd int, arg unsafe.Pointer) (n int, err error) {
|
||||||
|
r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg))
|
||||||
|
n = int(r0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) {
|
func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) {
|
||||||
r0, _, e1 := syscall_syscall6(libc_ppoll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0)
|
r0, _, e1 := syscall_syscall6(libc_ppoll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0)
|
||||||
n = int(r0)
|
n = int(r0)
|
||||||
|
|
|
@ -178,6 +178,11 @@ TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0
|
||||||
GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8
|
GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8
|
||||||
DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB)
|
DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB)
|
||||||
|
|
||||||
|
TEXT libc_fcntl_trampoline<>(SB),NOSPLIT,$0-0
|
||||||
|
JMP libc_fcntl(SB)
|
||||||
|
GLOBL ·libc_fcntl_trampoline_addr(SB), RODATA, $8
|
||||||
|
DATA ·libc_fcntl_trampoline_addr(SB)/8, $libc_fcntl_trampoline<>(SB)
|
||||||
|
|
||||||
TEXT libc_ppoll_trampoline<>(SB),NOSPLIT,$0-0
|
TEXT libc_ppoll_trampoline<>(SB),NOSPLIT,$0-0
|
||||||
JMP libc_ppoll(SB)
|
JMP libc_ppoll(SB)
|
||||||
GLOBL ·libc_ppoll_trampoline_addr(SB), RODATA, $8
|
GLOBL ·libc_ppoll_trampoline_addr(SB), RODATA, $8
|
||||||
|
|
|
@ -584,6 +584,32 @@ var libc_sysctl_trampoline_addr uintptr
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func fcntl(fd int, cmd int, arg int) (n int, err error) {
|
||||||
|
r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg))
|
||||||
|
n = int(r0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var libc_fcntl_trampoline_addr uintptr
|
||||||
|
|
||||||
|
//go:cgo_import_dynamic libc_fcntl fcntl "libc.so"
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func fcntlPtr(fd int, cmd int, arg unsafe.Pointer) (n int, err error) {
|
||||||
|
r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg))
|
||||||
|
n = int(r0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) {
|
func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) {
|
||||||
r0, _, e1 := syscall_syscall6(libc_ppoll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0)
|
r0, _, e1 := syscall_syscall6(libc_ppoll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0)
|
||||||
n = int(r0)
|
n = int(r0)
|
||||||
|
|
|
@ -178,6 +178,11 @@ TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0
|
||||||
GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $4
|
GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $4
|
||||||
DATA ·libc_sysctl_trampoline_addr(SB)/4, $libc_sysctl_trampoline<>(SB)
|
DATA ·libc_sysctl_trampoline_addr(SB)/4, $libc_sysctl_trampoline<>(SB)
|
||||||
|
|
||||||
|
TEXT libc_fcntl_trampoline<>(SB),NOSPLIT,$0-0
|
||||||
|
JMP libc_fcntl(SB)
|
||||||
|
GLOBL ·libc_fcntl_trampoline_addr(SB), RODATA, $4
|
||||||
|
DATA ·libc_fcntl_trampoline_addr(SB)/4, $libc_fcntl_trampoline<>(SB)
|
||||||
|
|
||||||
TEXT libc_ppoll_trampoline<>(SB),NOSPLIT,$0-0
|
TEXT libc_ppoll_trampoline<>(SB),NOSPLIT,$0-0
|
||||||
JMP libc_ppoll(SB)
|
JMP libc_ppoll(SB)
|
||||||
GLOBL ·libc_ppoll_trampoline_addr(SB), RODATA, $4
|
GLOBL ·libc_ppoll_trampoline_addr(SB), RODATA, $4
|
||||||
|
|
|
@ -584,6 +584,32 @@ var libc_sysctl_trampoline_addr uintptr
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func fcntl(fd int, cmd int, arg int) (n int, err error) {
|
||||||
|
r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg))
|
||||||
|
n = int(r0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var libc_fcntl_trampoline_addr uintptr
|
||||||
|
|
||||||
|
//go:cgo_import_dynamic libc_fcntl fcntl "libc.so"
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func fcntlPtr(fd int, cmd int, arg unsafe.Pointer) (n int, err error) {
|
||||||
|
r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg))
|
||||||
|
n = int(r0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) {
|
func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) {
|
||||||
r0, _, e1 := syscall_syscall6(libc_ppoll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0)
|
r0, _, e1 := syscall_syscall6(libc_ppoll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0)
|
||||||
n = int(r0)
|
n = int(r0)
|
||||||
|
|
|
@ -178,6 +178,11 @@ TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0
|
||||||
GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8
|
GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8
|
||||||
DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB)
|
DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB)
|
||||||
|
|
||||||
|
TEXT libc_fcntl_trampoline<>(SB),NOSPLIT,$0-0
|
||||||
|
JMP libc_fcntl(SB)
|
||||||
|
GLOBL ·libc_fcntl_trampoline_addr(SB), RODATA, $8
|
||||||
|
DATA ·libc_fcntl_trampoline_addr(SB)/8, $libc_fcntl_trampoline<>(SB)
|
||||||
|
|
||||||
TEXT libc_ppoll_trampoline<>(SB),NOSPLIT,$0-0
|
TEXT libc_ppoll_trampoline<>(SB),NOSPLIT,$0-0
|
||||||
JMP libc_ppoll(SB)
|
JMP libc_ppoll(SB)
|
||||||
GLOBL ·libc_ppoll_trampoline_addr(SB), RODATA, $8
|
GLOBL ·libc_ppoll_trampoline_addr(SB), RODATA, $8
|
||||||
|
|
|
@ -584,6 +584,32 @@ var libc_sysctl_trampoline_addr uintptr
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func fcntl(fd int, cmd int, arg int) (n int, err error) {
|
||||||
|
r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg))
|
||||||
|
n = int(r0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var libc_fcntl_trampoline_addr uintptr
|
||||||
|
|
||||||
|
//go:cgo_import_dynamic libc_fcntl fcntl "libc.so"
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func fcntlPtr(fd int, cmd int, arg unsafe.Pointer) (n int, err error) {
|
||||||
|
r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg))
|
||||||
|
n = int(r0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) {
|
func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) {
|
||||||
r0, _, e1 := syscall_syscall6(libc_ppoll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0)
|
r0, _, e1 := syscall_syscall6(libc_ppoll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0)
|
||||||
n = int(r0)
|
n = int(r0)
|
||||||
|
|
|
@ -178,6 +178,11 @@ TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0
|
||||||
GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8
|
GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8
|
||||||
DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB)
|
DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB)
|
||||||
|
|
||||||
|
TEXT libc_fcntl_trampoline<>(SB),NOSPLIT,$0-0
|
||||||
|
JMP libc_fcntl(SB)
|
||||||
|
GLOBL ·libc_fcntl_trampoline_addr(SB), RODATA, $8
|
||||||
|
DATA ·libc_fcntl_trampoline_addr(SB)/8, $libc_fcntl_trampoline<>(SB)
|
||||||
|
|
||||||
TEXT libc_ppoll_trampoline<>(SB),NOSPLIT,$0-0
|
TEXT libc_ppoll_trampoline<>(SB),NOSPLIT,$0-0
|
||||||
JMP libc_ppoll(SB)
|
JMP libc_ppoll(SB)
|
||||||
GLOBL ·libc_ppoll_trampoline_addr(SB), RODATA, $8
|
GLOBL ·libc_ppoll_trampoline_addr(SB), RODATA, $8
|
||||||
|
|
|
@ -584,6 +584,32 @@ var libc_sysctl_trampoline_addr uintptr
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func fcntl(fd int, cmd int, arg int) (n int, err error) {
|
||||||
|
r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg))
|
||||||
|
n = int(r0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var libc_fcntl_trampoline_addr uintptr
|
||||||
|
|
||||||
|
//go:cgo_import_dynamic libc_fcntl fcntl "libc.so"
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func fcntlPtr(fd int, cmd int, arg unsafe.Pointer) (n int, err error) {
|
||||||
|
r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg))
|
||||||
|
n = int(r0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) {
|
func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) {
|
||||||
r0, _, e1 := syscall_syscall6(libc_ppoll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0)
|
r0, _, e1 := syscall_syscall6(libc_ppoll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0)
|
||||||
n = int(r0)
|
n = int(r0)
|
||||||
|
|
|
@ -213,6 +213,12 @@ TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0
|
||||||
GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8
|
GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8
|
||||||
DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB)
|
DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB)
|
||||||
|
|
||||||
|
TEXT libc_fcntl_trampoline<>(SB),NOSPLIT,$0-0
|
||||||
|
CALL libc_fcntl(SB)
|
||||||
|
RET
|
||||||
|
GLOBL ·libc_fcntl_trampoline_addr(SB), RODATA, $8
|
||||||
|
DATA ·libc_fcntl_trampoline_addr(SB)/8, $libc_fcntl_trampoline<>(SB)
|
||||||
|
|
||||||
TEXT libc_ppoll_trampoline<>(SB),NOSPLIT,$0-0
|
TEXT libc_ppoll_trampoline<>(SB),NOSPLIT,$0-0
|
||||||
CALL libc_ppoll(SB)
|
CALL libc_ppoll(SB)
|
||||||
RET
|
RET
|
||||||
|
|
|
@ -584,6 +584,32 @@ var libc_sysctl_trampoline_addr uintptr
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func fcntl(fd int, cmd int, arg int) (n int, err error) {
|
||||||
|
r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg))
|
||||||
|
n = int(r0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var libc_fcntl_trampoline_addr uintptr
|
||||||
|
|
||||||
|
//go:cgo_import_dynamic libc_fcntl fcntl "libc.so"
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func fcntlPtr(fd int, cmd int, arg unsafe.Pointer) (n int, err error) {
|
||||||
|
r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg))
|
||||||
|
n = int(r0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) {
|
func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) {
|
||||||
r0, _, e1 := syscall_syscall6(libc_ppoll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0)
|
r0, _, e1 := syscall_syscall6(libc_ppoll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0)
|
||||||
n = int(r0)
|
n = int(r0)
|
||||||
|
|
|
@ -178,6 +178,11 @@ TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0
|
||||||
GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8
|
GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8
|
||||||
DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB)
|
DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB)
|
||||||
|
|
||||||
|
TEXT libc_fcntl_trampoline<>(SB),NOSPLIT,$0-0
|
||||||
|
JMP libc_fcntl(SB)
|
||||||
|
GLOBL ·libc_fcntl_trampoline_addr(SB), RODATA, $8
|
||||||
|
DATA ·libc_fcntl_trampoline_addr(SB)/8, $libc_fcntl_trampoline<>(SB)
|
||||||
|
|
||||||
TEXT libc_ppoll_trampoline<>(SB),NOSPLIT,$0-0
|
TEXT libc_ppoll_trampoline<>(SB),NOSPLIT,$0-0
|
||||||
JMP libc_ppoll(SB)
|
JMP libc_ppoll(SB)
|
||||||
GLOBL ·libc_ppoll_trampoline_addr(SB), RODATA, $8
|
GLOBL ·libc_ppoll_trampoline_addr(SB), RODATA, $8
|
||||||
|
|
|
@ -2671,6 +2671,7 @@ const (
|
||||||
BPF_PROG_TYPE_LSM = 0x1d
|
BPF_PROG_TYPE_LSM = 0x1d
|
||||||
BPF_PROG_TYPE_SK_LOOKUP = 0x1e
|
BPF_PROG_TYPE_SK_LOOKUP = 0x1e
|
||||||
BPF_PROG_TYPE_SYSCALL = 0x1f
|
BPF_PROG_TYPE_SYSCALL = 0x1f
|
||||||
|
BPF_PROG_TYPE_NETFILTER = 0x20
|
||||||
BPF_CGROUP_INET_INGRESS = 0x0
|
BPF_CGROUP_INET_INGRESS = 0x0
|
||||||
BPF_CGROUP_INET_EGRESS = 0x1
|
BPF_CGROUP_INET_EGRESS = 0x1
|
||||||
BPF_CGROUP_INET_SOCK_CREATE = 0x2
|
BPF_CGROUP_INET_SOCK_CREATE = 0x2
|
||||||
|
@ -2715,6 +2716,11 @@ const (
|
||||||
BPF_PERF_EVENT = 0x29
|
BPF_PERF_EVENT = 0x29
|
||||||
BPF_TRACE_KPROBE_MULTI = 0x2a
|
BPF_TRACE_KPROBE_MULTI = 0x2a
|
||||||
BPF_LSM_CGROUP = 0x2b
|
BPF_LSM_CGROUP = 0x2b
|
||||||
|
BPF_STRUCT_OPS = 0x2c
|
||||||
|
BPF_NETFILTER = 0x2d
|
||||||
|
BPF_TCX_INGRESS = 0x2e
|
||||||
|
BPF_TCX_EGRESS = 0x2f
|
||||||
|
BPF_TRACE_UPROBE_MULTI = 0x30
|
||||||
BPF_LINK_TYPE_UNSPEC = 0x0
|
BPF_LINK_TYPE_UNSPEC = 0x0
|
||||||
BPF_LINK_TYPE_RAW_TRACEPOINT = 0x1
|
BPF_LINK_TYPE_RAW_TRACEPOINT = 0x1
|
||||||
BPF_LINK_TYPE_TRACING = 0x2
|
BPF_LINK_TYPE_TRACING = 0x2
|
||||||
|
@ -2725,6 +2731,18 @@ const (
|
||||||
BPF_LINK_TYPE_PERF_EVENT = 0x7
|
BPF_LINK_TYPE_PERF_EVENT = 0x7
|
||||||
BPF_LINK_TYPE_KPROBE_MULTI = 0x8
|
BPF_LINK_TYPE_KPROBE_MULTI = 0x8
|
||||||
BPF_LINK_TYPE_STRUCT_OPS = 0x9
|
BPF_LINK_TYPE_STRUCT_OPS = 0x9
|
||||||
|
BPF_LINK_TYPE_NETFILTER = 0xa
|
||||||
|
BPF_LINK_TYPE_TCX = 0xb
|
||||||
|
BPF_LINK_TYPE_UPROBE_MULTI = 0xc
|
||||||
|
BPF_PERF_EVENT_UNSPEC = 0x0
|
||||||
|
BPF_PERF_EVENT_UPROBE = 0x1
|
||||||
|
BPF_PERF_EVENT_URETPROBE = 0x2
|
||||||
|
BPF_PERF_EVENT_KPROBE = 0x3
|
||||||
|
BPF_PERF_EVENT_KRETPROBE = 0x4
|
||||||
|
BPF_PERF_EVENT_TRACEPOINT = 0x5
|
||||||
|
BPF_PERF_EVENT_EVENT = 0x6
|
||||||
|
BPF_F_KPROBE_MULTI_RETURN = 0x1
|
||||||
|
BPF_F_UPROBE_MULTI_RETURN = 0x1
|
||||||
BPF_ANY = 0x0
|
BPF_ANY = 0x0
|
||||||
BPF_NOEXIST = 0x1
|
BPF_NOEXIST = 0x1
|
||||||
BPF_EXIST = 0x2
|
BPF_EXIST = 0x2
|
||||||
|
@ -2742,6 +2760,8 @@ const (
|
||||||
BPF_F_MMAPABLE = 0x400
|
BPF_F_MMAPABLE = 0x400
|
||||||
BPF_F_PRESERVE_ELEMS = 0x800
|
BPF_F_PRESERVE_ELEMS = 0x800
|
||||||
BPF_F_INNER_MAP = 0x1000
|
BPF_F_INNER_MAP = 0x1000
|
||||||
|
BPF_F_LINK = 0x2000
|
||||||
|
BPF_F_PATH_FD = 0x4000
|
||||||
BPF_STATS_RUN_TIME = 0x0
|
BPF_STATS_RUN_TIME = 0x0
|
||||||
BPF_STACK_BUILD_ID_EMPTY = 0x0
|
BPF_STACK_BUILD_ID_EMPTY = 0x0
|
||||||
BPF_STACK_BUILD_ID_VALID = 0x1
|
BPF_STACK_BUILD_ID_VALID = 0x1
|
||||||
|
@ -2762,6 +2782,7 @@ const (
|
||||||
BPF_F_ZERO_CSUM_TX = 0x2
|
BPF_F_ZERO_CSUM_TX = 0x2
|
||||||
BPF_F_DONT_FRAGMENT = 0x4
|
BPF_F_DONT_FRAGMENT = 0x4
|
||||||
BPF_F_SEQ_NUMBER = 0x8
|
BPF_F_SEQ_NUMBER = 0x8
|
||||||
|
BPF_F_NO_TUNNEL_KEY = 0x10
|
||||||
BPF_F_TUNINFO_FLAGS = 0x10
|
BPF_F_TUNINFO_FLAGS = 0x10
|
||||||
BPF_F_INDEX_MASK = 0xffffffff
|
BPF_F_INDEX_MASK = 0xffffffff
|
||||||
BPF_F_CURRENT_CPU = 0xffffffff
|
BPF_F_CURRENT_CPU = 0xffffffff
|
||||||
|
@ -2778,6 +2799,8 @@ const (
|
||||||
BPF_F_ADJ_ROOM_ENCAP_L4_UDP = 0x10
|
BPF_F_ADJ_ROOM_ENCAP_L4_UDP = 0x10
|
||||||
BPF_F_ADJ_ROOM_NO_CSUM_RESET = 0x20
|
BPF_F_ADJ_ROOM_NO_CSUM_RESET = 0x20
|
||||||
BPF_F_ADJ_ROOM_ENCAP_L2_ETH = 0x40
|
BPF_F_ADJ_ROOM_ENCAP_L2_ETH = 0x40
|
||||||
|
BPF_F_ADJ_ROOM_DECAP_L3_IPV4 = 0x80
|
||||||
|
BPF_F_ADJ_ROOM_DECAP_L3_IPV6 = 0x100
|
||||||
BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff
|
BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff
|
||||||
BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 0x38
|
BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 0x38
|
||||||
BPF_F_SYSCTL_BASE_NAME = 0x1
|
BPF_F_SYSCTL_BASE_NAME = 0x1
|
||||||
|
@ -2866,6 +2889,8 @@ const (
|
||||||
BPF_DEVCG_DEV_CHAR = 0x2
|
BPF_DEVCG_DEV_CHAR = 0x2
|
||||||
BPF_FIB_LOOKUP_DIRECT = 0x1
|
BPF_FIB_LOOKUP_DIRECT = 0x1
|
||||||
BPF_FIB_LOOKUP_OUTPUT = 0x2
|
BPF_FIB_LOOKUP_OUTPUT = 0x2
|
||||||
|
BPF_FIB_LOOKUP_SKIP_NEIGH = 0x4
|
||||||
|
BPF_FIB_LOOKUP_TBID = 0x8
|
||||||
BPF_FIB_LKUP_RET_SUCCESS = 0x0
|
BPF_FIB_LKUP_RET_SUCCESS = 0x0
|
||||||
BPF_FIB_LKUP_RET_BLACKHOLE = 0x1
|
BPF_FIB_LKUP_RET_BLACKHOLE = 0x1
|
||||||
BPF_FIB_LKUP_RET_UNREACHABLE = 0x2
|
BPF_FIB_LKUP_RET_UNREACHABLE = 0x2
|
||||||
|
@ -2901,6 +2926,7 @@ const (
|
||||||
BPF_CORE_ENUMVAL_EXISTS = 0xa
|
BPF_CORE_ENUMVAL_EXISTS = 0xa
|
||||||
BPF_CORE_ENUMVAL_VALUE = 0xb
|
BPF_CORE_ENUMVAL_VALUE = 0xb
|
||||||
BPF_CORE_TYPE_MATCHES = 0xc
|
BPF_CORE_TYPE_MATCHES = 0xc
|
||||||
|
BPF_F_TIMER_ABS = 0x1
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -2979,6 +3005,12 @@ type LoopInfo64 struct {
|
||||||
Encrypt_key [32]uint8
|
Encrypt_key [32]uint8
|
||||||
Init [2]uint64
|
Init [2]uint64
|
||||||
}
|
}
|
||||||
|
type LoopConfig struct {
|
||||||
|
Fd uint32
|
||||||
|
Size uint32
|
||||||
|
Info LoopInfo64
|
||||||
|
_ [8]uint64
|
||||||
|
}
|
||||||
|
|
||||||
type TIPCSocketAddr struct {
|
type TIPCSocketAddr struct {
|
||||||
Ref uint32
|
Ref uint32
|
||||||
|
|
|
@ -155,6 +155,8 @@ func NewCallbackCDecl(fn interface{}) uintptr {
|
||||||
//sys GetModuleFileName(module Handle, filename *uint16, size uint32) (n uint32, err error) = kernel32.GetModuleFileNameW
|
//sys GetModuleFileName(module Handle, filename *uint16, size uint32) (n uint32, err error) = kernel32.GetModuleFileNameW
|
||||||
//sys GetModuleHandleEx(flags uint32, moduleName *uint16, module *Handle) (err error) = kernel32.GetModuleHandleExW
|
//sys GetModuleHandleEx(flags uint32, moduleName *uint16, module *Handle) (err error) = kernel32.GetModuleHandleExW
|
||||||
//sys SetDefaultDllDirectories(directoryFlags uint32) (err error)
|
//sys SetDefaultDllDirectories(directoryFlags uint32) (err error)
|
||||||
|
//sys AddDllDirectory(path *uint16) (cookie uintptr, err error) = kernel32.AddDllDirectory
|
||||||
|
//sys RemoveDllDirectory(cookie uintptr) (err error) = kernel32.RemoveDllDirectory
|
||||||
//sys SetDllDirectory(path string) (err error) = kernel32.SetDllDirectoryW
|
//sys SetDllDirectory(path string) (err error) = kernel32.SetDllDirectoryW
|
||||||
//sys GetVersion() (ver uint32, err error)
|
//sys GetVersion() (ver uint32, err error)
|
||||||
//sys FormatMessage(flags uint32, msgsrc uintptr, msgid uint32, langid uint32, buf []uint16, args *byte) (n uint32, err error) = FormatMessageW
|
//sys FormatMessage(flags uint32, msgsrc uintptr, msgid uint32, langid uint32, buf []uint16, args *byte) (n uint32, err error) = FormatMessageW
|
||||||
|
|
|
@ -184,6 +184,7 @@ var (
|
||||||
procGetAdaptersInfo = modiphlpapi.NewProc("GetAdaptersInfo")
|
procGetAdaptersInfo = modiphlpapi.NewProc("GetAdaptersInfo")
|
||||||
procGetBestInterfaceEx = modiphlpapi.NewProc("GetBestInterfaceEx")
|
procGetBestInterfaceEx = modiphlpapi.NewProc("GetBestInterfaceEx")
|
||||||
procGetIfEntry = modiphlpapi.NewProc("GetIfEntry")
|
procGetIfEntry = modiphlpapi.NewProc("GetIfEntry")
|
||||||
|
procAddDllDirectory = modkernel32.NewProc("AddDllDirectory")
|
||||||
procAssignProcessToJobObject = modkernel32.NewProc("AssignProcessToJobObject")
|
procAssignProcessToJobObject = modkernel32.NewProc("AssignProcessToJobObject")
|
||||||
procCancelIo = modkernel32.NewProc("CancelIo")
|
procCancelIo = modkernel32.NewProc("CancelIo")
|
||||||
procCancelIoEx = modkernel32.NewProc("CancelIoEx")
|
procCancelIoEx = modkernel32.NewProc("CancelIoEx")
|
||||||
|
@ -330,6 +331,7 @@ var (
|
||||||
procReadProcessMemory = modkernel32.NewProc("ReadProcessMemory")
|
procReadProcessMemory = modkernel32.NewProc("ReadProcessMemory")
|
||||||
procReleaseMutex = modkernel32.NewProc("ReleaseMutex")
|
procReleaseMutex = modkernel32.NewProc("ReleaseMutex")
|
||||||
procRemoveDirectoryW = modkernel32.NewProc("RemoveDirectoryW")
|
procRemoveDirectoryW = modkernel32.NewProc("RemoveDirectoryW")
|
||||||
|
procRemoveDllDirectory = modkernel32.NewProc("RemoveDllDirectory")
|
||||||
procResetEvent = modkernel32.NewProc("ResetEvent")
|
procResetEvent = modkernel32.NewProc("ResetEvent")
|
||||||
procResizePseudoConsole = modkernel32.NewProc("ResizePseudoConsole")
|
procResizePseudoConsole = modkernel32.NewProc("ResizePseudoConsole")
|
||||||
procResumeThread = modkernel32.NewProc("ResumeThread")
|
procResumeThread = modkernel32.NewProc("ResumeThread")
|
||||||
|
@ -1605,6 +1607,15 @@ func GetIfEntry(pIfRow *MibIfRow) (errcode error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func AddDllDirectory(path *uint16) (cookie uintptr, err error) {
|
||||||
|
r0, _, e1 := syscall.Syscall(procAddDllDirectory.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0)
|
||||||
|
cookie = uintptr(r0)
|
||||||
|
if cookie == 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func AssignProcessToJobObject(job Handle, process Handle) (err error) {
|
func AssignProcessToJobObject(job Handle, process Handle) (err error) {
|
||||||
r1, _, e1 := syscall.Syscall(procAssignProcessToJobObject.Addr(), 2, uintptr(job), uintptr(process), 0)
|
r1, _, e1 := syscall.Syscall(procAssignProcessToJobObject.Addr(), 2, uintptr(job), uintptr(process), 0)
|
||||||
if r1 == 0 {
|
if r1 == 0 {
|
||||||
|
@ -2879,6 +2890,14 @@ func RemoveDirectory(path *uint16) (err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func RemoveDllDirectory(cookie uintptr) (err error) {
|
||||||
|
r1, _, e1 := syscall.Syscall(procRemoveDllDirectory.Addr(), 1, uintptr(cookie), 0, 0)
|
||||||
|
if r1 == 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func ResetEvent(event Handle) (err error) {
|
func ResetEvent(event Handle) (err error) {
|
||||||
r1, _, e1 := syscall.Syscall(procResetEvent.Addr(), 1, uintptr(event), 0, 0)
|
r1, _, e1 := syscall.Syscall(procResetEvent.Addr(), 1, uintptr(event), 0, 0)
|
||||||
if r1 == 0 {
|
if r1 == 0 {
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build go1.10
|
//go:build go1.10
|
||||||
// +build go1.10
|
|
||||||
|
|
||||||
package bidirule
|
package bidirule
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build !go1.10
|
//go:build !go1.10
|
||||||
// +build !go1.10
|
|
||||||
|
|
||||||
package bidirule
|
package bidirule
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
|
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
|
||||||
|
|
||||||
//go:build go1.10 && !go1.13
|
//go:build go1.10 && !go1.13
|
||||||
// +build go1.10,!go1.13
|
|
||||||
|
|
||||||
package bidi
|
package bidi
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
|
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
|
||||||
|
|
||||||
//go:build go1.13 && !go1.14
|
//go:build go1.13 && !go1.14
|
||||||
// +build go1.13,!go1.14
|
|
||||||
|
|
||||||
package bidi
|
package bidi
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
|
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
|
||||||
|
|
||||||
//go:build go1.14 && !go1.16
|
//go:build go1.14 && !go1.16
|
||||||
// +build go1.14,!go1.16
|
|
||||||
|
|
||||||
package bidi
|
package bidi
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
|
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
|
||||||
|
|
||||||
//go:build go1.16 && !go1.21
|
//go:build go1.16 && !go1.21
|
||||||
// +build go1.16,!go1.21
|
|
||||||
|
|
||||||
package bidi
|
package bidi
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
|
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
|
||||||
|
|
||||||
//go:build go1.21
|
//go:build go1.21
|
||||||
// +build go1.21
|
|
||||||
|
|
||||||
package bidi
|
package bidi
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
|
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
|
||||||
|
|
||||||
//go:build !go1.10
|
//go:build !go1.10
|
||||||
// +build !go1.10
|
|
||||||
|
|
||||||
package bidi
|
package bidi
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
|
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
|
||||||
|
|
||||||
//go:build go1.10 && !go1.13
|
//go:build go1.10 && !go1.13
|
||||||
// +build go1.10,!go1.13
|
|
||||||
|
|
||||||
package norm
|
package norm
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
|
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
|
||||||
|
|
||||||
//go:build go1.13 && !go1.14
|
//go:build go1.13 && !go1.14
|
||||||
// +build go1.13,!go1.14
|
|
||||||
|
|
||||||
package norm
|
package norm
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
|
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
|
||||||
|
|
||||||
//go:build go1.14 && !go1.16
|
//go:build go1.14 && !go1.16
|
||||||
// +build go1.14,!go1.16
|
|
||||||
|
|
||||||
package norm
|
package norm
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
|
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
|
||||||
|
|
||||||
//go:build go1.16 && !go1.21
|
//go:build go1.16 && !go1.21
|
||||||
// +build go1.16,!go1.21
|
|
||||||
|
|
||||||
package norm
|
package norm
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
|
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
|
||||||
|
|
||||||
//go:build go1.21
|
//go:build go1.21
|
||||||
// +build go1.21
|
|
||||||
|
|
||||||
package norm
|
package norm
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
|
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
|
||||||
|
|
||||||
//go:build !go1.10
|
//go:build !go1.10
|
||||||
// +build !go1.10
|
|
||||||
|
|
||||||
package norm
|
package norm
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,8 @@ func Every(interval time.Duration) Limit {
|
||||||
// or its associated context.Context is canceled.
|
// or its associated context.Context is canceled.
|
||||||
//
|
//
|
||||||
// The methods AllowN, ReserveN, and WaitN consume n tokens.
|
// The methods AllowN, ReserveN, and WaitN consume n tokens.
|
||||||
|
//
|
||||||
|
// Limiter is safe for simultaneous use by multiple goroutines.
|
||||||
type Limiter struct {
|
type Limiter struct {
|
||||||
mu sync.Mutex
|
mu sync.Mutex
|
||||||
limit Limit
|
limit Limit
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# github.com/a-h/templ v0.2.476
|
# github.com/a-h/templ v0.2.501
|
||||||
## explicit; go 1.20
|
## explicit; go 1.20
|
||||||
github.com/a-h/templ
|
github.com/a-h/templ
|
||||||
github.com/a-h/templ/safehtml
|
github.com/a-h/templ/safehtml
|
||||||
|
@ -8,7 +8,7 @@ github.com/aymanbagabas/go-osc52/v2
|
||||||
# github.com/charmbracelet/lipgloss v0.9.1
|
# github.com/charmbracelet/lipgloss v0.9.1
|
||||||
## explicit; go 1.17
|
## explicit; go 1.17
|
||||||
github.com/charmbracelet/lipgloss
|
github.com/charmbracelet/lipgloss
|
||||||
# github.com/charmbracelet/log v0.3.0
|
# github.com/charmbracelet/log v0.3.1
|
||||||
## explicit; go 1.19
|
## explicit; go 1.19
|
||||||
github.com/charmbracelet/log
|
github.com/charmbracelet/log
|
||||||
# github.com/dustin/go-humanize v1.0.1
|
# github.com/dustin/go-humanize v1.0.1
|
||||||
|
@ -20,12 +20,12 @@ github.com/go-logfmt/logfmt
|
||||||
# github.com/golang-jwt/jwt v3.2.2+incompatible
|
# github.com/golang-jwt/jwt v3.2.2+incompatible
|
||||||
## explicit
|
## explicit
|
||||||
github.com/golang-jwt/jwt
|
github.com/golang-jwt/jwt
|
||||||
# github.com/labstack/echo/v4 v4.11.3
|
# github.com/labstack/echo/v4 v4.11.4
|
||||||
## explicit; go 1.17
|
## explicit; go 1.18
|
||||||
github.com/labstack/echo/v4
|
github.com/labstack/echo/v4
|
||||||
github.com/labstack/echo/v4/middleware
|
github.com/labstack/echo/v4/middleware
|
||||||
# github.com/labstack/gommon v0.4.0
|
# github.com/labstack/gommon v0.4.2
|
||||||
## explicit; go 1.12
|
## explicit; go 1.18
|
||||||
github.com/labstack/gommon/bytes
|
github.com/labstack/gommon/bytes
|
||||||
github.com/labstack/gommon/color
|
github.com/labstack/gommon/color
|
||||||
github.com/labstack/gommon/log
|
github.com/labstack/gommon/log
|
||||||
|
@ -53,12 +53,12 @@ github.com/muesli/termenv
|
||||||
# github.com/rivo/uniseg v0.2.0
|
# github.com/rivo/uniseg v0.2.0
|
||||||
## explicit; go 1.12
|
## explicit; go 1.12
|
||||||
github.com/rivo/uniseg
|
github.com/rivo/uniseg
|
||||||
# github.com/tdewolff/minify/v2 v2.20.7
|
# github.com/tdewolff/minify/v2 v2.20.10
|
||||||
## explicit; go 1.18
|
## explicit; go 1.18
|
||||||
github.com/tdewolff/minify/v2
|
github.com/tdewolff/minify/v2
|
||||||
github.com/tdewolff/minify/v2/css
|
github.com/tdewolff/minify/v2/css
|
||||||
github.com/tdewolff/minify/v2/html
|
github.com/tdewolff/minify/v2/html
|
||||||
# github.com/tdewolff/parse/v2 v2.7.5
|
# github.com/tdewolff/parse/v2 v2.7.7
|
||||||
## explicit; go 1.13
|
## explicit; go 1.13
|
||||||
github.com/tdewolff/parse/v2
|
github.com/tdewolff/parse/v2
|
||||||
github.com/tdewolff/parse/v2/buffer
|
github.com/tdewolff/parse/v2/buffer
|
||||||
|
@ -71,8 +71,8 @@ github.com/valyala/bytebufferpool
|
||||||
# github.com/valyala/fasttemplate v1.2.2
|
# github.com/valyala/fasttemplate v1.2.2
|
||||||
## explicit; go 1.12
|
## explicit; go 1.12
|
||||||
github.com/valyala/fasttemplate
|
github.com/valyala/fasttemplate
|
||||||
# golang.org/x/crypto v0.14.0
|
# golang.org/x/crypto v0.17.0
|
||||||
## explicit; go 1.17
|
## explicit; go 1.18
|
||||||
golang.org/x/crypto/acme
|
golang.org/x/crypto/acme
|
||||||
golang.org/x/crypto/acme/autocert
|
golang.org/x/crypto/acme/autocert
|
||||||
# golang.org/x/exp v0.0.0-20231006140011-7918f672742d
|
# golang.org/x/exp v0.0.0-20231006140011-7918f672742d
|
||||||
|
@ -82,23 +82,23 @@ golang.org/x/exp/slices
|
||||||
golang.org/x/exp/slog
|
golang.org/x/exp/slog
|
||||||
golang.org/x/exp/slog/internal
|
golang.org/x/exp/slog/internal
|
||||||
golang.org/x/exp/slog/internal/buffer
|
golang.org/x/exp/slog/internal/buffer
|
||||||
# golang.org/x/net v0.17.0
|
# golang.org/x/net v0.19.0
|
||||||
## explicit; go 1.17
|
## explicit; go 1.18
|
||||||
golang.org/x/net/http/httpguts
|
golang.org/x/net/http/httpguts
|
||||||
golang.org/x/net/http2
|
golang.org/x/net/http2
|
||||||
golang.org/x/net/http2/h2c
|
golang.org/x/net/http2/h2c
|
||||||
golang.org/x/net/http2/hpack
|
golang.org/x/net/http2/hpack
|
||||||
golang.org/x/net/idna
|
golang.org/x/net/idna
|
||||||
# golang.org/x/sys v0.14.0
|
# golang.org/x/sys v0.15.0
|
||||||
## explicit; go 1.18
|
## explicit; go 1.18
|
||||||
golang.org/x/sys/unix
|
golang.org/x/sys/unix
|
||||||
golang.org/x/sys/windows
|
golang.org/x/sys/windows
|
||||||
# golang.org/x/text v0.13.0
|
# golang.org/x/text v0.14.0
|
||||||
## explicit; go 1.17
|
## explicit; go 1.18
|
||||||
golang.org/x/text/secure/bidirule
|
golang.org/x/text/secure/bidirule
|
||||||
golang.org/x/text/transform
|
golang.org/x/text/transform
|
||||||
golang.org/x/text/unicode/bidi
|
golang.org/x/text/unicode/bidi
|
||||||
golang.org/x/text/unicode/norm
|
golang.org/x/text/unicode/norm
|
||||||
# golang.org/x/time v0.3.0
|
# golang.org/x/time v0.5.0
|
||||||
## explicit
|
## explicit; go 1.18
|
||||||
golang.org/x/time/rate
|
golang.org/x/time/rate
|
||||||
|
|
Loading…
Reference in New Issue