mirror of
https://github.com/kemko/reproxy.git
synced 2026-01-01 15:55:49 +03:00
Bump the go-modules-updates group with 2 updates
Bumps the go-modules-updates group with 2 updates: [github.com/didip/tollbooth/v7](https://github.com/didip/tollbooth) and [golang.org/x/crypto](https://github.com/golang/crypto). Updates `github.com/didip/tollbooth/v7` from 7.0.1 to 7.0.2 - [Commits](https://github.com/didip/tollbooth/compare/v7.0.1...v7.0.2) Updates `golang.org/x/crypto` from 0.23.0 to 0.24.0 - [Commits](https://github.com/golang/crypto/compare/v0.23.0...v0.24.0) --- updated-dependencies: - dependency-name: github.com/didip/tollbooth/v7 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: go-modules-updates - dependency-name: golang.org/x/crypto dependency-type: direct:production update-type: version-update:semver-minor dependency-group: go-modules-updates ... Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
10
go.mod
10
go.mod
@@ -3,7 +3,7 @@ module github.com/umputun/reproxy
|
|||||||
go 1.22
|
go 1.22
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/didip/tollbooth/v7 v7.0.1
|
github.com/didip/tollbooth/v7 v7.0.2
|
||||||
github.com/go-pkgz/lgr v0.11.1
|
github.com/go-pkgz/lgr v0.11.1
|
||||||
github.com/go-pkgz/repeater v1.1.3
|
github.com/go-pkgz/repeater v1.1.3
|
||||||
github.com/go-pkgz/rest v1.19.0
|
github.com/go-pkgz/rest v1.19.0
|
||||||
@@ -11,7 +11,7 @@ require (
|
|||||||
github.com/prometheus/client_golang v1.19.1
|
github.com/prometheus/client_golang v1.19.1
|
||||||
github.com/stretchr/testify v1.9.0
|
github.com/stretchr/testify v1.9.0
|
||||||
github.com/umputun/go-flags v1.5.1
|
github.com/umputun/go-flags v1.5.1
|
||||||
golang.org/x/crypto v0.23.0
|
golang.org/x/crypto v0.24.0
|
||||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1
|
gopkg.in/natefinch/lumberjack.v2 v2.2.1
|
||||||
gopkg.in/yaml.v3 v3.0.1
|
gopkg.in/yaml.v3 v3.0.1
|
||||||
)
|
)
|
||||||
@@ -21,14 +21,14 @@ require (
|
|||||||
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||||
github.com/felixge/httpsnoop v1.0.4 // indirect
|
github.com/felixge/httpsnoop v1.0.4 // indirect
|
||||||
github.com/go-pkgz/expirable-cache v1.0.0 // indirect
|
github.com/go-pkgz/expirable-cache/v3 v3.0.0 // indirect
|
||||||
github.com/kr/text v0.1.0 // indirect
|
github.com/kr/text v0.1.0 // indirect
|
||||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||||
github.com/prometheus/client_model v0.6.1 // indirect
|
github.com/prometheus/client_model v0.6.1 // indirect
|
||||||
github.com/prometheus/common v0.53.0 // indirect
|
github.com/prometheus/common v0.53.0 // indirect
|
||||||
github.com/prometheus/procfs v0.15.0 // indirect
|
github.com/prometheus/procfs v0.15.0 // indirect
|
||||||
golang.org/x/net v0.25.0 // indirect
|
golang.org/x/net v0.25.0 // indirect
|
||||||
golang.org/x/sys v0.20.0 // indirect
|
golang.org/x/sys v0.21.0 // indirect
|
||||||
golang.org/x/text v0.15.0 // indirect
|
golang.org/x/text v0.16.0 // indirect
|
||||||
google.golang.org/protobuf v1.34.1 // indirect
|
google.golang.org/protobuf v1.34.1 // indirect
|
||||||
)
|
)
|
||||||
|
|||||||
25
go.sum
25
go.sum
@@ -5,13 +5,12 @@ github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL
|
|||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
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/didip/tollbooth/v7 v7.0.1 h1:TkT4sBKoQoHQFPf7blQ54iHrZiTDnr8TceU+MulVAog=
|
github.com/didip/tollbooth/v7 v7.0.2 h1:WYEfusYI6g64cN0qbZgekDrYfuYBZjUZd5+RlWi69p4=
|
||||||
github.com/didip/tollbooth/v7 v7.0.1/go.mod h1:VZhDSGl5bDSPj4wPsih3PFa4Uh9Ghv8hgacaTm5PRT4=
|
github.com/didip/tollbooth/v7 v7.0.2/go.mod h1:RtRYfEmFGX70+ike5kSndSvLtQ3+F2EAmTI4Un/VXNc=
|
||||||
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
|
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
|
||||||
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
|
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
|
||||||
github.com/go-pkgz/expirable-cache v0.1.0/go.mod h1:GTrEl0X+q0mPNqN6dtcQXksACnzCBQ5k/k1SwXJsZKs=
|
github.com/go-pkgz/expirable-cache/v3 v3.0.0 h1:u3/gcu3sabLYiTCevoRKv+WzjIn5oo7P8XtiXBeRDLw=
|
||||||
github.com/go-pkgz/expirable-cache v1.0.0 h1:ns5+1hjY8hntGv8bPaQd9Gr7Jyo+Uw5SLyII40aQdtA=
|
github.com/go-pkgz/expirable-cache/v3 v3.0.0/go.mod h1:2OQiDyEGQalYecLWmXprm3maPXeVb5/6/X7yRPYTzec=
|
||||||
github.com/go-pkgz/expirable-cache v1.0.0/go.mod h1:GTrEl0X+q0mPNqN6dtcQXksACnzCBQ5k/k1SwXJsZKs=
|
|
||||||
github.com/go-pkgz/lgr v0.11.1 h1:hXFhZcznehI6imLhEa379oMOKFz7TQUmisAqb3oLOSM=
|
github.com/go-pkgz/lgr v0.11.1 h1:hXFhZcznehI6imLhEa379oMOKFz7TQUmisAqb3oLOSM=
|
||||||
github.com/go-pkgz/lgr v0.11.1/go.mod h1:tgDF4RXQnBfIgJqjgkv0yOeTQ3F1yewWIZkpUhHnAkU=
|
github.com/go-pkgz/lgr v0.11.1/go.mod h1:tgDF4RXQnBfIgJqjgkv0yOeTQ3F1yewWIZkpUhHnAkU=
|
||||||
github.com/go-pkgz/repeater v1.1.3 h1:q6+JQF14ESSy28Dd7F+wRelY4F+41HJ0LEy/szNnMiE=
|
github.com/go-pkgz/repeater v1.1.3 h1:q6+JQF14ESSy28Dd7F+wRelY4F+41HJ0LEy/szNnMiE=
|
||||||
@@ -22,6 +21,8 @@ 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/gorilla/handlers v1.5.2 h1:cLTUSsNkgcwhgRqvCNmdbRWG0A3N4F+M2nWKdScwyEE=
|
github.com/gorilla/handlers v1.5.2 h1:cLTUSsNkgcwhgRqvCNmdbRWG0A3N4F+M2nWKdScwyEE=
|
||||||
github.com/gorilla/handlers v1.5.2/go.mod h1:dX+xVpaxdSw+q0Qek8SSsl3dfMk3jNddUkMzo0GtH0w=
|
github.com/gorilla/handlers v1.5.2/go.mod h1:dX+xVpaxdSw+q0Qek8SSsl3dfMk3jNddUkMzo0GtH0w=
|
||||||
|
github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k=
|
||||||
|
github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM=
|
||||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||||
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||||
@@ -41,19 +42,18 @@ github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjR
|
|||||||
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
|
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
|
||||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
||||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||||
github.com/umputun/go-flags v1.5.1 h1:vRauoXV3Ultt1HrxivSxowbintgZLJE+EcBy5ta3/mY=
|
github.com/umputun/go-flags v1.5.1 h1:vRauoXV3Ultt1HrxivSxowbintgZLJE+EcBy5ta3/mY=
|
||||||
github.com/umputun/go-flags v1.5.1/go.mod h1:nTbvsO/hKqe7Utri/NoyN18GR3+EWf+9RrmsdwdhrEc=
|
github.com/umputun/go-flags v1.5.1/go.mod h1:nTbvsO/hKqe7Utri/NoyN18GR3+EWf+9RrmsdwdhrEc=
|
||||||
golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI=
|
golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI=
|
||||||
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
|
golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM=
|
||||||
golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac=
|
golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac=
|
||||||
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
|
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
|
||||||
golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
|
golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws=
|
||||||
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk=
|
golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
|
||||||
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
|
||||||
google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg=
|
google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg=
|
||||||
google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
|
google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
@@ -61,6 +61,5 @@ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntN
|
|||||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc=
|
gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc=
|
||||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc=
|
gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc=
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/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=
|
||||||
|
|||||||
6
vendor/github.com/didip/tollbooth/v7/.golangci.yml
generated
vendored
6
vendor/github.com/didip/tollbooth/v7/.golangci.yml
generated
vendored
@@ -1,21 +1,17 @@
|
|||||||
linters:
|
linters:
|
||||||
enable:
|
enable:
|
||||||
- megacheck
|
|
||||||
- revive
|
- revive
|
||||||
- govet
|
- govet
|
||||||
- unconvert
|
- unconvert
|
||||||
- megacheck
|
- megacheck
|
||||||
- structcheck
|
|
||||||
- gas
|
- gas
|
||||||
- gocyclo
|
- gocyclo
|
||||||
- dupl
|
- dupl
|
||||||
- misspell
|
- misspell
|
||||||
- unparam
|
- unparam
|
||||||
- varcheck
|
- unused
|
||||||
- deadcode
|
|
||||||
- typecheck
|
- typecheck
|
||||||
- ineffassign
|
- ineffassign
|
||||||
- varcheck
|
|
||||||
- stylecheck
|
- stylecheck
|
||||||
- gochecknoinits
|
- gochecknoinits
|
||||||
- exportloopref
|
- exportloopref
|
||||||
|
|||||||
2
vendor/github.com/didip/tollbooth/v7/README.md
generated
vendored
2
vendor/github.com/didip/tollbooth/v7/README.md
generated
vendored
@@ -171,6 +171,8 @@ Sometimes, other frameworks require a little bit of shim to use Tollbooth. These
|
|||||||
|
|
||||||
## My other Go libraries
|
## My other Go libraries
|
||||||
|
|
||||||
|
* [ErrStack](https://github.com/didip/errstack): A small library to combine errors and also display filename and line number.
|
||||||
|
|
||||||
* [Stopwatch](https://github.com/didip/stopwatch): A small library to measure latency of things. Useful if you want to report latency data to Graphite.
|
* [Stopwatch](https://github.com/didip/stopwatch): A small library to measure latency of things. Useful if you want to report latency data to Graphite.
|
||||||
|
|
||||||
* [LaborUnion](https://github.com/didip/laborunion): A dynamic worker pool library.
|
* [LaborUnion](https://github.com/didip/laborunion): A dynamic worker pool library.
|
||||||
|
|||||||
34
vendor/github.com/didip/tollbooth/v7/limiter/limiter.go
generated
vendored
34
vendor/github.com/didip/tollbooth/v7/limiter/limiter.go
generated
vendored
@@ -6,7 +6,7 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
cache "github.com/go-pkgz/expirable-cache"
|
cache "github.com/go-pkgz/expirable-cache/v3"
|
||||||
|
|
||||||
"github.com/didip/tollbooth/v7/internal/time/rate"
|
"github.com/didip/tollbooth/v7/internal/time/rate"
|
||||||
)
|
)
|
||||||
@@ -36,9 +36,9 @@ func New(generalExpirableOptions *ExpirableOptions) *Limiter {
|
|||||||
lmt.generalExpirableOptions.DefaultExpirationTTL = 87600 * time.Hour
|
lmt.generalExpirableOptions.DefaultExpirationTTL = 87600 * time.Hour
|
||||||
}
|
}
|
||||||
|
|
||||||
lmt.tokenBuckets, _ = cache.NewCache(cache.TTL(lmt.generalExpirableOptions.DefaultExpirationTTL))
|
lmt.tokenBuckets = cache.NewCache[string, *rate.Limiter]().WithTTL(lmt.generalExpirableOptions.DefaultExpirationTTL)
|
||||||
|
|
||||||
lmt.basicAuthUsers, _ = cache.NewCache(cache.TTL(lmt.generalExpirableOptions.DefaultExpirationTTL))
|
lmt.basicAuthUsers = cache.NewCache[string, bool]().WithTTL(lmt.generalExpirableOptions.DefaultExpirationTTL)
|
||||||
|
|
||||||
return lmt
|
return lmt
|
||||||
}
|
}
|
||||||
@@ -81,17 +81,17 @@ type Limiter struct {
|
|||||||
generalExpirableOptions *ExpirableOptions
|
generalExpirableOptions *ExpirableOptions
|
||||||
|
|
||||||
// List of basic auth usernames to limit.
|
// List of basic auth usernames to limit.
|
||||||
basicAuthUsers cache.Cache
|
basicAuthUsers cache.Cache[string, bool]
|
||||||
|
|
||||||
// Map of HTTP headers to limit.
|
// Map of HTTP headers to limit.
|
||||||
// Empty means skip headers checking.
|
// Empty means skip headers checking.
|
||||||
headers map[string]cache.Cache
|
headers map[string]cache.Cache[string, bool]
|
||||||
|
|
||||||
// Map of Context values to limit.
|
// Map of Context values to limit.
|
||||||
contextValues map[string]cache.Cache
|
contextValues map[string]cache.Cache[string, bool]
|
||||||
|
|
||||||
// Map of limiters with TTL
|
// Map of limiters with TTL
|
||||||
tokenBuckets cache.Cache
|
tokenBuckets cache.Cache[string, *rate.Limiter]
|
||||||
|
|
||||||
// Ignore URL on the rate limiter keys
|
// Ignore URL on the rate limiter keys
|
||||||
ignoreURL bool
|
ignoreURL bool
|
||||||
@@ -261,9 +261,9 @@ func (l *Limiter) SetOnLimitReached(fn func(w http.ResponseWriter, r *http.Reque
|
|||||||
// ExecOnLimitReached is thread-safe way of executing after-rejection function when limit is reached.
|
// ExecOnLimitReached is thread-safe way of executing after-rejection function when limit is reached.
|
||||||
func (l *Limiter) ExecOnLimitReached(w http.ResponseWriter, r *http.Request) {
|
func (l *Limiter) ExecOnLimitReached(w http.ResponseWriter, r *http.Request) {
|
||||||
l.RLock()
|
l.RLock()
|
||||||
defer l.RUnlock()
|
|
||||||
|
|
||||||
fn := l.onLimitReached
|
fn := l.onLimitReached
|
||||||
|
l.RUnlock()
|
||||||
|
|
||||||
if fn != nil {
|
if fn != nil {
|
||||||
fn(w, r)
|
fn(w, r)
|
||||||
}
|
}
|
||||||
@@ -383,7 +383,7 @@ func (l *Limiter) DeleteExpiredTokenBuckets() {
|
|||||||
// SetHeaders is thread-safe way of setting map of HTTP headers to limit.
|
// SetHeaders is thread-safe way of setting map of HTTP headers to limit.
|
||||||
func (l *Limiter) SetHeaders(headers map[string][]string) *Limiter {
|
func (l *Limiter) SetHeaders(headers map[string][]string) *Limiter {
|
||||||
if l.headers == nil {
|
if l.headers == nil {
|
||||||
l.headers = make(map[string]cache.Cache)
|
l.headers = make(map[string]cache.Cache[string, bool])
|
||||||
}
|
}
|
||||||
|
|
||||||
for header, entries := range headers {
|
for header, entries := range headers {
|
||||||
@@ -419,7 +419,7 @@ func (l *Limiter) SetHeader(header string, entries []string) *Limiter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !found {
|
if !found {
|
||||||
existing, _ = cache.NewCache(cache.TTL(ttl))
|
existing = cache.NewCache[string, bool]().WithTTL(ttl)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, entry := range entries {
|
for _, entry := range entries {
|
||||||
@@ -450,7 +450,7 @@ func (l *Limiter) RemoveHeader(header string) *Limiter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
l.Lock()
|
l.Lock()
|
||||||
l.headers[header], _ = cache.NewCache(cache.TTL(ttl))
|
l.headers[header] = cache.NewCache[string, bool]().WithTTL(ttl)
|
||||||
l.Unlock()
|
l.Unlock()
|
||||||
|
|
||||||
return l
|
return l
|
||||||
@@ -476,7 +476,7 @@ func (l *Limiter) RemoveHeaderEntries(header string, entriesForRemoval []string)
|
|||||||
// SetContextValues is thread-safe way of setting map of HTTP headers to limit.
|
// SetContextValues is thread-safe way of setting map of HTTP headers to limit.
|
||||||
func (l *Limiter) SetContextValues(contextValues map[string][]string) *Limiter {
|
func (l *Limiter) SetContextValues(contextValues map[string][]string) *Limiter {
|
||||||
if l.contextValues == nil {
|
if l.contextValues == nil {
|
||||||
l.contextValues = make(map[string]cache.Cache)
|
l.contextValues = make(map[string]cache.Cache[string, bool])
|
||||||
}
|
}
|
||||||
|
|
||||||
for contextValue, entries := range contextValues {
|
for contextValue, entries := range contextValues {
|
||||||
@@ -512,7 +512,7 @@ func (l *Limiter) SetContextValue(contextValue string, entries []string) *Limite
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !found {
|
if !found {
|
||||||
existing, _ = cache.NewCache(cache.TTL(ttl))
|
existing = cache.NewCache[string, bool]().WithTTL(ttl)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, entry := range entries {
|
for _, entry := range entries {
|
||||||
@@ -543,7 +543,7 @@ func (l *Limiter) RemoveContextValue(contextValue string) *Limiter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
l.Lock()
|
l.Lock()
|
||||||
l.contextValues[contextValue], _ = cache.NewCache(cache.TTL(ttl))
|
l.contextValues[contextValue] = cache.NewCache[string, bool]().WithTTL(ttl)
|
||||||
l.Unlock()
|
l.Unlock()
|
||||||
|
|
||||||
return l
|
return l
|
||||||
@@ -585,7 +585,7 @@ func (l *Limiter) limitReachedWithTokenBucketTTL(key string, tokenBucketTTL time
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
return !expiringMap.(*rate.Limiter).Allow()
|
return !expiringMap.Allow()
|
||||||
}
|
}
|
||||||
|
|
||||||
// LimitReached returns a bool indicating if the Bucket identified by key ran out of tokens.
|
// LimitReached returns a bool indicating if the Bucket identified by key ran out of tokens.
|
||||||
@@ -606,5 +606,5 @@ func (l *Limiter) Tokens(key string) int {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
return int(expiringMap.(*rate.Limiter).TokensAt(time.Now()))
|
return int(expiringMap.TokensAt(time.Now()))
|
||||||
}
|
}
|
||||||
|
|||||||
15
vendor/github.com/go-pkgz/expirable-cache/.gitignore
generated
vendored
15
vendor/github.com/go-pkgz/expirable-cache/.gitignore
generated
vendored
@@ -1,15 +0,0 @@
|
|||||||
# Binaries for programs and plugins
|
|
||||||
*.exe
|
|
||||||
*.exe~
|
|
||||||
*.dll
|
|
||||||
*.so
|
|
||||||
*.dylib
|
|
||||||
|
|
||||||
# Test binary, built with `go test -c`
|
|
||||||
*.test
|
|
||||||
|
|
||||||
# Output of the go coverage tool, specifically when used with LiteIDE
|
|
||||||
*.out
|
|
||||||
|
|
||||||
# Dependency directories (remove the comment below to include it)
|
|
||||||
# vendor/
|
|
||||||
58
vendor/github.com/go-pkgz/expirable-cache/.golangci.yml
generated
vendored
58
vendor/github.com/go-pkgz/expirable-cache/.golangci.yml
generated
vendored
@@ -1,58 +0,0 @@
|
|||||||
linters-settings:
|
|
||||||
govet:
|
|
||||||
check-shadowing: true
|
|
||||||
gocyclo:
|
|
||||||
min-complexity: 15
|
|
||||||
maligned:
|
|
||||||
suggest-new: true
|
|
||||||
goconst:
|
|
||||||
min-len: 2
|
|
||||||
min-occurrences: 2
|
|
||||||
misspell:
|
|
||||||
locale: US
|
|
||||||
lll:
|
|
||||||
line-length: 140
|
|
||||||
gocritic:
|
|
||||||
enabled-tags:
|
|
||||||
- performance
|
|
||||||
- style
|
|
||||||
- experimental
|
|
||||||
disabled-checks:
|
|
||||||
- wrapperFunc
|
|
||||||
|
|
||||||
linters:
|
|
||||||
enable:
|
|
||||||
- megacheck
|
|
||||||
- revive
|
|
||||||
- govet
|
|
||||||
- unconvert
|
|
||||||
- megacheck
|
|
||||||
- structcheck
|
|
||||||
- gas
|
|
||||||
- gocyclo
|
|
||||||
- dupl
|
|
||||||
- misspell
|
|
||||||
- unparam
|
|
||||||
- varcheck
|
|
||||||
- deadcode
|
|
||||||
- typecheck
|
|
||||||
- ineffassign
|
|
||||||
- varcheck
|
|
||||||
- stylecheck
|
|
||||||
- gochecknoinits
|
|
||||||
- exportloopref
|
|
||||||
- gocritic
|
|
||||||
- nakedret
|
|
||||||
- gosimple
|
|
||||||
- prealloc
|
|
||||||
fast: false
|
|
||||||
disable-all: true
|
|
||||||
|
|
||||||
run:
|
|
||||||
output:
|
|
||||||
format: tab
|
|
||||||
skip-dirs:
|
|
||||||
- vendor
|
|
||||||
|
|
||||||
issues:
|
|
||||||
exclude-use-default: false
|
|
||||||
70
vendor/github.com/go-pkgz/expirable-cache/README.md
generated
vendored
70
vendor/github.com/go-pkgz/expirable-cache/README.md
generated
vendored
@@ -1,70 +0,0 @@
|
|||||||
# expirable-cache
|
|
||||||
|
|
||||||
[](https://github.com/go-pkgz/expirable-cache/actions)
|
|
||||||
[](https://coveralls.io/github/go-pkgz/expirable-cache?branch=master)
|
|
||||||
[](https://pkg.go.dev/github.com/go-pkgz/expirable-cache?tab=doc)
|
|
||||||
|
|
||||||
Package cache implements expirable cache.
|
|
||||||
|
|
||||||
- Support LRC, LRU and TTL-based eviction.
|
|
||||||
- Package is thread-safe and doesn't spawn any goroutines.
|
|
||||||
- On every Set() call, cache deletes single oldest entry in case it's expired.
|
|
||||||
- In case MaxSize is set, cache deletes the oldest entry disregarding its expiration date to maintain the size,
|
|
||||||
either using LRC or LRU eviction.
|
|
||||||
- In case of default TTL (10 years) and default MaxSize (0, unlimited) the cache will be truly unlimited
|
|
||||||
and will never delete entries from itself automatically.
|
|
||||||
|
|
||||||
**Important**: only reliable way of not having expired entries stuck in a cache is to
|
|
||||||
run cache.DeleteExpired periodically using [time.Ticker](https://golang.org/pkg/time/#Ticker),
|
|
||||||
advisable period is 1/2 of TTL.
|
|
||||||
|
|
||||||
This cache is heavily inspired by [hashicorp/golang-lru](https://github.com/hashicorp/golang-lru) _simplelru_ implementation.
|
|
||||||
|
|
||||||
### Usage example
|
|
||||||
|
|
||||||
```go
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/go-pkgz/expirable-cache/v2"
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
// make cache with short TTL and 3 max keys
|
|
||||||
c := cache.NewCache[string, string]().WithMaxKeys(3).WithTTL(time.Millisecond * 10)
|
|
||||||
|
|
||||||
// set value under key1.
|
|
||||||
// with 0 ttl (last parameter) will use cache-wide setting instead (10ms).
|
|
||||||
c.Set("key1", "val1", 0)
|
|
||||||
|
|
||||||
// get value under key1
|
|
||||||
r, ok := c.Get("key1")
|
|
||||||
|
|
||||||
// check for OK value, because otherwise return would be nil and
|
|
||||||
// type conversion will panic
|
|
||||||
if ok {
|
|
||||||
rstr := r.(string) // convert cached value from interface{} to real type
|
|
||||||
fmt.Printf("value before expiration is found: %v, value: %v\n", ok, rstr)
|
|
||||||
}
|
|
||||||
|
|
||||||
time.Sleep(time.Millisecond * 11)
|
|
||||||
|
|
||||||
// get value under key1 after key expiration
|
|
||||||
r, ok = c.Get("key1")
|
|
||||||
// don't convert to string as with ok == false value would be nil
|
|
||||||
fmt.Printf("value after expiration is found: %v, value: %v\n", ok, r)
|
|
||||||
|
|
||||||
// set value under key2, would evict old entry because it is already expired.
|
|
||||||
// ttl (last parameter) overrides cache-wide ttl.
|
|
||||||
c.Set("key2", "val2", time.Minute*5)
|
|
||||||
|
|
||||||
fmt.Printf("%+v\n", c)
|
|
||||||
// Output:
|
|
||||||
// value before expiration is found: true, value: val1
|
|
||||||
// value after expiration is found: false, value: <nil>
|
|
||||||
// Size: 1, Stats: {Hits:1 Misses:1 Added:2 Evicted:1} (50.0%)
|
|
||||||
}
|
|
||||||
```
|
|
||||||
272
vendor/github.com/go-pkgz/expirable-cache/cache.go
generated
vendored
272
vendor/github.com/go-pkgz/expirable-cache/cache.go
generated
vendored
@@ -1,272 +0,0 @@
|
|||||||
// Package cache implements Cache similar to hashicorp/golang-lru
|
|
||||||
//
|
|
||||||
// Support LRC, LRU and TTL-based eviction.
|
|
||||||
// Package is thread-safe and doesn't spawn any goroutines.
|
|
||||||
// On every Set() call, cache deletes single oldest entry in case it's expired.
|
|
||||||
// In case MaxSize is set, cache deletes the oldest entry disregarding its expiration date to maintain the size,
|
|
||||||
// either using LRC or LRU eviction.
|
|
||||||
// In case of default TTL (10 years) and default MaxSize (0, unlimited) the cache will be truly unlimited
|
|
||||||
// and will never delete entries from itself automatically.
|
|
||||||
//
|
|
||||||
// Important: only reliable way of not having expired entries stuck in a cache is to
|
|
||||||
// run cache.DeleteExpired periodically using time.Ticker, advisable period is 1/2 of TTL.
|
|
||||||
package cache
|
|
||||||
|
|
||||||
import (
|
|
||||||
"container/list"
|
|
||||||
"fmt"
|
|
||||||
"sync"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Cache defines cache interface
|
|
||||||
type Cache interface {
|
|
||||||
fmt.Stringer
|
|
||||||
Set(key string, value interface{}, ttl time.Duration)
|
|
||||||
Get(key string) (interface{}, bool)
|
|
||||||
Peek(key string) (interface{}, bool)
|
|
||||||
Keys() []string
|
|
||||||
Len() int
|
|
||||||
Invalidate(key string)
|
|
||||||
InvalidateFn(fn func(key string) bool)
|
|
||||||
RemoveOldest()
|
|
||||||
DeleteExpired()
|
|
||||||
Purge()
|
|
||||||
Stat() Stats
|
|
||||||
}
|
|
||||||
|
|
||||||
// Stats provides statistics for cache
|
|
||||||
type Stats struct {
|
|
||||||
Hits, Misses int // cache effectiveness
|
|
||||||
Added, Evicted int // number of added and evicted records
|
|
||||||
}
|
|
||||||
|
|
||||||
// cacheImpl provides Cache interface implementation.
|
|
||||||
type cacheImpl struct {
|
|
||||||
ttl time.Duration
|
|
||||||
maxKeys int
|
|
||||||
isLRU bool
|
|
||||||
onEvicted func(key string, value interface{})
|
|
||||||
|
|
||||||
sync.Mutex
|
|
||||||
stat Stats
|
|
||||||
items map[string]*list.Element
|
|
||||||
evictList *list.List
|
|
||||||
}
|
|
||||||
|
|
||||||
// noEvictionTTL - very long ttl to prevent eviction
|
|
||||||
const noEvictionTTL = time.Hour * 24 * 365 * 10
|
|
||||||
|
|
||||||
// NewCache returns a new Cache.
|
|
||||||
// Default MaxKeys is unlimited (0).
|
|
||||||
// Default TTL is 10 years, sane value for expirable cache is 5 minutes.
|
|
||||||
// Default eviction mode is LRC, appropriate option allow to change it to LRU.
|
|
||||||
func NewCache(options ...Option) (Cache, error) {
|
|
||||||
res := cacheImpl{
|
|
||||||
items: map[string]*list.Element{},
|
|
||||||
evictList: list.New(),
|
|
||||||
ttl: noEvictionTTL,
|
|
||||||
maxKeys: 0,
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, opt := range options {
|
|
||||||
if err := opt(&res); err != nil {
|
|
||||||
return nil, fmt.Errorf("failed to set cache option: %w", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return &res, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set key, ttl of 0 would use cache-wide TTL
|
|
||||||
func (c *cacheImpl) Set(key string, value interface{}, ttl time.Duration) {
|
|
||||||
c.Lock()
|
|
||||||
defer c.Unlock()
|
|
||||||
now := time.Now()
|
|
||||||
if ttl == 0 {
|
|
||||||
ttl = c.ttl
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check for existing item
|
|
||||||
if ent, ok := c.items[key]; ok {
|
|
||||||
c.evictList.MoveToFront(ent)
|
|
||||||
ent.Value.(*cacheItem).value = value
|
|
||||||
ent.Value.(*cacheItem).expiresAt = now.Add(ttl)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add new item
|
|
||||||
ent := &cacheItem{key: key, value: value, expiresAt: now.Add(ttl)}
|
|
||||||
entry := c.evictList.PushFront(ent)
|
|
||||||
c.items[key] = entry
|
|
||||||
c.stat.Added++
|
|
||||||
|
|
||||||
// Remove oldest entry if it is expired, only in case of non-default TTL.
|
|
||||||
if c.ttl != noEvictionTTL || ttl != noEvictionTTL {
|
|
||||||
c.removeOldestIfExpired()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Verify size not exceeded
|
|
||||||
if c.maxKeys > 0 && len(c.items) > c.maxKeys {
|
|
||||||
c.removeOldest()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get returns the key value if it's not expired
|
|
||||||
func (c *cacheImpl) Get(key string) (interface{}, bool) {
|
|
||||||
c.Lock()
|
|
||||||
defer c.Unlock()
|
|
||||||
if ent, ok := c.items[key]; ok {
|
|
||||||
// Expired item check
|
|
||||||
if time.Now().After(ent.Value.(*cacheItem).expiresAt) {
|
|
||||||
c.stat.Misses++
|
|
||||||
return nil, false
|
|
||||||
}
|
|
||||||
if c.isLRU {
|
|
||||||
c.evictList.MoveToFront(ent)
|
|
||||||
}
|
|
||||||
c.stat.Hits++
|
|
||||||
return ent.Value.(*cacheItem).value, true
|
|
||||||
}
|
|
||||||
c.stat.Misses++
|
|
||||||
return nil, false
|
|
||||||
}
|
|
||||||
|
|
||||||
// Peek returns the key value (or undefined if not found) without updating the "recently used"-ness of the key.
|
|
||||||
// Works exactly the same as Get in case of LRC mode (default one).
|
|
||||||
func (c *cacheImpl) Peek(key string) (interface{}, bool) {
|
|
||||||
c.Lock()
|
|
||||||
defer c.Unlock()
|
|
||||||
if ent, ok := c.items[key]; ok {
|
|
||||||
// Expired item check
|
|
||||||
if time.Now().After(ent.Value.(*cacheItem).expiresAt) {
|
|
||||||
c.stat.Misses++
|
|
||||||
return nil, false
|
|
||||||
}
|
|
||||||
c.stat.Hits++
|
|
||||||
return ent.Value.(*cacheItem).value, true
|
|
||||||
}
|
|
||||||
c.stat.Misses++
|
|
||||||
return nil, false
|
|
||||||
}
|
|
||||||
|
|
||||||
// Keys returns a slice of the keys in the cache, from oldest to newest.
|
|
||||||
func (c *cacheImpl) Keys() []string {
|
|
||||||
c.Lock()
|
|
||||||
defer c.Unlock()
|
|
||||||
return c.keys()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Len return count of items in cache, including expired
|
|
||||||
func (c *cacheImpl) Len() int {
|
|
||||||
c.Lock()
|
|
||||||
defer c.Unlock()
|
|
||||||
return c.evictList.Len()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Invalidate key (item) from the cache
|
|
||||||
func (c *cacheImpl) Invalidate(key string) {
|
|
||||||
c.Lock()
|
|
||||||
defer c.Unlock()
|
|
||||||
if ent, ok := c.items[key]; ok {
|
|
||||||
c.removeElement(ent)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// InvalidateFn deletes multiple keys if predicate is true
|
|
||||||
func (c *cacheImpl) InvalidateFn(fn func(key string) bool) {
|
|
||||||
c.Lock()
|
|
||||||
defer c.Unlock()
|
|
||||||
for key, ent := range c.items {
|
|
||||||
if fn(key) {
|
|
||||||
c.removeElement(ent)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// RemoveOldest remove oldest element in the cache
|
|
||||||
func (c *cacheImpl) RemoveOldest() {
|
|
||||||
c.Lock()
|
|
||||||
defer c.Unlock()
|
|
||||||
c.removeOldest()
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeleteExpired clears cache of expired items
|
|
||||||
func (c *cacheImpl) DeleteExpired() {
|
|
||||||
c.Lock()
|
|
||||||
defer c.Unlock()
|
|
||||||
for _, key := range c.keys() {
|
|
||||||
if time.Now().After(c.items[key].Value.(*cacheItem).expiresAt) {
|
|
||||||
c.removeElement(c.items[key])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Purge clears the cache completely.
|
|
||||||
func (c *cacheImpl) Purge() {
|
|
||||||
c.Lock()
|
|
||||||
defer c.Unlock()
|
|
||||||
for k, v := range c.items {
|
|
||||||
delete(c.items, k)
|
|
||||||
c.stat.Evicted++
|
|
||||||
if c.onEvicted != nil {
|
|
||||||
c.onEvicted(k, v.Value.(*cacheItem).value)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
c.evictList.Init()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Stat gets the current stats for cache
|
|
||||||
func (c *cacheImpl) Stat() Stats {
|
|
||||||
c.Lock()
|
|
||||||
defer c.Unlock()
|
|
||||||
return c.stat
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *cacheImpl) String() string {
|
|
||||||
stats := c.Stat()
|
|
||||||
size := c.Len()
|
|
||||||
return fmt.Sprintf("Size: %d, Stats: %+v (%0.1f%%)", size, stats, 100*float64(stats.Hits)/float64(stats.Hits+stats.Misses))
|
|
||||||
}
|
|
||||||
|
|
||||||
// Keys returns a slice of the keys in the cache, from oldest to newest. Has to be called with lock!
|
|
||||||
func (c *cacheImpl) keys() []string {
|
|
||||||
keys := make([]string, 0, len(c.items))
|
|
||||||
for ent := c.evictList.Back(); ent != nil; ent = ent.Prev() {
|
|
||||||
keys = append(keys, ent.Value.(*cacheItem).key)
|
|
||||||
}
|
|
||||||
return keys
|
|
||||||
}
|
|
||||||
|
|
||||||
// removeOldest removes the oldest item from the cache. Has to be called with lock!
|
|
||||||
func (c *cacheImpl) removeOldest() {
|
|
||||||
ent := c.evictList.Back()
|
|
||||||
if ent != nil {
|
|
||||||
c.removeElement(ent)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// removeOldest removes the oldest item from the cache in case it's already expired. Has to be called with lock!
|
|
||||||
func (c *cacheImpl) removeOldestIfExpired() {
|
|
||||||
ent := c.evictList.Back()
|
|
||||||
if ent != nil && time.Now().After(ent.Value.(*cacheItem).expiresAt) {
|
|
||||||
c.removeElement(ent)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// removeElement is used to remove a given list element from the cache. Has to be called with lock!
|
|
||||||
func (c *cacheImpl) removeElement(e *list.Element) {
|
|
||||||
c.evictList.Remove(e)
|
|
||||||
kv := e.Value.(*cacheItem)
|
|
||||||
delete(c.items, kv.key)
|
|
||||||
c.stat.Evicted++
|
|
||||||
if c.onEvicted != nil {
|
|
||||||
c.onEvicted(kv.key, kv.value)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// cacheItem is used to hold a value in the evictList
|
|
||||||
type cacheItem struct {
|
|
||||||
expiresAt time.Time
|
|
||||||
key string
|
|
||||||
value interface{}
|
|
||||||
}
|
|
||||||
40
vendor/github.com/go-pkgz/expirable-cache/options.go
generated
vendored
40
vendor/github.com/go-pkgz/expirable-cache/options.go
generated
vendored
@@ -1,40 +0,0 @@
|
|||||||
package cache
|
|
||||||
|
|
||||||
import "time"
|
|
||||||
|
|
||||||
// Option func type
|
|
||||||
type Option func(lc *cacheImpl) error
|
|
||||||
|
|
||||||
// OnEvicted called automatically for automatically and manually deleted entries
|
|
||||||
func OnEvicted(fn func(key string, value interface{})) Option {
|
|
||||||
return func(lc *cacheImpl) error {
|
|
||||||
lc.onEvicted = fn
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// MaxKeys functional option defines how many keys to keep.
|
|
||||||
// By default it is 0, which means unlimited.
|
|
||||||
func MaxKeys(max int) Option {
|
|
||||||
return func(lc *cacheImpl) error {
|
|
||||||
lc.maxKeys = max
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TTL functional option defines TTL for all cache entries.
|
|
||||||
// By default it is set to 10 years, sane option for expirable cache might be 5 minutes.
|
|
||||||
func TTL(ttl time.Duration) Option {
|
|
||||||
return func(lc *cacheImpl) error {
|
|
||||||
lc.ttl = ttl
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// LRU sets cache to LRU (Least Recently Used) eviction mode.
|
|
||||||
func LRU() Option {
|
|
||||||
return func(lc *cacheImpl) error {
|
|
||||||
lc.isLRU = true
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
371
vendor/github.com/go-pkgz/expirable-cache/v3/cache.go
generated
vendored
Normal file
371
vendor/github.com/go-pkgz/expirable-cache/v3/cache.go
generated
vendored
Normal file
@@ -0,0 +1,371 @@
|
|||||||
|
// Package cache implements Cache similar to hashicorp/golang-lru
|
||||||
|
//
|
||||||
|
// Support LRC, LRU and TTL-based eviction.
|
||||||
|
// Package is thread-safe and doesn't spawn any goroutines.
|
||||||
|
// On every Set() call, cache deletes single oldest entry in case it's expired.
|
||||||
|
// In case MaxSize is set, cache deletes the oldest entry disregarding its expiration date to maintain the size,
|
||||||
|
// either using LRC or LRU eviction.
|
||||||
|
// In case of default TTL (10 years) and default MaxSize (0, unlimited) the cache will be truly unlimited
|
||||||
|
// and will never delete entries from itself automatically.
|
||||||
|
//
|
||||||
|
// Important: only reliable way of not having expired entries stuck in a cache is to
|
||||||
|
// run cache.DeleteExpired periodically using time.Ticker, advisable period is 1/2 of TTL.
|
||||||
|
package cache
|
||||||
|
|
||||||
|
import (
|
||||||
|
"container/list"
|
||||||
|
"fmt"
|
||||||
|
"sync"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Cache defines cache interface
|
||||||
|
type Cache[K comparable, V any] interface {
|
||||||
|
fmt.Stringer
|
||||||
|
options[K, V]
|
||||||
|
Add(key K, value V) bool
|
||||||
|
Set(key K, value V, ttl time.Duration)
|
||||||
|
Get(key K) (V, bool)
|
||||||
|
GetExpiration(key K) (time.Time, bool)
|
||||||
|
GetOldest() (K, V, bool)
|
||||||
|
Contains(key K) (ok bool)
|
||||||
|
Peek(key K) (V, bool)
|
||||||
|
Values() []V
|
||||||
|
Keys() []K
|
||||||
|
Len() int
|
||||||
|
Remove(key K) bool
|
||||||
|
Invalidate(key K)
|
||||||
|
InvalidateFn(fn func(key K) bool)
|
||||||
|
RemoveOldest() (K, V, bool)
|
||||||
|
DeleteExpired()
|
||||||
|
Purge()
|
||||||
|
Resize(int) int
|
||||||
|
Stat() Stats
|
||||||
|
}
|
||||||
|
|
||||||
|
// Stats provides statistics for cache
|
||||||
|
type Stats struct {
|
||||||
|
Hits, Misses int // cache effectiveness
|
||||||
|
Added, Evicted int // number of added and evicted records
|
||||||
|
}
|
||||||
|
|
||||||
|
// cacheImpl provides Cache interface implementation.
|
||||||
|
type cacheImpl[K comparable, V any] struct {
|
||||||
|
ttl time.Duration
|
||||||
|
maxKeys int
|
||||||
|
isLRU bool
|
||||||
|
onEvicted func(key K, value V)
|
||||||
|
|
||||||
|
sync.Mutex
|
||||||
|
stat Stats
|
||||||
|
items map[K]*list.Element
|
||||||
|
evictList *list.List
|
||||||
|
}
|
||||||
|
|
||||||
|
// noEvictionTTL - very long ttl to prevent eviction
|
||||||
|
const noEvictionTTL = time.Hour * 24 * 365 * 10
|
||||||
|
|
||||||
|
// NewCache returns a new Cache.
|
||||||
|
// Default MaxKeys is unlimited (0).
|
||||||
|
// Default TTL is 10 years, sane value for expirable cache is 5 minutes.
|
||||||
|
// Default eviction mode is LRC, appropriate option allow to change it to LRU.
|
||||||
|
func NewCache[K comparable, V any]() Cache[K, V] {
|
||||||
|
return &cacheImpl[K, V]{
|
||||||
|
items: map[K]*list.Element{},
|
||||||
|
evictList: list.New(),
|
||||||
|
ttl: noEvictionTTL,
|
||||||
|
maxKeys: 0,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add adds a value to the cache. Returns true if an eviction occurred.
|
||||||
|
// Returns false if there was no eviction: the item was already in the cache,
|
||||||
|
// or the size was not exceeded.
|
||||||
|
func (c *cacheImpl[K, V]) Add(key K, value V) (evicted bool) {
|
||||||
|
return c.addWithTTL(key, value, c.ttl)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set key, ttl of 0 would use cache-wide TTL
|
||||||
|
func (c *cacheImpl[K, V]) Set(key K, value V, ttl time.Duration) {
|
||||||
|
c.addWithTTL(key, value, ttl)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns true if an eviction occurred.
|
||||||
|
// Returns false if there was no eviction: the item was already in the cache,
|
||||||
|
// or the size was not exceeded.
|
||||||
|
func (c *cacheImpl[K, V]) addWithTTL(key K, value V, ttl time.Duration) (evicted bool) {
|
||||||
|
c.Lock()
|
||||||
|
defer c.Unlock()
|
||||||
|
now := time.Now()
|
||||||
|
if ttl == 0 {
|
||||||
|
ttl = c.ttl
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for existing item
|
||||||
|
if ent, ok := c.items[key]; ok {
|
||||||
|
c.evictList.MoveToFront(ent)
|
||||||
|
ent.Value.(*cacheItem[K, V]).value = value
|
||||||
|
ent.Value.(*cacheItem[K, V]).expiresAt = now.Add(ttl)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add new item
|
||||||
|
ent := &cacheItem[K, V]{key: key, value: value, expiresAt: now.Add(ttl)}
|
||||||
|
entry := c.evictList.PushFront(ent)
|
||||||
|
c.items[key] = entry
|
||||||
|
c.stat.Added++
|
||||||
|
|
||||||
|
// Remove the oldest entry if it is expired, only in case of non-default TTL.
|
||||||
|
if c.ttl != noEvictionTTL || ttl != noEvictionTTL {
|
||||||
|
c.removeOldestIfExpired()
|
||||||
|
}
|
||||||
|
|
||||||
|
evict := c.maxKeys > 0 && len(c.items) > c.maxKeys
|
||||||
|
// Verify size not exceeded
|
||||||
|
if evict {
|
||||||
|
c.removeOldest()
|
||||||
|
}
|
||||||
|
return evict
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get returns the key value if it's not expired
|
||||||
|
func (c *cacheImpl[K, V]) Get(key K) (V, bool) {
|
||||||
|
def := *new(V)
|
||||||
|
c.Lock()
|
||||||
|
defer c.Unlock()
|
||||||
|
if ent, ok := c.items[key]; ok {
|
||||||
|
// Expired item check
|
||||||
|
if time.Now().After(ent.Value.(*cacheItem[K, V]).expiresAt) {
|
||||||
|
c.stat.Misses++
|
||||||
|
return ent.Value.(*cacheItem[K, V]).value, false
|
||||||
|
}
|
||||||
|
if c.isLRU {
|
||||||
|
c.evictList.MoveToFront(ent)
|
||||||
|
}
|
||||||
|
c.stat.Hits++
|
||||||
|
return ent.Value.(*cacheItem[K, V]).value, true
|
||||||
|
}
|
||||||
|
c.stat.Misses++
|
||||||
|
return def, false
|
||||||
|
}
|
||||||
|
|
||||||
|
// Contains checks if a key is in the cache, without updating the recent-ness
|
||||||
|
// or deleting it for being stale.
|
||||||
|
func (c *cacheImpl[K, V]) Contains(key K) (ok bool) {
|
||||||
|
c.Lock()
|
||||||
|
defer c.Unlock()
|
||||||
|
_, ok = c.items[key]
|
||||||
|
return ok
|
||||||
|
}
|
||||||
|
|
||||||
|
// Peek returns the key value (or undefined if not found) without updating the "recently used"-ness of the key.
|
||||||
|
// Works exactly the same as Get in case of LRC mode (default one).
|
||||||
|
func (c *cacheImpl[K, V]) Peek(key K) (V, bool) {
|
||||||
|
def := *new(V)
|
||||||
|
c.Lock()
|
||||||
|
defer c.Unlock()
|
||||||
|
if ent, ok := c.items[key]; ok {
|
||||||
|
// Expired item check
|
||||||
|
if time.Now().After(ent.Value.(*cacheItem[K, V]).expiresAt) {
|
||||||
|
c.stat.Misses++
|
||||||
|
return ent.Value.(*cacheItem[K, V]).value, false
|
||||||
|
}
|
||||||
|
c.stat.Hits++
|
||||||
|
return ent.Value.(*cacheItem[K, V]).value, true
|
||||||
|
}
|
||||||
|
c.stat.Misses++
|
||||||
|
return def, false
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetExpiration returns the expiration time of the key. Non-existing key returns zero time.
|
||||||
|
func (c *cacheImpl[K, V]) GetExpiration(key K) (time.Time, bool) {
|
||||||
|
c.Lock()
|
||||||
|
defer c.Unlock()
|
||||||
|
if ent, ok := c.items[key]; ok {
|
||||||
|
return ent.Value.(*cacheItem[K, V]).expiresAt, true
|
||||||
|
}
|
||||||
|
return time.Time{}, false
|
||||||
|
}
|
||||||
|
|
||||||
|
// Keys returns a slice of the keys in the cache, from oldest to newest.
|
||||||
|
func (c *cacheImpl[K, V]) Keys() []K {
|
||||||
|
c.Lock()
|
||||||
|
defer c.Unlock()
|
||||||
|
return c.keys()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Values returns a slice of the values in the cache, from oldest to newest.
|
||||||
|
// Expired entries are filtered out.
|
||||||
|
func (c *cacheImpl[K, V]) Values() []V {
|
||||||
|
c.Lock()
|
||||||
|
defer c.Unlock()
|
||||||
|
values := make([]V, 0, len(c.items))
|
||||||
|
now := time.Now()
|
||||||
|
for ent := c.evictList.Back(); ent != nil; ent = ent.Prev() {
|
||||||
|
if now.After(ent.Value.(*cacheItem[K, V]).expiresAt) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
values = append(values, ent.Value.(*cacheItem[K, V]).value)
|
||||||
|
}
|
||||||
|
return values
|
||||||
|
}
|
||||||
|
|
||||||
|
// Len return count of items in cache, including expired
|
||||||
|
func (c *cacheImpl[K, V]) Len() int {
|
||||||
|
c.Lock()
|
||||||
|
defer c.Unlock()
|
||||||
|
return c.evictList.Len()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Resize changes the cache size. Size of 0 means unlimited.
|
||||||
|
func (c *cacheImpl[K, V]) Resize(size int) int {
|
||||||
|
c.Lock()
|
||||||
|
defer c.Unlock()
|
||||||
|
if size <= 0 {
|
||||||
|
c.maxKeys = 0
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
diff := c.evictList.Len() - size
|
||||||
|
if diff < 0 {
|
||||||
|
diff = 0
|
||||||
|
}
|
||||||
|
for i := 0; i < diff; i++ {
|
||||||
|
c.removeOldest()
|
||||||
|
}
|
||||||
|
c.maxKeys = size
|
||||||
|
return diff
|
||||||
|
}
|
||||||
|
|
||||||
|
// Invalidate key (item) from the cache
|
||||||
|
func (c *cacheImpl[K, V]) Invalidate(key K) {
|
||||||
|
c.Lock()
|
||||||
|
defer c.Unlock()
|
||||||
|
if ent, ok := c.items[key]; ok {
|
||||||
|
c.removeElement(ent)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// InvalidateFn deletes multiple keys if predicate is true
|
||||||
|
func (c *cacheImpl[K, V]) InvalidateFn(fn func(key K) bool) {
|
||||||
|
c.Lock()
|
||||||
|
defer c.Unlock()
|
||||||
|
for key, ent := range c.items {
|
||||||
|
if fn(key) {
|
||||||
|
c.removeElement(ent)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove removes the provided key from the cache, returning if the
|
||||||
|
// key was contained.
|
||||||
|
func (c *cacheImpl[K, V]) Remove(key K) bool {
|
||||||
|
c.Lock()
|
||||||
|
defer c.Unlock()
|
||||||
|
if ent, ok := c.items[key]; ok {
|
||||||
|
c.removeElement(ent)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// RemoveOldest remove the oldest element in the cache
|
||||||
|
func (c *cacheImpl[K, V]) RemoveOldest() (key K, value V, ok bool) {
|
||||||
|
c.Lock()
|
||||||
|
defer c.Unlock()
|
||||||
|
if ent := c.evictList.Back(); ent != nil {
|
||||||
|
c.removeElement(ent)
|
||||||
|
return ent.Value.(*cacheItem[K, V]).key, ent.Value.(*cacheItem[K, V]).value, true
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOldest returns the oldest entry
|
||||||
|
func (c *cacheImpl[K, V]) GetOldest() (key K, value V, ok bool) {
|
||||||
|
c.Lock()
|
||||||
|
defer c.Unlock()
|
||||||
|
if ent := c.evictList.Back(); ent != nil {
|
||||||
|
return ent.Value.(*cacheItem[K, V]).key, ent.Value.(*cacheItem[K, V]).value, true
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteExpired clears cache of expired items
|
||||||
|
func (c *cacheImpl[K, V]) DeleteExpired() {
|
||||||
|
c.Lock()
|
||||||
|
defer c.Unlock()
|
||||||
|
for _, key := range c.keys() {
|
||||||
|
if time.Now().After(c.items[key].Value.(*cacheItem[K, V]).expiresAt) {
|
||||||
|
c.removeElement(c.items[key])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Purge clears the cache completely.
|
||||||
|
func (c *cacheImpl[K, V]) Purge() {
|
||||||
|
c.Lock()
|
||||||
|
defer c.Unlock()
|
||||||
|
for k, v := range c.items {
|
||||||
|
delete(c.items, k)
|
||||||
|
c.stat.Evicted++
|
||||||
|
if c.onEvicted != nil {
|
||||||
|
c.onEvicted(k, v.Value.(*cacheItem[K, V]).value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
c.evictList.Init()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Stat gets the current stats for cache
|
||||||
|
func (c *cacheImpl[K, V]) Stat() Stats {
|
||||||
|
c.Lock()
|
||||||
|
defer c.Unlock()
|
||||||
|
return c.stat
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *cacheImpl[K, V]) String() string {
|
||||||
|
stats := c.Stat()
|
||||||
|
size := c.Len()
|
||||||
|
return fmt.Sprintf("Size: %d, Stats: %+v (%0.1f%%)", size, stats, 100*float64(stats.Hits)/float64(stats.Hits+stats.Misses))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Keys returns a slice of the keys in the cache, from oldest to newest. Has to be called with lock!
|
||||||
|
func (c *cacheImpl[K, V]) keys() []K {
|
||||||
|
keys := make([]K, 0, len(c.items))
|
||||||
|
for ent := c.evictList.Back(); ent != nil; ent = ent.Prev() {
|
||||||
|
keys = append(keys, ent.Value.(*cacheItem[K, V]).key)
|
||||||
|
}
|
||||||
|
return keys
|
||||||
|
}
|
||||||
|
|
||||||
|
// removeOldest removes the oldest item from the cache. Has to be called with lock!
|
||||||
|
func (c *cacheImpl[K, V]) removeOldest() {
|
||||||
|
ent := c.evictList.Back()
|
||||||
|
if ent != nil {
|
||||||
|
c.removeElement(ent)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// removeOldest removes the oldest item from the cache in case it's already expired. Has to be called with lock!
|
||||||
|
func (c *cacheImpl[K, V]) removeOldestIfExpired() {
|
||||||
|
ent := c.evictList.Back()
|
||||||
|
if ent != nil && time.Now().After(ent.Value.(*cacheItem[K, V]).expiresAt) {
|
||||||
|
c.removeElement(ent)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// removeElement is used to remove a given list element from the cache. Has to be called with lock!
|
||||||
|
func (c *cacheImpl[K, V]) removeElement(e *list.Element) {
|
||||||
|
c.evictList.Remove(e)
|
||||||
|
kv := e.Value.(*cacheItem[K, V])
|
||||||
|
delete(c.items, kv.key)
|
||||||
|
c.stat.Evicted++
|
||||||
|
if c.onEvicted != nil {
|
||||||
|
c.onEvicted(kv.key, kv.value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// cacheItem is used to hold a value in the evictList
|
||||||
|
type cacheItem[K comparable, V any] struct {
|
||||||
|
expiresAt time.Time
|
||||||
|
key K
|
||||||
|
value V
|
||||||
|
}
|
||||||
36
vendor/github.com/go-pkgz/expirable-cache/v3/options.go
generated
vendored
Normal file
36
vendor/github.com/go-pkgz/expirable-cache/v3/options.go
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
package cache
|
||||||
|
|
||||||
|
import "time"
|
||||||
|
|
||||||
|
type options[K comparable, V any] interface {
|
||||||
|
WithTTL(ttl time.Duration) Cache[K, V]
|
||||||
|
WithMaxKeys(maxKeys int) Cache[K, V]
|
||||||
|
WithLRU() Cache[K, V]
|
||||||
|
WithOnEvicted(fn func(key K, value V)) Cache[K, V]
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTTL functional option defines TTL for all cache entries.
|
||||||
|
// By default, it is set to 10 years, sane option for expirable cache might be 5 minutes.
|
||||||
|
func (c *cacheImpl[K, V]) WithTTL(ttl time.Duration) Cache[K, V] {
|
||||||
|
c.ttl = ttl
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithMaxKeys functional option defines how many keys to keep.
|
||||||
|
// By default, it is 0, which means unlimited.
|
||||||
|
func (c *cacheImpl[K, V]) WithMaxKeys(maxKeys int) Cache[K, V] {
|
||||||
|
c.maxKeys = maxKeys
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithLRU sets cache to LRU (Least Recently Used) eviction mode.
|
||||||
|
func (c *cacheImpl[K, V]) WithLRU() Cache[K, V] {
|
||||||
|
c.isLRU = true
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithOnEvicted defined function which would be called automatically for automatically and manually deleted entries
|
||||||
|
func (c *cacheImpl[K, V]) WithOnEvicted(fn func(key K, value V)) Cache[K, V] {
|
||||||
|
c.onEvicted = fn
|
||||||
|
return c
|
||||||
|
}
|
||||||
2
vendor/golang.org/x/sys/unix/mkerrors.sh
generated
vendored
2
vendor/golang.org/x/sys/unix/mkerrors.sh
generated
vendored
@@ -263,6 +263,7 @@ struct ltchars {
|
|||||||
#include <linux/sched.h>
|
#include <linux/sched.h>
|
||||||
#include <linux/seccomp.h>
|
#include <linux/seccomp.h>
|
||||||
#include <linux/serial.h>
|
#include <linux/serial.h>
|
||||||
|
#include <linux/sock_diag.h>
|
||||||
#include <linux/sockios.h>
|
#include <linux/sockios.h>
|
||||||
#include <linux/taskstats.h>
|
#include <linux/taskstats.h>
|
||||||
#include <linux/tipc.h>
|
#include <linux/tipc.h>
|
||||||
@@ -549,6 +550,7 @@ ccflags="$@"
|
|||||||
$2 !~ "NLA_TYPE_MASK" &&
|
$2 !~ "NLA_TYPE_MASK" &&
|
||||||
$2 !~ /^RTC_VL_(ACCURACY|BACKUP|DATA)/ &&
|
$2 !~ /^RTC_VL_(ACCURACY|BACKUP|DATA)/ &&
|
||||||
$2 ~ /^(NETLINK|NLM|NLMSG|NLA|IFA|IFAN|RT|RTC|RTCF|RTN|RTPROT|RTNH|ARPHRD|ETH_P|NETNSA)_/ ||
|
$2 ~ /^(NETLINK|NLM|NLMSG|NLA|IFA|IFAN|RT|RTC|RTCF|RTN|RTPROT|RTNH|ARPHRD|ETH_P|NETNSA)_/ ||
|
||||||
|
$2 ~ /^SOCK_|SK_DIAG_|SKNLGRP_$/ ||
|
||||||
$2 ~ /^FIORDCHK$/ ||
|
$2 ~ /^FIORDCHK$/ ||
|
||||||
$2 ~ /^SIOC/ ||
|
$2 ~ /^SIOC/ ||
|
||||||
$2 ~ /^TIOC/ ||
|
$2 ~ /^TIOC/ ||
|
||||||
|
|||||||
20
vendor/golang.org/x/sys/unix/zerrors_linux.go
generated
vendored
20
vendor/golang.org/x/sys/unix/zerrors_linux.go
generated
vendored
@@ -502,6 +502,7 @@ const (
|
|||||||
BPF_IMM = 0x0
|
BPF_IMM = 0x0
|
||||||
BPF_IND = 0x40
|
BPF_IND = 0x40
|
||||||
BPF_JA = 0x0
|
BPF_JA = 0x0
|
||||||
|
BPF_JCOND = 0xe0
|
||||||
BPF_JEQ = 0x10
|
BPF_JEQ = 0x10
|
||||||
BPF_JGE = 0x30
|
BPF_JGE = 0x30
|
||||||
BPF_JGT = 0x20
|
BPF_JGT = 0x20
|
||||||
@@ -657,6 +658,9 @@ const (
|
|||||||
CAN_NPROTO = 0x8
|
CAN_NPROTO = 0x8
|
||||||
CAN_RAW = 0x1
|
CAN_RAW = 0x1
|
||||||
CAN_RAW_FILTER_MAX = 0x200
|
CAN_RAW_FILTER_MAX = 0x200
|
||||||
|
CAN_RAW_XL_VCID_RX_FILTER = 0x4
|
||||||
|
CAN_RAW_XL_VCID_TX_PASS = 0x2
|
||||||
|
CAN_RAW_XL_VCID_TX_SET = 0x1
|
||||||
CAN_RTR_FLAG = 0x40000000
|
CAN_RTR_FLAG = 0x40000000
|
||||||
CAN_SFF_ID_BITS = 0xb
|
CAN_SFF_ID_BITS = 0xb
|
||||||
CAN_SFF_MASK = 0x7ff
|
CAN_SFF_MASK = 0x7ff
|
||||||
@@ -1339,6 +1343,7 @@ const (
|
|||||||
F_OFD_SETLK = 0x25
|
F_OFD_SETLK = 0x25
|
||||||
F_OFD_SETLKW = 0x26
|
F_OFD_SETLKW = 0x26
|
||||||
F_OK = 0x0
|
F_OK = 0x0
|
||||||
|
F_SEAL_EXEC = 0x20
|
||||||
F_SEAL_FUTURE_WRITE = 0x10
|
F_SEAL_FUTURE_WRITE = 0x10
|
||||||
F_SEAL_GROW = 0x4
|
F_SEAL_GROW = 0x4
|
||||||
F_SEAL_SEAL = 0x1
|
F_SEAL_SEAL = 0x1
|
||||||
@@ -1627,6 +1632,7 @@ const (
|
|||||||
IP_FREEBIND = 0xf
|
IP_FREEBIND = 0xf
|
||||||
IP_HDRINCL = 0x3
|
IP_HDRINCL = 0x3
|
||||||
IP_IPSEC_POLICY = 0x10
|
IP_IPSEC_POLICY = 0x10
|
||||||
|
IP_LOCAL_PORT_RANGE = 0x33
|
||||||
IP_MAXPACKET = 0xffff
|
IP_MAXPACKET = 0xffff
|
||||||
IP_MAX_MEMBERSHIPS = 0x14
|
IP_MAX_MEMBERSHIPS = 0x14
|
||||||
IP_MF = 0x2000
|
IP_MF = 0x2000
|
||||||
@@ -1653,6 +1659,7 @@ const (
|
|||||||
IP_PMTUDISC_OMIT = 0x5
|
IP_PMTUDISC_OMIT = 0x5
|
||||||
IP_PMTUDISC_PROBE = 0x3
|
IP_PMTUDISC_PROBE = 0x3
|
||||||
IP_PMTUDISC_WANT = 0x1
|
IP_PMTUDISC_WANT = 0x1
|
||||||
|
IP_PROTOCOL = 0x34
|
||||||
IP_RECVERR = 0xb
|
IP_RECVERR = 0xb
|
||||||
IP_RECVERR_RFC4884 = 0x1a
|
IP_RECVERR_RFC4884 = 0x1a
|
||||||
IP_RECVFRAGSIZE = 0x19
|
IP_RECVFRAGSIZE = 0x19
|
||||||
@@ -2169,7 +2176,7 @@ const (
|
|||||||
NFT_SECMARK_CTX_MAXLEN = 0x100
|
NFT_SECMARK_CTX_MAXLEN = 0x100
|
||||||
NFT_SET_MAXNAMELEN = 0x100
|
NFT_SET_MAXNAMELEN = 0x100
|
||||||
NFT_SOCKET_MAX = 0x3
|
NFT_SOCKET_MAX = 0x3
|
||||||
NFT_TABLE_F_MASK = 0x3
|
NFT_TABLE_F_MASK = 0x7
|
||||||
NFT_TABLE_MAXNAMELEN = 0x100
|
NFT_TABLE_MAXNAMELEN = 0x100
|
||||||
NFT_TRACETYPE_MAX = 0x3
|
NFT_TRACETYPE_MAX = 0x3
|
||||||
NFT_TUNNEL_F_MASK = 0x7
|
NFT_TUNNEL_F_MASK = 0x7
|
||||||
@@ -2403,6 +2410,7 @@ const (
|
|||||||
PERF_RECORD_MISC_USER = 0x2
|
PERF_RECORD_MISC_USER = 0x2
|
||||||
PERF_SAMPLE_BRANCH_PLM_ALL = 0x7
|
PERF_SAMPLE_BRANCH_PLM_ALL = 0x7
|
||||||
PERF_SAMPLE_WEIGHT_TYPE = 0x1004000
|
PERF_SAMPLE_WEIGHT_TYPE = 0x1004000
|
||||||
|
PID_FS_MAGIC = 0x50494446
|
||||||
PIPEFS_MAGIC = 0x50495045
|
PIPEFS_MAGIC = 0x50495045
|
||||||
PPPIOCGNPMODE = 0xc008744c
|
PPPIOCGNPMODE = 0xc008744c
|
||||||
PPPIOCNEWUNIT = 0xc004743e
|
PPPIOCNEWUNIT = 0xc004743e
|
||||||
@@ -2896,8 +2904,9 @@ const (
|
|||||||
RWF_APPEND = 0x10
|
RWF_APPEND = 0x10
|
||||||
RWF_DSYNC = 0x2
|
RWF_DSYNC = 0x2
|
||||||
RWF_HIPRI = 0x1
|
RWF_HIPRI = 0x1
|
||||||
|
RWF_NOAPPEND = 0x20
|
||||||
RWF_NOWAIT = 0x8
|
RWF_NOWAIT = 0x8
|
||||||
RWF_SUPPORTED = 0x1f
|
RWF_SUPPORTED = 0x3f
|
||||||
RWF_SYNC = 0x4
|
RWF_SYNC = 0x4
|
||||||
RWF_WRITE_LIFE_NOT_SET = 0x0
|
RWF_WRITE_LIFE_NOT_SET = 0x0
|
||||||
SCHED_BATCH = 0x3
|
SCHED_BATCH = 0x3
|
||||||
@@ -2918,7 +2927,9 @@ const (
|
|||||||
SCHED_RESET_ON_FORK = 0x40000000
|
SCHED_RESET_ON_FORK = 0x40000000
|
||||||
SCHED_RR = 0x2
|
SCHED_RR = 0x2
|
||||||
SCM_CREDENTIALS = 0x2
|
SCM_CREDENTIALS = 0x2
|
||||||
|
SCM_PIDFD = 0x4
|
||||||
SCM_RIGHTS = 0x1
|
SCM_RIGHTS = 0x1
|
||||||
|
SCM_SECURITY = 0x3
|
||||||
SCM_TIMESTAMP = 0x1d
|
SCM_TIMESTAMP = 0x1d
|
||||||
SC_LOG_FLUSH = 0x100000
|
SC_LOG_FLUSH = 0x100000
|
||||||
SECCOMP_ADDFD_FLAG_SEND = 0x2
|
SECCOMP_ADDFD_FLAG_SEND = 0x2
|
||||||
@@ -3051,6 +3062,8 @@ const (
|
|||||||
SIOCSMIIREG = 0x8949
|
SIOCSMIIREG = 0x8949
|
||||||
SIOCSRARP = 0x8962
|
SIOCSRARP = 0x8962
|
||||||
SIOCWANDEV = 0x894a
|
SIOCWANDEV = 0x894a
|
||||||
|
SK_DIAG_BPF_STORAGE_MAX = 0x3
|
||||||
|
SK_DIAG_BPF_STORAGE_REQ_MAX = 0x1
|
||||||
SMACK_MAGIC = 0x43415d53
|
SMACK_MAGIC = 0x43415d53
|
||||||
SMART_AUTOSAVE = 0xd2
|
SMART_AUTOSAVE = 0xd2
|
||||||
SMART_AUTO_OFFLINE = 0xdb
|
SMART_AUTO_OFFLINE = 0xdb
|
||||||
@@ -3071,6 +3084,8 @@ const (
|
|||||||
SOCKFS_MAGIC = 0x534f434b
|
SOCKFS_MAGIC = 0x534f434b
|
||||||
SOCK_BUF_LOCK_MASK = 0x3
|
SOCK_BUF_LOCK_MASK = 0x3
|
||||||
SOCK_DCCP = 0x6
|
SOCK_DCCP = 0x6
|
||||||
|
SOCK_DESTROY = 0x15
|
||||||
|
SOCK_DIAG_BY_FAMILY = 0x14
|
||||||
SOCK_IOC_TYPE = 0x89
|
SOCK_IOC_TYPE = 0x89
|
||||||
SOCK_PACKET = 0xa
|
SOCK_PACKET = 0xa
|
||||||
SOCK_RAW = 0x3
|
SOCK_RAW = 0x3
|
||||||
@@ -3260,6 +3275,7 @@ const (
|
|||||||
TCP_MAX_WINSHIFT = 0xe
|
TCP_MAX_WINSHIFT = 0xe
|
||||||
TCP_MD5SIG = 0xe
|
TCP_MD5SIG = 0xe
|
||||||
TCP_MD5SIG_EXT = 0x20
|
TCP_MD5SIG_EXT = 0x20
|
||||||
|
TCP_MD5SIG_FLAG_IFINDEX = 0x2
|
||||||
TCP_MD5SIG_FLAG_PREFIX = 0x1
|
TCP_MD5SIG_FLAG_PREFIX = 0x1
|
||||||
TCP_MD5SIG_MAXKEYLEN = 0x50
|
TCP_MD5SIG_MAXKEYLEN = 0x50
|
||||||
TCP_MSS = 0x200
|
TCP_MSS = 0x200
|
||||||
|
|||||||
1
vendor/golang.org/x/sys/unix/zerrors_linux_386.go
generated
vendored
1
vendor/golang.org/x/sys/unix/zerrors_linux_386.go
generated
vendored
@@ -118,6 +118,7 @@ const (
|
|||||||
IXOFF = 0x1000
|
IXOFF = 0x1000
|
||||||
IXON = 0x400
|
IXON = 0x400
|
||||||
MAP_32BIT = 0x40
|
MAP_32BIT = 0x40
|
||||||
|
MAP_ABOVE4G = 0x80
|
||||||
MAP_ANON = 0x20
|
MAP_ANON = 0x20
|
||||||
MAP_ANONYMOUS = 0x20
|
MAP_ANONYMOUS = 0x20
|
||||||
MAP_DENYWRITE = 0x800
|
MAP_DENYWRITE = 0x800
|
||||||
|
|||||||
1
vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go
generated
vendored
1
vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go
generated
vendored
@@ -118,6 +118,7 @@ const (
|
|||||||
IXOFF = 0x1000
|
IXOFF = 0x1000
|
||||||
IXON = 0x400
|
IXON = 0x400
|
||||||
MAP_32BIT = 0x40
|
MAP_32BIT = 0x40
|
||||||
|
MAP_ABOVE4G = 0x80
|
||||||
MAP_ANON = 0x20
|
MAP_ANON = 0x20
|
||||||
MAP_ANONYMOUS = 0x20
|
MAP_ANONYMOUS = 0x20
|
||||||
MAP_DENYWRITE = 0x800
|
MAP_DENYWRITE = 0x800
|
||||||
|
|||||||
1
vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go
generated
vendored
1
vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go
generated
vendored
@@ -87,6 +87,7 @@ const (
|
|||||||
FICLONE = 0x40049409
|
FICLONE = 0x40049409
|
||||||
FICLONERANGE = 0x4020940d
|
FICLONERANGE = 0x4020940d
|
||||||
FLUSHO = 0x1000
|
FLUSHO = 0x1000
|
||||||
|
FPMR_MAGIC = 0x46504d52
|
||||||
FPSIMD_MAGIC = 0x46508001
|
FPSIMD_MAGIC = 0x46508001
|
||||||
FS_IOC_ENABLE_VERITY = 0x40806685
|
FS_IOC_ENABLE_VERITY = 0x40806685
|
||||||
FS_IOC_GETFLAGS = 0x80086601
|
FS_IOC_GETFLAGS = 0x80086601
|
||||||
|
|||||||
37
vendor/golang.org/x/sys/unix/ztypes_linux.go
generated
vendored
37
vendor/golang.org/x/sys/unix/ztypes_linux.go
generated
vendored
@@ -4605,7 +4605,7 @@ const (
|
|||||||
NL80211_ATTR_MAC_HINT = 0xc8
|
NL80211_ATTR_MAC_HINT = 0xc8
|
||||||
NL80211_ATTR_MAC_MASK = 0xd7
|
NL80211_ATTR_MAC_MASK = 0xd7
|
||||||
NL80211_ATTR_MAX_AP_ASSOC_STA = 0xca
|
NL80211_ATTR_MAX_AP_ASSOC_STA = 0xca
|
||||||
NL80211_ATTR_MAX = 0x149
|
NL80211_ATTR_MAX = 0x14a
|
||||||
NL80211_ATTR_MAX_CRIT_PROT_DURATION = 0xb4
|
NL80211_ATTR_MAX_CRIT_PROT_DURATION = 0xb4
|
||||||
NL80211_ATTR_MAX_CSA_COUNTERS = 0xce
|
NL80211_ATTR_MAX_CSA_COUNTERS = 0xce
|
||||||
NL80211_ATTR_MAX_MATCH_SETS = 0x85
|
NL80211_ATTR_MAX_MATCH_SETS = 0x85
|
||||||
@@ -5209,7 +5209,7 @@ const (
|
|||||||
NL80211_FREQUENCY_ATTR_GO_CONCURRENT = 0xf
|
NL80211_FREQUENCY_ATTR_GO_CONCURRENT = 0xf
|
||||||
NL80211_FREQUENCY_ATTR_INDOOR_ONLY = 0xe
|
NL80211_FREQUENCY_ATTR_INDOOR_ONLY = 0xe
|
||||||
NL80211_FREQUENCY_ATTR_IR_CONCURRENT = 0xf
|
NL80211_FREQUENCY_ATTR_IR_CONCURRENT = 0xf
|
||||||
NL80211_FREQUENCY_ATTR_MAX = 0x1f
|
NL80211_FREQUENCY_ATTR_MAX = 0x20
|
||||||
NL80211_FREQUENCY_ATTR_MAX_TX_POWER = 0x6
|
NL80211_FREQUENCY_ATTR_MAX_TX_POWER = 0x6
|
||||||
NL80211_FREQUENCY_ATTR_NO_10MHZ = 0x11
|
NL80211_FREQUENCY_ATTR_NO_10MHZ = 0x11
|
||||||
NL80211_FREQUENCY_ATTR_NO_160MHZ = 0xc
|
NL80211_FREQUENCY_ATTR_NO_160MHZ = 0xc
|
||||||
@@ -5703,7 +5703,7 @@ const (
|
|||||||
NL80211_STA_FLAG_ASSOCIATED = 0x7
|
NL80211_STA_FLAG_ASSOCIATED = 0x7
|
||||||
NL80211_STA_FLAG_AUTHENTICATED = 0x5
|
NL80211_STA_FLAG_AUTHENTICATED = 0x5
|
||||||
NL80211_STA_FLAG_AUTHORIZED = 0x1
|
NL80211_STA_FLAG_AUTHORIZED = 0x1
|
||||||
NL80211_STA_FLAG_MAX = 0x7
|
NL80211_STA_FLAG_MAX = 0x8
|
||||||
NL80211_STA_FLAG_MAX_OLD_API = 0x6
|
NL80211_STA_FLAG_MAX_OLD_API = 0x6
|
||||||
NL80211_STA_FLAG_MFP = 0x4
|
NL80211_STA_FLAG_MFP = 0x4
|
||||||
NL80211_STA_FLAG_SHORT_PREAMBLE = 0x2
|
NL80211_STA_FLAG_SHORT_PREAMBLE = 0x2
|
||||||
@@ -6001,3 +6001,34 @@ type CachestatRange struct {
|
|||||||
Off uint64
|
Off uint64
|
||||||
Len uint64
|
Len uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
SK_MEMINFO_RMEM_ALLOC = 0x0
|
||||||
|
SK_MEMINFO_RCVBUF = 0x1
|
||||||
|
SK_MEMINFO_WMEM_ALLOC = 0x2
|
||||||
|
SK_MEMINFO_SNDBUF = 0x3
|
||||||
|
SK_MEMINFO_FWD_ALLOC = 0x4
|
||||||
|
SK_MEMINFO_WMEM_QUEUED = 0x5
|
||||||
|
SK_MEMINFO_OPTMEM = 0x6
|
||||||
|
SK_MEMINFO_BACKLOG = 0x7
|
||||||
|
SK_MEMINFO_DROPS = 0x8
|
||||||
|
SK_MEMINFO_VARS = 0x9
|
||||||
|
SKNLGRP_NONE = 0x0
|
||||||
|
SKNLGRP_INET_TCP_DESTROY = 0x1
|
||||||
|
SKNLGRP_INET_UDP_DESTROY = 0x2
|
||||||
|
SKNLGRP_INET6_TCP_DESTROY = 0x3
|
||||||
|
SKNLGRP_INET6_UDP_DESTROY = 0x4
|
||||||
|
SK_DIAG_BPF_STORAGE_REQ_NONE = 0x0
|
||||||
|
SK_DIAG_BPF_STORAGE_REQ_MAP_FD = 0x1
|
||||||
|
SK_DIAG_BPF_STORAGE_REP_NONE = 0x0
|
||||||
|
SK_DIAG_BPF_STORAGE = 0x1
|
||||||
|
SK_DIAG_BPF_STORAGE_NONE = 0x0
|
||||||
|
SK_DIAG_BPF_STORAGE_PAD = 0x1
|
||||||
|
SK_DIAG_BPF_STORAGE_MAP_ID = 0x2
|
||||||
|
SK_DIAG_BPF_STORAGE_MAP_VALUE = 0x3
|
||||||
|
)
|
||||||
|
|
||||||
|
type SockDiagReq struct {
|
||||||
|
Family uint8
|
||||||
|
Protocol uint8
|
||||||
|
}
|
||||||
|
|||||||
1
vendor/golang.org/x/sys/windows/security_windows.go
generated
vendored
1
vendor/golang.org/x/sys/windows/security_windows.go
generated
vendored
@@ -68,6 +68,7 @@ type UserInfo10 struct {
|
|||||||
//sys NetUserGetInfo(serverName *uint16, userName *uint16, level uint32, buf **byte) (neterr error) = netapi32.NetUserGetInfo
|
//sys NetUserGetInfo(serverName *uint16, userName *uint16, level uint32, buf **byte) (neterr error) = netapi32.NetUserGetInfo
|
||||||
//sys NetGetJoinInformation(server *uint16, name **uint16, bufType *uint32) (neterr error) = netapi32.NetGetJoinInformation
|
//sys NetGetJoinInformation(server *uint16, name **uint16, bufType *uint32) (neterr error) = netapi32.NetGetJoinInformation
|
||||||
//sys NetApiBufferFree(buf *byte) (neterr error) = netapi32.NetApiBufferFree
|
//sys NetApiBufferFree(buf *byte) (neterr error) = netapi32.NetApiBufferFree
|
||||||
|
//sys NetUserEnum(serverName *uint16, level uint32, filter uint32, buf **byte, prefMaxLen uint32, entriesRead *uint32, totalEntries *uint32, resumeHandle *uint32) (neterr error) = netapi32.NetUserEnum
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// do not reorder
|
// do not reorder
|
||||||
|
|||||||
9
vendor/golang.org/x/sys/windows/zsyscall_windows.go
generated
vendored
9
vendor/golang.org/x/sys/windows/zsyscall_windows.go
generated
vendored
@@ -401,6 +401,7 @@ var (
|
|||||||
procTransmitFile = modmswsock.NewProc("TransmitFile")
|
procTransmitFile = modmswsock.NewProc("TransmitFile")
|
||||||
procNetApiBufferFree = modnetapi32.NewProc("NetApiBufferFree")
|
procNetApiBufferFree = modnetapi32.NewProc("NetApiBufferFree")
|
||||||
procNetGetJoinInformation = modnetapi32.NewProc("NetGetJoinInformation")
|
procNetGetJoinInformation = modnetapi32.NewProc("NetGetJoinInformation")
|
||||||
|
procNetUserEnum = modnetapi32.NewProc("NetUserEnum")
|
||||||
procNetUserGetInfo = modnetapi32.NewProc("NetUserGetInfo")
|
procNetUserGetInfo = modnetapi32.NewProc("NetUserGetInfo")
|
||||||
procNtCreateFile = modntdll.NewProc("NtCreateFile")
|
procNtCreateFile = modntdll.NewProc("NtCreateFile")
|
||||||
procNtCreateNamedPipeFile = modntdll.NewProc("NtCreateNamedPipeFile")
|
procNtCreateNamedPipeFile = modntdll.NewProc("NtCreateNamedPipeFile")
|
||||||
@@ -3486,6 +3487,14 @@ func NetGetJoinInformation(server *uint16, name **uint16, bufType *uint32) (nete
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func NetUserEnum(serverName *uint16, level uint32, filter uint32, buf **byte, prefMaxLen uint32, entriesRead *uint32, totalEntries *uint32, resumeHandle *uint32) (neterr error) {
|
||||||
|
r0, _, _ := syscall.Syscall9(procNetUserEnum.Addr(), 8, uintptr(unsafe.Pointer(serverName)), uintptr(level), uintptr(filter), uintptr(unsafe.Pointer(buf)), uintptr(prefMaxLen), uintptr(unsafe.Pointer(entriesRead)), uintptr(unsafe.Pointer(totalEntries)), uintptr(unsafe.Pointer(resumeHandle)), 0)
|
||||||
|
if r0 != 0 {
|
||||||
|
neterr = syscall.Errno(r0)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func NetUserGetInfo(serverName *uint16, userName *uint16, level uint32, buf **byte) (neterr error) {
|
func NetUserGetInfo(serverName *uint16, userName *uint16, level uint32, buf **byte) (neterr error) {
|
||||||
r0, _, _ := syscall.Syscall6(procNetUserGetInfo.Addr(), 4, uintptr(unsafe.Pointer(serverName)), uintptr(unsafe.Pointer(userName)), uintptr(level), uintptr(unsafe.Pointer(buf)), 0, 0)
|
r0, _, _ := syscall.Syscall6(procNetUserGetInfo.Addr(), 4, uintptr(unsafe.Pointer(serverName)), uintptr(unsafe.Pointer(userName)), uintptr(level), uintptr(unsafe.Pointer(buf)), 0, 0)
|
||||||
if r0 != 0 {
|
if r0 != 0 {
|
||||||
|
|||||||
16
vendor/modules.txt
vendored
16
vendor/modules.txt
vendored
@@ -7,8 +7,8 @@ github.com/cespare/xxhash/v2
|
|||||||
# github.com/davecgh/go-spew v1.1.1
|
# github.com/davecgh/go-spew v1.1.1
|
||||||
## explicit
|
## explicit
|
||||||
github.com/davecgh/go-spew/spew
|
github.com/davecgh/go-spew/spew
|
||||||
# github.com/didip/tollbooth/v7 v7.0.1
|
# github.com/didip/tollbooth/v7 v7.0.2
|
||||||
## explicit; go 1.12
|
## explicit; go 1.19
|
||||||
github.com/didip/tollbooth/v7
|
github.com/didip/tollbooth/v7
|
||||||
github.com/didip/tollbooth/v7/errors
|
github.com/didip/tollbooth/v7/errors
|
||||||
github.com/didip/tollbooth/v7/internal/time/rate
|
github.com/didip/tollbooth/v7/internal/time/rate
|
||||||
@@ -17,9 +17,9 @@ github.com/didip/tollbooth/v7/limiter
|
|||||||
# github.com/felixge/httpsnoop v1.0.4
|
# github.com/felixge/httpsnoop v1.0.4
|
||||||
## explicit; go 1.13
|
## explicit; go 1.13
|
||||||
github.com/felixge/httpsnoop
|
github.com/felixge/httpsnoop
|
||||||
# github.com/go-pkgz/expirable-cache v1.0.0
|
# github.com/go-pkgz/expirable-cache/v3 v3.0.0
|
||||||
## explicit; go 1.14
|
## explicit; go 1.20
|
||||||
github.com/go-pkgz/expirable-cache
|
github.com/go-pkgz/expirable-cache/v3
|
||||||
# github.com/go-pkgz/lgr v0.11.1
|
# github.com/go-pkgz/lgr v0.11.1
|
||||||
## explicit; go 1.20
|
## explicit; go 1.20
|
||||||
github.com/go-pkgz/lgr
|
github.com/go-pkgz/lgr
|
||||||
@@ -65,7 +65,7 @@ github.com/stretchr/testify/require
|
|||||||
# github.com/umputun/go-flags v1.5.1
|
# github.com/umputun/go-flags v1.5.1
|
||||||
## explicit; go 1.12
|
## explicit; go 1.12
|
||||||
github.com/umputun/go-flags
|
github.com/umputun/go-flags
|
||||||
# golang.org/x/crypto v0.23.0
|
# golang.org/x/crypto v0.24.0
|
||||||
## explicit; go 1.18
|
## 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
|
||||||
@@ -74,11 +74,11 @@ golang.org/x/crypto/blowfish
|
|||||||
# golang.org/x/net v0.25.0
|
# golang.org/x/net v0.25.0
|
||||||
## explicit; go 1.18
|
## explicit; go 1.18
|
||||||
golang.org/x/net/idna
|
golang.org/x/net/idna
|
||||||
# golang.org/x/sys v0.20.0
|
# golang.org/x/sys v0.21.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.15.0
|
# golang.org/x/text v0.16.0
|
||||||
## explicit; go 1.18
|
## 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
|
||||||
|
|||||||
Reference in New Issue
Block a user