Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
17204a337f | ||
|
|
c6fb4b13c1 |
No files matched your search
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -64,7 +64,7 @@ require (
|
||||
github.com/open-policy-agent/opa v1.12.3
|
||||
github.com/orcaman/concurrent-map v1.0.0
|
||||
github.com/owncloud/libre-graph-api-go v1.0.5-0.20260216101009-eeac018af245
|
||||
github.com/owncloud/reva/v2 v2.0.0-20260521135517-5cf6fa2c7dbf
|
||||
github.com/owncloud/reva/v2 v2.0.0-20260611130633-a2630d5932c4
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/pkg/xattr v0.4.12
|
||||
github.com/prometheus/client_golang v1.23.2
|
||||
@@ -87,7 +87,7 @@ require (
|
||||
go-micro.dev/v4 v4.11.0
|
||||
go.etcd.io/bbolt v1.4.3
|
||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.68.0
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.66.0
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.67.0
|
||||
go.opentelemetry.io/contrib/zpages v0.64.0
|
||||
go.opentelemetry.io/otel v1.43.0
|
||||
go.opentelemetry.io/otel/exporters/jaeger v1.17.0
|
||||
@@ -180,13 +180,13 @@ require (
|
||||
github.com/felixge/httpsnoop v1.0.4 // indirect
|
||||
github.com/fsnotify/fsnotify v1.9.0 // indirect
|
||||
github.com/gdexlab/go-render v1.0.1 // indirect
|
||||
github.com/go-acme/lego/v4 v4.25.2 // indirect
|
||||
github.com/go-acme/lego/v4 v4.34.0 // indirect
|
||||
github.com/go-asn1-ber/asn1-ber v1.5.8-0.20250403174932-29230038a667 // indirect
|
||||
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
|
||||
github.com/go-git/go-billy/v5 v5.9.0 // indirect
|
||||
github.com/go-git/go-git/v5 v5.19.1 // indirect
|
||||
github.com/go-ini/ini v1.67.0 // indirect
|
||||
github.com/go-jose/go-jose/v3 v3.0.4 // indirect
|
||||
github.com/go-jose/go-jose/v3 v3.0.5 // indirect
|
||||
github.com/go-jose/go-jose/v4 v4.1.4 // indirect
|
||||
github.com/go-kit/log v0.2.1 // indirect
|
||||
github.com/go-logfmt/logfmt v0.5.1 // indirect
|
||||
@@ -198,7 +198,7 @@ require (
|
||||
github.com/go-playground/locales v0.14.1 // indirect
|
||||
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||
github.com/go-redis/redis/v8 v8.11.5 // indirect
|
||||
github.com/go-resty/resty/v2 v2.16.5 // indirect
|
||||
github.com/go-resty/resty/v2 v2.17.2 // indirect
|
||||
github.com/go-sql-driver/mysql v1.10.0 // indirect
|
||||
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
|
||||
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
|
||||
@@ -209,14 +209,14 @@ require (
|
||||
github.com/gobwas/pool v0.2.1 // indirect
|
||||
github.com/gobwas/ws v1.2.1 // indirect
|
||||
github.com/goccy/go-json v0.10.5 // indirect
|
||||
github.com/goccy/go-yaml v1.18.0 // indirect
|
||||
github.com/goccy/go-yaml v1.19.2 // indirect
|
||||
github.com/gofrs/flock v0.13.0 // indirect
|
||||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
github.com/golang-jwt/jwt/v4 v4.5.2 // indirect
|
||||
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect
|
||||
github.com/golang/snappy v0.0.4 // indirect
|
||||
github.com/gomodule/redigo v1.9.3 // indirect
|
||||
github.com/google/go-querystring v1.1.0 // indirect
|
||||
github.com/google/go-querystring v1.2.0 // indirect
|
||||
github.com/google/go-tpm v0.9.8 // indirect
|
||||
github.com/google/pprof v0.0.0-20260402051712-545e8a4df936 // indirect
|
||||
github.com/google/renameio/v2 v2.0.2 // indirect
|
||||
@@ -234,7 +234,7 @@ require (
|
||||
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
|
||||
github.com/jmespath/go-jmespath v0.4.0 // indirect
|
||||
github.com/jonboulle/clockwork v0.5.0 // indirect
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/json-iterator/go v1.1.13-0.20220915233716-71ac16282d12 // indirect
|
||||
github.com/juliangruber/go-intersect v1.1.0 // indirect
|
||||
github.com/kevinburke/ssh_config v1.2.0 // indirect
|
||||
github.com/klauspost/compress v1.18.5 // indirect
|
||||
@@ -256,12 +256,12 @@ require (
|
||||
github.com/longsleep/rndm v1.2.0 // indirect
|
||||
github.com/mattermost/xml-roundtrip-validator v0.1.0 // indirect
|
||||
github.com/mattn/go-colorable v0.1.14 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/mattn/go-isatty v0.0.21 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.16 // indirect
|
||||
github.com/mattn/go-sqlite3 v1.14.44 // indirect
|
||||
github.com/maxymania/go-system v0.0.0-20170110133659-647cc364bf0b // indirect
|
||||
github.com/mendsley/gojwk v0.0.0-20141217222730-4d5ec6e58103 // indirect
|
||||
github.com/miekg/dns v1.1.68 // indirect
|
||||
github.com/miekg/dns v1.1.72 // indirect
|
||||
github.com/mileusna/useragent v1.3.5 // indirect
|
||||
github.com/minio/crc64nvme v1.1.1 // indirect
|
||||
github.com/minio/highwayhash v1.0.4 // indirect
|
||||
@@ -310,7 +310,7 @@ require (
|
||||
github.com/skeema/knownhosts v1.3.1 // indirect
|
||||
github.com/spacewander/go-suffix-tree v0.0.0-20191010040751-0865e368c784 // indirect
|
||||
github.com/spf13/pflag v1.0.10 // indirect
|
||||
github.com/stretchr/objx v0.5.2 // indirect
|
||||
github.com/stretchr/objx v0.5.3 // indirect
|
||||
github.com/studio-b12/gowebdav v0.9.0 // indirect
|
||||
github.com/tchap/go-patricia/v2 v2.3.3 // indirect
|
||||
github.com/tidwall/match v1.1.1 // indirect
|
||||
|
||||
@@ -279,8 +279,8 @@ github.com/gkampitakis/go-snaps v0.5.15 h1:amyJrvM1D33cPHwVrjo9jQxX8g/7E2wYdZ+01
|
||||
github.com/gkampitakis/go-snaps v0.5.15/go.mod h1:HNpx/9GoKisdhw9AFOBT1N7DBs9DiHo/hGheFGBZ+mc=
|
||||
github.com/gliderlabs/ssh v0.3.8 h1:a4YXD1V7xMF9g5nTkdfnja3Sxy1PVDCj1Zg4Wb8vY6c=
|
||||
github.com/gliderlabs/ssh v0.3.8/go.mod h1:xYoytBv1sV0aL3CavoDuJIQNURXkkfPA/wxQ1pL1fAU=
|
||||
github.com/go-acme/lego/v4 v4.25.2 h1:+D1Q+VnZrD+WJdlkgUEGHFFTcDrwGlE7q24IFtMmHDI=
|
||||
github.com/go-acme/lego/v4 v4.25.2/go.mod h1:OORYyVNZPaNdIdVYCGSBNRNZDIjhQbPuFxwGDgWj/yM=
|
||||
github.com/go-acme/lego/v4 v4.34.0 h1:oRsIuPJ4ORX7ufviXvelUpBSez2XxeKGwo5pNG9BVeY=
|
||||
github.com/go-acme/lego/v4 v4.34.0/go.mod h1:gsmdlx/ZS6OUeXbOj0U+VnCLLfEFj4WCYRkcGpZw+pc=
|
||||
github.com/go-asn1-ber/asn1-ber v1.3.1/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkProFKoKdwZRWMe0=
|
||||
github.com/go-asn1-ber/asn1-ber v1.4.1/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkProFKoKdwZRWMe0=
|
||||
github.com/go-asn1-ber/asn1-ber v1.5.8-0.20250403174932-29230038a667 h1:BP4M0CvQ4S3TGls2FvczZtj5Re/2ZzkV9VwqPHH/3Bo=
|
||||
@@ -303,8 +303,8 @@ github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2
|
||||
github.com/go-ini/ini v1.67.0 h1:z6ZrTEZqSWOTyH2FlglNbNgARyHG8oLW9gMELqKr06A=
|
||||
github.com/go-ini/ini v1.67.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8=
|
||||
github.com/go-jose/go-jose/v3 v3.0.3/go.mod h1:5b+7YgP7ZICgJDBdfjZaIt+H/9L9T/YQrVfLAMboGkQ=
|
||||
github.com/go-jose/go-jose/v3 v3.0.4 h1:Wp5HA7bLQcKnf6YYao/4kpRpVMp/yf6+pJKV8WFSaNY=
|
||||
github.com/go-jose/go-jose/v3 v3.0.4/go.mod h1:5b+7YgP7ZICgJDBdfjZaIt+H/9L9T/YQrVfLAMboGkQ=
|
||||
github.com/go-jose/go-jose/v3 v3.0.5 h1:BLLJWbC4nMZOfuPVxoZIxeYsn6Nl2r1fITaJ78UQlVQ=
|
||||
github.com/go-jose/go-jose/v3 v3.0.5/go.mod h1:5b+7YgP7ZICgJDBdfjZaIt+H/9L9T/YQrVfLAMboGkQ=
|
||||
github.com/go-jose/go-jose/v4 v4.1.4 h1:moDMcTHmvE6Groj34emNPLs/qtYXRVcd6S7NHbHz3kA=
|
||||
github.com/go-jose/go-jose/v4 v4.1.4/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08=
|
||||
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||
@@ -362,8 +362,8 @@ github.com/go-playground/validator/v10 v10.30.2 h1:JiFIMtSSHb2/XBUbWM4i/MpeQm9ZK
|
||||
github.com/go-playground/validator/v10 v10.30.2/go.mod h1:mAf2pIOVXjTEBrwUMGKkCWKKPs9NheYGabeB04txQSc=
|
||||
github.com/go-redis/redis/v8 v8.11.5 h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC0oI=
|
||||
github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo=
|
||||
github.com/go-resty/resty/v2 v2.16.5 h1:hBKqmWrr7uRc3euHVqmh1HTHcKn99Smr7o5spptdhTM=
|
||||
github.com/go-resty/resty/v2 v2.16.5/go.mod h1:hkJtXbA2iKHzJheXYvQ8snQES5ZLGKMwQ07xAwp/fiA=
|
||||
github.com/go-resty/resty/v2 v2.17.2 h1:FQW5oHYcIlkCNrMD2lloGScxcHJ0gkjshV3qcQAyHQk=
|
||||
github.com/go-resty/resty/v2 v2.17.2/go.mod h1:kCKZ3wWmwJaNc7S29BRtUhJwy7iqmn+2mLtQrOyQlVA=
|
||||
github.com/go-sql-driver/mysql v1.10.0 h1:Q+1LV8DkHJvSYAdR83XzuhDaTykuDx0l6fkXxoWCWfw=
|
||||
github.com/go-sql-driver/mysql v1.10.0/go.mod h1:M+cqaI7+xxXGG9swrdeUIoPG3Y3KCkF0pZej+SK+nWk=
|
||||
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
||||
@@ -386,8 +386,8 @@ github.com/gobwas/ws v1.2.1 h1:F2aeBZrm2NDsc7vbovKrWSogd4wvfAxg0FQ89/iqOTk=
|
||||
github.com/gobwas/ws v1.2.1/go.mod h1:hRKAFb8wOxFROYNsT1bqfWnhX+b5MFeJM9r2ZSwg/KY=
|
||||
github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4=
|
||||
github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
|
||||
github.com/goccy/go-yaml v1.18.0 h1:8W7wMFS12Pcas7KU+VVkaiCng+kG8QiFeFwzFb+rwuw=
|
||||
github.com/goccy/go-yaml v1.18.0/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA=
|
||||
github.com/goccy/go-yaml v1.19.2 h1:PmFC1S6h8ljIz6gMRBopkjP1TVT7xuwrButHID66PoM=
|
||||
github.com/goccy/go-yaml v1.19.2/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA=
|
||||
github.com/gofrs/flock v0.13.0 h1:95JolYOvGMqeH31+FC7D2+uULf6mG61mEZ/A8dRYMzw=
|
||||
github.com/gofrs/flock v0.13.0/go.mod h1:jxeyy9R1auM5S6JYDBhDt+E2TCo7DkratH4Pgi8P+Z0=
|
||||
github.com/gofrs/uuid v4.4.0+incompatible h1:3qXRTX8/NbyulANqlc0lchS1gqAVxRgsuW1YrTJupqA=
|
||||
@@ -451,7 +451,6 @@ github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
|
||||
github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
@@ -460,8 +459,8 @@ github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN
|
||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
||||
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
|
||||
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
|
||||
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
|
||||
github.com/google/go-querystring v1.2.0 h1:yhqkPbu2/OH+V9BfpCVPZkNmUXhb2gBxJArfhIxNtP0=
|
||||
github.com/google/go-querystring v1.2.0/go.mod h1:8IFJqpSRITyJ8QhQ13bmbeMBDfmeEJZD5A0egEOmkqU=
|
||||
github.com/google/go-tika v0.3.1 h1:l+jr10hDhZjcgxFRfcQChRLo1bPXQeLFluMyvDhXTTA=
|
||||
github.com/google/go-tika v0.3.1/go.mod h1:DJh5N8qxXIl85QkqmXknd+PeeRkUOTbvwyYf7ieDz6c=
|
||||
github.com/google/go-tpm v0.9.8 h1:slArAR9Ft+1ybZu0lBwpSmpwhRXaa85hWtMinMyRAWo=
|
||||
@@ -559,8 +558,9 @@ github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX
|
||||
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
|
||||
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||
github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
||||
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
|
||||
github.com/json-iterator/go v1.1.13-0.20220915233716-71ac16282d12 h1:9Nu54bhS/H/Kgo2/7xNSUuC5G28VR8ljfrLKU2G4IjU=
|
||||
github.com/json-iterator/go v1.1.13-0.20220915233716-71ac16282d12/go.mod h1:TBzl5BIHNXfS9+C35ZyJaklL7mLDbgUkcgXzSLa8Tk0=
|
||||
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
|
||||
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
|
||||
github.com/juliangruber/go-intersect v1.1.0 h1:sc+y5dCjMMx0pAdYk/N6KBm00tD/f3tq+Iox7dYDUrY=
|
||||
@@ -647,8 +647,8 @@ github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHP
|
||||
github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
|
||||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
|
||||
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.21 h1:xYae+lCNBP7QuW4PUnNG61ffM4hVIfm+zUzDuSzYLGs=
|
||||
github.com/mattn/go-isatty v0.0.21/go.mod h1:ZXfXG4SQHsB/w3ZeOYbR0PrPwLy+n6xiMrJlRFqopa4=
|
||||
github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc=
|
||||
github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
||||
github.com/mattn/go-sqlite3 v1.14.44 h1:3VSe+xafpbzsLbdr2AWlAZk9yRHiBhTBakioXaCKTF8=
|
||||
@@ -660,8 +660,8 @@ github.com/mendsley/gojwk v0.0.0-20141217222730-4d5ec6e58103 h1:Z/i1e+gTZrmcGeZy
|
||||
github.com/mendsley/gojwk v0.0.0-20141217222730-4d5ec6e58103/go.mod h1:o9YPB5aGP8ob35Vy6+vyq3P3bWe7NQWzf+JLiXCiMaE=
|
||||
github.com/mfridman/tparse v0.18.0 h1:wh6dzOKaIwkUGyKgOntDW4liXSo37qg5AXbIhkMV3vE=
|
||||
github.com/mfridman/tparse v0.18.0/go.mod h1:gEvqZTuCgEhPbYk/2lS3Kcxg1GmTxxU7kTC8DvP0i/A=
|
||||
github.com/miekg/dns v1.1.68 h1:jsSRkNozw7G/mnmXULynzMNIsgY2dHC8LO6U6Ij2JEA=
|
||||
github.com/miekg/dns v1.1.68/go.mod h1:fujopn7TB3Pu3JM69XaawiU0wqjpL9/8xGop5UrTPps=
|
||||
github.com/miekg/dns v1.1.72 h1:vhmr+TF2A3tuoGNkLDFK9zi36F2LS+hKTRW0Uf8kbzI=
|
||||
github.com/miekg/dns v1.1.72/go.mod h1:+EuEPhdHOsfk6Wk5TT2CzssZdqkmFhf8r+aVyDEToIs=
|
||||
github.com/mileusna/useragent v1.3.5 h1:SJM5NzBmh/hO+4LGeATKpaEX9+b4vcGg2qXGLiNGDws=
|
||||
github.com/mileusna/useragent v1.3.5/go.mod h1:3d8TOmwL/5I8pJjyVDteHtgDGcefrFUX4ccGOMKNYYc=
|
||||
github.com/minio/crc64nvme v1.1.1 h1:8dwx/Pz49suywbO+auHCBpCtlW1OfpcLN7wYgVR6wAI=
|
||||
@@ -737,8 +737,8 @@ github.com/orcaman/concurrent-map v1.0.0 h1:I/2A2XPCb4IuQWcQhBhSwGfiuybl/J0ev9HD
|
||||
github.com/orcaman/concurrent-map v1.0.0/go.mod h1:Lu3tH6HLW3feq74c2GC+jIMS/K2CFcDWnWD9XkenwhI=
|
||||
github.com/owncloud/libre-graph-api-go v1.0.5-0.20260216101009-eeac018af245 h1:JRidLTAKhnvyLMRtVtSF4lhBa0NSAOs6fof+d6JnKII=
|
||||
github.com/owncloud/libre-graph-api-go v1.0.5-0.20260216101009-eeac018af245/go.mod h1:z61VMGAJRtR1nbgXWiNoCkxUXP1B3Je9rMuJbnGd+Og=
|
||||
github.com/owncloud/reva/v2 v2.0.0-20260521135517-5cf6fa2c7dbf h1:VSRW0jZVcDrmwCwEoXZAIPQi3Agnes9uiNTdWGKjzKg=
|
||||
github.com/owncloud/reva/v2 v2.0.0-20260521135517-5cf6fa2c7dbf/go.mod h1:oHjvB9PhfF8QqiNGz7Hd4AVvR7CSPx3CLVRxUzmjK0w=
|
||||
github.com/owncloud/reva/v2 v2.0.0-20260611130633-a2630d5932c4 h1:fc0rwbPPYs83EZO9iAklZaZjXjdZ2nn/mmUgnP28u2U=
|
||||
github.com/owncloud/reva/v2 v2.0.0-20260611130633-a2630d5932c4/go.mod h1:oHjvB9PhfF8QqiNGz7Hd4AVvR7CSPx3CLVRxUzmjK0w=
|
||||
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c h1:rp5dCmg/yLR3mgFuSOe4oEnDDmGLROTvMragMUXpTQw=
|
||||
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c/go.mod h1:X07ZCGwUbLaax7L0S3Tw4hpejzu63ZrrQiUe6W0hcy0=
|
||||
github.com/pablodz/inotifywaitgo v0.0.9 h1:njquRbBU7fuwIe5rEvtaniVBjwWzcpdUVptSgzFqZsw=
|
||||
@@ -865,8 +865,8 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
|
||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
|
||||
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
|
||||
github.com/stretchr/objx v0.5.3 h1:jmXUvGomnU1o3W/V5h2VEradbpJDwGrzugQQvL0POH4=
|
||||
github.com/stretchr/objx v0.5.3/go.mod h1:rDQraq+vQZU7Fde9LOZLr8Tax6zZvy4kuNKF+QYS+U0=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
@@ -966,8 +966,8 @@ go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ
|
||||
go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=
|
||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.68.0 h1:0Qx7VGBacMm9ZENQ7TnNObTYI4ShC+lHI16seduaxZo=
|
||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.68.0/go.mod h1:Sje3i3MjSPKTSPvVWCaL8ugBzJwik3u4smCjUeuupqg=
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.66.0 h1:PnV4kVnw0zOmwwFkAzCN5O07fw1YOIQor120zrh0AVo=
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.66.0/go.mod h1:ofAwF4uinaf8SXdVzzbL4OsxJ3VfeEg3f/F6CeF49/Y=
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.67.0 h1:OyrsyzuttWTSur2qN/Lm0m2a8yqyIjUVBZcxFPuXq2o=
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.67.0/go.mod h1:C2NGBr+kAB4bk3xtMXfZ94gqFDtg/GkI7e9zqGh5Beg=
|
||||
go.opentelemetry.io/contrib/zpages v0.64.0 h1:iMybqKVR8AHHxFX4DuEWJ9dY75+9E7+IPwUK3Ll7NxM=
|
||||
go.opentelemetry.io/contrib/zpages v0.64.0/go.mod h1:DnkiyoQ7Yx/NmmKn10b6M2YBXreUqq0qhFa/kYgSZME=
|
||||
go.opentelemetry.io/otel v1.43.0 h1:mYIM03dnh5zfN7HautFE4ieIig9amkNANT+xcVxAj9I=
|
||||
@@ -1107,8 +1107,6 @@ golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
|
||||
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
|
||||
golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
|
||||
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
|
||||
golang.org/x/net v0.53.0 h1:d+qAbo5L0orcWAr0a9JweQpjXF19LMXJE8Ey7hwOdUA=
|
||||
golang.org/x/net v0.53.0/go.mod h1:JvMuJH7rrdiCfbeHoo3fCQU24Lf5JJwT9W3sJFulfgs=
|
||||
golang.org/x/net v0.55.0 h1:bcvxaJn3e1U6InsFWt1JUq1aSjnRxLzT2rtD2KfkDF8=
|
||||
golang.org/x/net v0.55.0/go.mod h1:L5U2KuzuOe1lY7Z+aWVIKK6qEeJXnXV9yzGA+WCHJww=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
@@ -1203,8 +1201,6 @@ golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
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/sys v0.44.0 h1:ildZl3J4uzeKP07r2F++Op7E9B29JRUy+a27EibtBTQ=
|
||||
golang.org/x/sys v0.44.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
|
||||
golang.org/x/sys v0.45.0 h1:dO4czNzziLiiXplLQgBCEpCvXQ3dnkn0SdaZSYdQ+FY=
|
||||
golang.org/x/sys v0.45.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
|
||||
golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE=
|
||||
|
||||
@@ -16,7 +16,7 @@ var (
|
||||
// LatestTag is the latest released version plus the dev meta version.
|
||||
// Will be overwritten by the release pipeline
|
||||
// Needs a manual change for every tagged release
|
||||
LatestTag = "8.0.0+dev"
|
||||
LatestTag = "8.1.0"
|
||||
|
||||
// Date indicates the build date.
|
||||
// This has been removed, it looks like you can only replace static strings with recent go versions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
sonar.projectKey=owncloud_ocis
|
||||
sonar.organization=owncloud-1
|
||||
sonar.projectName=ocis
|
||||
sonar.projectVersion=8.0.0+dev
|
||||
sonar.projectVersion=8.1.0
|
||||
sonar.host.url=https://sonarcloud.io
|
||||
|
||||
# =====================================================
|
||||
|
||||
+7
-5
@@ -77,13 +77,14 @@ type Meta struct {
|
||||
|
||||
// profiles (optional, object):
|
||||
// A map of profile names to human-readable descriptions of those profiles.
|
||||
// https://www.ietf.org/id/draft-aaron-acme-profiles-00.html#section-3
|
||||
// https://www.ietf.org/id/draft-ietf-acme-profiles-00.html#section-3
|
||||
Profiles map[string]string `json:"profiles"`
|
||||
}
|
||||
|
||||
// ExtendedAccount an extended Account.
|
||||
type ExtendedAccount struct {
|
||||
Account
|
||||
|
||||
// Contains the value of the response header `Location`
|
||||
Location string `json:"-"`
|
||||
}
|
||||
@@ -156,7 +157,7 @@ type Order struct {
|
||||
// profile (string, optional):
|
||||
// A string uniquely identifying the profile
|
||||
// which will be used to affect issuance of the certificate requested by this Order.
|
||||
// https://www.ietf.org/id/draft-aaron-acme-profiles-00.html#section-4
|
||||
// https://www.ietf.org/id/draft-ietf-acme-profiles-00.html#section-4
|
||||
Profile string `json:"profile,omitempty"`
|
||||
|
||||
// notBefore (optional, string):
|
||||
@@ -220,11 +221,11 @@ type Authorization struct {
|
||||
// The timestamp after which the server will consider this authorization invalid,
|
||||
// encoded in the format specified in RFC 3339 [RFC3339].
|
||||
// This field is REQUIRED for objects with "valid" in the "status" field.
|
||||
Expires time.Time `json:"expires,omitempty"`
|
||||
Expires time.Time `json:"expires,omitzero"`
|
||||
|
||||
// identifier (required, object):
|
||||
// The identifier that the account is authorized to represent
|
||||
Identifier Identifier `json:"identifier,omitempty"`
|
||||
Identifier Identifier `json:"identifier"`
|
||||
|
||||
// challenges (required, array of objects):
|
||||
// For pending authorizations, the challenges that the client can fulfill in order to prove possession of the identifier.
|
||||
@@ -244,6 +245,7 @@ type Authorization struct {
|
||||
// ExtendedChallenge a extended Challenge.
|
||||
type ExtendedChallenge struct {
|
||||
Challenge
|
||||
|
||||
// Contains the value of the response header `Retry-After`
|
||||
RetryAfter string `json:"-"`
|
||||
// Contains the value of the response header `Link` rel="up"
|
||||
@@ -270,7 +272,7 @@ type Challenge struct {
|
||||
// The time at which the server validated this challenge,
|
||||
// encoded in the format specified in RFC 3339 [RFC3339].
|
||||
// This field is REQUIRED if the "status" field is "valid".
|
||||
Validated time.Time `json:"validated,omitempty"`
|
||||
Validated time.Time `json:"validated,omitzero"`
|
||||
|
||||
// error (optional, object):
|
||||
// Error that occurred while the server was validating the challenge, if any,
|
||||
|
||||
+35
-8
@@ -2,6 +2,7 @@ package acme
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Errors types.
|
||||
@@ -9,6 +10,7 @@ const (
|
||||
errNS = "urn:ietf:params:acme:error:"
|
||||
BadNonceErr = errNS + "badNonce"
|
||||
AlreadyReplacedErr = errNS + "alreadyReplaced"
|
||||
RateLimitedErr = errNS + "rateLimited"
|
||||
)
|
||||
|
||||
// ProblemDetails the problem details object.
|
||||
@@ -27,21 +29,25 @@ type ProblemDetails struct {
|
||||
}
|
||||
|
||||
func (p *ProblemDetails) Error() string {
|
||||
msg := fmt.Sprintf("acme: error: %d", p.HTTPStatus)
|
||||
msg := new(strings.Builder)
|
||||
|
||||
_, _ = fmt.Fprintf(msg, "acme: error: %d", p.HTTPStatus)
|
||||
|
||||
if p.Method != "" || p.URL != "" {
|
||||
msg += fmt.Sprintf(" :: %s :: %s", p.Method, p.URL)
|
||||
_, _ = fmt.Fprintf(msg, " :: %s :: %s", p.Method, p.URL)
|
||||
}
|
||||
msg += fmt.Sprintf(" :: %s :: %s", p.Type, p.Detail)
|
||||
|
||||
_, _ = fmt.Fprintf(msg, " :: %s :: %s", p.Type, p.Detail)
|
||||
|
||||
for _, sub := range p.SubProblems {
|
||||
msg += fmt.Sprintf(", problem: %q :: %s", sub.Type, sub.Detail)
|
||||
_, _ = fmt.Fprintf(msg, ", problem: %q :: %s", sub.Type, sub.Detail)
|
||||
}
|
||||
|
||||
if p.Instance != "" {
|
||||
msg += ", url: " + p.Instance
|
||||
msg.WriteString(", url: " + p.Instance)
|
||||
}
|
||||
|
||||
return msg
|
||||
return msg.String()
|
||||
}
|
||||
|
||||
// SubProblem a "subproblems".
|
||||
@@ -49,7 +55,7 @@ func (p *ProblemDetails) Error() string {
|
||||
type SubProblem struct {
|
||||
Type string `json:"type,omitempty"`
|
||||
Detail string `json:"detail,omitempty"`
|
||||
Identifier Identifier `json:"identifier,omitempty"`
|
||||
Identifier Identifier `json:"identifier"`
|
||||
}
|
||||
|
||||
// NonceError represents the error which is returned
|
||||
@@ -58,9 +64,30 @@ type NonceError struct {
|
||||
*ProblemDetails
|
||||
}
|
||||
|
||||
func (e *NonceError) Unwrap() error {
|
||||
return e.ProblemDetails
|
||||
}
|
||||
|
||||
// AlreadyReplacedError represents the error which is returned
|
||||
// If the Server rejects the request because the identified certificate has already been marked as replaced.
|
||||
// if the Server rejects the request because the identified certificate has already been marked as replaced.
|
||||
// - https://www.rfc-editor.org/rfc/rfc9773.html#section-5
|
||||
type AlreadyReplacedError struct {
|
||||
*ProblemDetails
|
||||
}
|
||||
|
||||
func (e *AlreadyReplacedError) Unwrap() error {
|
||||
return e.ProblemDetails
|
||||
}
|
||||
|
||||
// RateLimitedError represents the error which is returned
|
||||
// if the server rejects the request because the client has exceeded the rate limit.
|
||||
// - https://www.rfc-editor.org/rfc/rfc8555.html#section-6.6
|
||||
type RateLimitedError struct {
|
||||
*ProblemDetails
|
||||
|
||||
RetryAfter string
|
||||
}
|
||||
|
||||
func (e *RateLimitedError) Unwrap() error {
|
||||
return e.ProblemDetails
|
||||
}
|
||||
+1
@@ -40,5 +40,6 @@ func GetTargetedDomain(authz acme.Authorization) string {
|
||||
if authz.Wildcard {
|
||||
return "*." + authz.Identifier.Value
|
||||
}
|
||||
|
||||
return authz.Identifier.Value
|
||||
}
|
||||
+9
-1
@@ -414,6 +414,9 @@ func (ctx ecKeyGenerator) genKey() ([]byte, rawHeader, error) {
|
||||
|
||||
// Decrypt the given payload and return the content encryption key.
|
||||
func (ctx ecDecrypterSigner) decryptKey(headers rawHeader, recipient *recipientInfo, generator keyGenerator) ([]byte, error) {
|
||||
if recipient == nil {
|
||||
return nil, errors.New("go-jose/go-jose: missing recipient")
|
||||
}
|
||||
epk, err := headers.getEPK()
|
||||
if err != nil {
|
||||
return nil, errors.New("go-jose/go-jose: invalid epk header")
|
||||
@@ -461,13 +464,18 @@ func (ctx ecDecrypterSigner) decryptKey(headers rawHeader, recipient *recipientI
|
||||
return nil, ErrUnsupportedAlgorithm
|
||||
}
|
||||
|
||||
encryptedKey := recipient.encryptedKey
|
||||
if len(encryptedKey) == 0 {
|
||||
return nil, errors.New("go-jose/go-jose: missing JWE Encrypted Key")
|
||||
}
|
||||
|
||||
key := deriveKey(string(algorithm), keySize)
|
||||
block, err := aes.NewCipher(key)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return josecipher.KeyUnwrap(block, recipient.encryptedKey)
|
||||
return josecipher.KeyUnwrap(block, encryptedKey)
|
||||
}
|
||||
|
||||
func (ctx edDecrypterSigner) signPayload(payload []byte, alg SignatureAlgorithm) (Signature, error) {
|
||||
|
||||
+9
-1
@@ -66,12 +66,20 @@ func KeyWrap(block cipher.Block, cek []byte) ([]byte, error) {
|
||||
}
|
||||
|
||||
// KeyUnwrap implements NIST key unwrapping; it unwraps a content encryption key (cek) with the given block cipher.
|
||||
//
|
||||
// https://datatracker.ietf.org/doc/html/rfc7518#section-4.4
|
||||
// https://datatracker.ietf.org/doc/html/rfc7518#section-4.6
|
||||
// https://datatracker.ietf.org/doc/html/rfc7518#section-4.8
|
||||
func KeyUnwrap(block cipher.Block, ciphertext []byte) ([]byte, error) {
|
||||
n := (len(ciphertext) / 8) - 1
|
||||
if n <= 0 {
|
||||
return nil, errors.New("go-jose/go-jose: JWE Encrypted Key too short")
|
||||
}
|
||||
|
||||
if len(ciphertext)%8 != 0 {
|
||||
return nil, errors.New("go-jose/go-jose: key wrap input must be 8 byte blocks")
|
||||
}
|
||||
|
||||
n := (len(ciphertext) / 8) - 1
|
||||
r := make([][]byte, n)
|
||||
|
||||
for i := range r {
|
||||
|
||||
+18
-8
@@ -364,11 +364,21 @@ func (ctx *symmetricKeyCipher) encryptKey(cek []byte, alg KeyAlgorithm) (recipie
|
||||
|
||||
// Decrypt the content encryption key.
|
||||
func (ctx *symmetricKeyCipher) decryptKey(headers rawHeader, recipient *recipientInfo, generator keyGenerator) ([]byte, error) {
|
||||
switch headers.getAlgorithm() {
|
||||
case DIRECT:
|
||||
cek := make([]byte, len(ctx.key))
|
||||
copy(cek, ctx.key)
|
||||
return cek, nil
|
||||
if recipient == nil {
|
||||
return nil, fmt.Errorf("go-jose/go-jose: missing recipient")
|
||||
}
|
||||
|
||||
alg := headers.getAlgorithm()
|
||||
if alg == DIRECT {
|
||||
return bytes.Clone(ctx.key), nil
|
||||
}
|
||||
|
||||
encryptedKey := recipient.encryptedKey
|
||||
if len(encryptedKey) == 0 {
|
||||
return nil, fmt.Errorf("go-jose/go-jose: missing JWE Encrypted Key")
|
||||
}
|
||||
|
||||
switch alg {
|
||||
case A128GCMKW, A192GCMKW, A256GCMKW:
|
||||
aead := newAESGCM(len(ctx.key))
|
||||
|
||||
@@ -383,7 +393,7 @@ func (ctx *symmetricKeyCipher) decryptKey(headers rawHeader, recipient *recipien
|
||||
|
||||
parts := &aeadParts{
|
||||
iv: iv.bytes(),
|
||||
ciphertext: recipient.encryptedKey,
|
||||
ciphertext: encryptedKey,
|
||||
tag: tag.bytes(),
|
||||
}
|
||||
|
||||
@@ -399,7 +409,7 @@ func (ctx *symmetricKeyCipher) decryptKey(headers rawHeader, recipient *recipien
|
||||
return nil, err
|
||||
}
|
||||
|
||||
cek, err := josecipher.KeyUnwrap(block, recipient.encryptedKey)
|
||||
cek, err := josecipher.KeyUnwrap(block, encryptedKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -440,7 +450,7 @@ func (ctx *symmetricKeyCipher) decryptKey(headers rawHeader, recipient *recipien
|
||||
return nil, err
|
||||
}
|
||||
|
||||
cek, err := josecipher.KeyUnwrap(block, recipient.encryptedKey)
|
||||
cek, err := josecipher.KeyUnwrap(block, encryptedKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
+3
-3
@@ -4,12 +4,12 @@
|
||||
<p align="center"><a href="#features">Features</a> section describes in detail about Resty capabilities</p>
|
||||
</p>
|
||||
<p align="center">
|
||||
<p align="center"><a href="https://github.com/go-resty/resty/actions/workflows/ci.yml?query=branch%3Av2"><img src="https://github.com/go-resty/resty/actions/workflows/ci.yml/badge.svg?branch=v2" alt="Build Status"></a> <a href="https://app.codecov.io/gh/go-resty/resty/tree/v2"><img src="https://codecov.io/gh/go-resty/resty/branch/v2/graph/badge.svg" alt="Code Coverage"></a> <a href="https://goreportcard.com/report/go-resty/resty"><img src="https://goreportcard.com/badge/go-resty/resty" alt="Go Report Card"></a> <a href="https://github.com/go-resty/resty/releases/latest"><img src="https://img.shields.io/badge/version-2.16.5-blue.svg" alt="Release Version"></a> <a href="https://pkg.go.dev/github.com/go-resty/resty/v2"><img src="https://pkg.go.dev/badge/github.com/go-resty/resty" alt="GoDoc"></a> <a href="LICENSE"><img src="https://img.shields.io/github/license/go-resty/resty.svg" alt="License"></a> <a href="https://github.com/avelino/awesome-go"><img src="https://awesome.re/mentioned-badge.svg" alt="Mentioned in Awesome Go"></a></p>
|
||||
<p align="center"><a href="https://github.com/go-resty/resty/actions/workflows/ci.yml?query=branch%3Av2"><img src="https://github.com/go-resty/resty/actions/workflows/ci.yml/badge.svg?branch=v2" alt="Build Status"></a> <a href="https://app.codecov.io/gh/go-resty/resty/tree/v2"><img src="https://codecov.io/gh/go-resty/resty/branch/v2/graph/badge.svg" alt="Code Coverage"></a> <a href="https://goreportcard.com/report/go-resty/resty"><img src="https://goreportcard.com/badge/go-resty/resty" alt="Go Report Card"></a> <a href="https://github.com/go-resty/resty/releases/latest"><img src="https://img.shields.io/badge/version-2.17.2-blue.svg" alt="Release Version"></a> <a href="https://pkg.go.dev/github.com/go-resty/resty/v2"><img src="https://pkg.go.dev/badge/github.com/go-resty/resty" alt="GoDoc"></a> <a href="LICENSE"><img src="https://img.shields.io/github/license/go-resty/resty.svg" alt="License"></a> <a href="https://github.com/avelino/awesome-go"><img src="https://awesome.re/mentioned-badge.svg" alt="Mentioned in Awesome Go"></a></p>
|
||||
</p>
|
||||
|
||||
## News
|
||||
|
||||
* v2.16.5 [released](https://github.com/go-resty/resty/releases/tag/v2.16.5) and tagged on Jan 22, 2025.
|
||||
* v2.17.2 [released](https://github.com/go-resty/resty/releases/tag/v2.17.2) and tagged on Feb 14, 2026.
|
||||
* v2.0.0 [released](https://github.com/go-resty/resty/releases/tag/v2.0.0) and tagged on Jul 16, 2019.
|
||||
* v1.12.0 [released](https://github.com/go-resty/resty/releases/tag/v1.12.0) and tagged on Feb 27, 2019.
|
||||
* v1.0 released and tagged on Sep 25, 2017. - Resty's first version was released on Sep 15, 2015 then it grew gradually as a very handy and helpful library. Its been a two years since first release. I'm very thankful to Resty users and its [contributors](https://github.com/go-resty/resty/graphs/contributors).
|
||||
@@ -83,7 +83,7 @@
|
||||
|
||||
#### Supported Go Versions
|
||||
|
||||
Recommended to use `go1.20` and above.
|
||||
Recommended to use `go1.23` and above.
|
||||
|
||||
Initially Resty started supporting `go modules` since `v1.10.0` release.
|
||||
|
||||
|
||||
+10
-2
@@ -57,7 +57,7 @@ func parseRequestURL(c *Client, r *Request) error {
|
||||
buf := acquireBuffer()
|
||||
defer releaseBuffer(buf)
|
||||
// search for the next or first opened curly bracket
|
||||
for curr := strings.Index(r.URL, "{"); curr == 0 || curr > prev; curr = prev + strings.Index(r.URL[prev:], "{") {
|
||||
for curr := strings.Index(r.URL, "{"); curr == 0 || curr >= prev; curr = prev + strings.Index(r.URL[prev:], "{") {
|
||||
// write everything from the previous position up to the current
|
||||
if curr > prev {
|
||||
buf.WriteString(r.URL[prev:curr])
|
||||
@@ -196,6 +196,10 @@ func parseRequestBody(c *Client, r *Request) error {
|
||||
}
|
||||
case len(c.FormData) > 0 || len(r.FormData) > 0: // Handling Form Data
|
||||
handleFormData(c, r)
|
||||
case r.Body == nil && r.bodyBuf == nil: // Handling Request body when nil body
|
||||
// Go http library omits Content-Length if body is nil; use http.NoBody to force it if SetContentLength is true
|
||||
r.Body = http.NoBody
|
||||
fallthrough
|
||||
case r.Body != nil: // Handling Request body
|
||||
handleContentType(c, r)
|
||||
|
||||
@@ -240,7 +244,7 @@ func createHTTPRequest(c *Client, r *Request) (err error) {
|
||||
r.RawRequest.Close = c.closeConnection
|
||||
|
||||
// Add headers into http request
|
||||
r.RawRequest.Header = r.Header
|
||||
r.RawRequest.Header = r.Header.Clone()
|
||||
|
||||
// Add cookies from client instance into http request
|
||||
for _, cookie := range c.Cookies {
|
||||
@@ -315,6 +319,7 @@ func createCurlCmd(c *Client, r *Request) (err error) {
|
||||
}
|
||||
*r.resultCurlCmd = buildCurlRequest(r.RawRequest, c.httpClient.Jar)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -496,6 +501,9 @@ func handleFormData(c *Client, r *Request) {
|
||||
}
|
||||
|
||||
func handleContentType(c *Client, r *Request) {
|
||||
if r.Body == http.NoBody {
|
||||
return
|
||||
}
|
||||
contentType := r.Header.Get(hdrContentTypeKey)
|
||||
if IsStringEmpty(contentType) {
|
||||
contentType = DetectContentType(r.Body)
|
||||
|
||||
+29
-10
@@ -897,24 +897,42 @@ func (r *Request) TraceInfo() TraceInfo {
|
||||
return TraceInfo{}
|
||||
}
|
||||
|
||||
ct.lock.RLock()
|
||||
defer ct.lock.RUnlock()
|
||||
|
||||
ti := TraceInfo{
|
||||
DNSLookup: ct.dnsDone.Sub(ct.dnsStart),
|
||||
TLSHandshake: ct.tlsHandshakeDone.Sub(ct.tlsHandshakeStart),
|
||||
ServerTime: ct.gotFirstResponseByte.Sub(ct.gotConn),
|
||||
DNSLookup: 0,
|
||||
TCPConnTime: 0,
|
||||
ServerTime: 0,
|
||||
IsConnReused: ct.gotConnInfo.Reused,
|
||||
IsConnWasIdle: ct.gotConnInfo.WasIdle,
|
||||
ConnIdleTime: ct.gotConnInfo.IdleTime,
|
||||
RequestAttempt: r.Attempt,
|
||||
}
|
||||
|
||||
// Calculate the total time accordingly,
|
||||
// when connection is reused
|
||||
if ct.gotConnInfo.Reused {
|
||||
ti.TotalTime = ct.endTime.Sub(ct.getConn)
|
||||
} else {
|
||||
ti.TotalTime = ct.endTime.Sub(ct.dnsStart)
|
||||
if !ct.dnsStart.IsZero() && !ct.dnsDone.IsZero() {
|
||||
ti.DNSLookup = ct.dnsDone.Sub(ct.dnsStart)
|
||||
}
|
||||
|
||||
if !ct.tlsHandshakeDone.IsZero() && !ct.tlsHandshakeStart.IsZero() {
|
||||
ti.TLSHandshake = ct.tlsHandshakeDone.Sub(ct.tlsHandshakeStart)
|
||||
}
|
||||
|
||||
if !ct.gotFirstResponseByte.IsZero() && !ct.gotConn.IsZero() {
|
||||
ti.ServerTime = ct.gotFirstResponseByte.Sub(ct.gotConn)
|
||||
}
|
||||
|
||||
// Calculate the total time accordingly when connection is reused,
|
||||
// and DNS start and get conn time may be zero if the request is invalid.
|
||||
// See issue #1016.
|
||||
requestStartTime := r.Time
|
||||
if ct.gotConnInfo.Reused && !ct.getConn.IsZero() {
|
||||
requestStartTime = ct.getConn
|
||||
} else if !ct.dnsStart.IsZero() {
|
||||
requestStartTime = ct.dnsStart
|
||||
}
|
||||
ti.TotalTime = ct.endTime.Sub(requestStartTime)
|
||||
|
||||
// Only calculate on successful connections
|
||||
if !ct.connectDone.IsZero() {
|
||||
ti.TCPConnTime = ct.connectDone.Sub(ct.dnsDone)
|
||||
@@ -1077,7 +1095,8 @@ type SRVRecord struct {
|
||||
|
||||
func (r *Request) fmtBodyString(sl int64) (body string) {
|
||||
body = "***** NO CONTENT *****"
|
||||
if !isPayloadSupported(r.Method, r.client.AllowGetMethodPayload) {
|
||||
if !isPayloadSupported(r.Method, r.client.AllowGetMethodPayload) ||
|
||||
r.Body == http.NoBody {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ import (
|
||||
)
|
||||
|
||||
// Version # of resty
|
||||
const Version = "2.16.5"
|
||||
const Version = "2.17.2"
|
||||
|
||||
// New method creates a new Resty client.
|
||||
func New() *Client {
|
||||
|
||||
+20
@@ -9,6 +9,7 @@ import (
|
||||
"crypto/tls"
|
||||
"net"
|
||||
"net/http/httptrace"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -70,6 +71,7 @@ type TraceInfo struct {
|
||||
// with the same naming for easy understanding. Plus additional insights
|
||||
// [Request].
|
||||
type clientTrace struct {
|
||||
lock sync.RWMutex
|
||||
getConn time.Time
|
||||
dnsStart time.Time
|
||||
dnsDone time.Time
|
||||
@@ -87,37 +89,55 @@ func (t *clientTrace) createContext(ctx context.Context) context.Context {
|
||||
ctx,
|
||||
&httptrace.ClientTrace{
|
||||
DNSStart: func(_ httptrace.DNSStartInfo) {
|
||||
t.lock.Lock()
|
||||
t.dnsStart = time.Now()
|
||||
t.lock.Unlock()
|
||||
},
|
||||
DNSDone: func(_ httptrace.DNSDoneInfo) {
|
||||
t.lock.Lock()
|
||||
t.dnsDone = time.Now()
|
||||
t.lock.Unlock()
|
||||
},
|
||||
ConnectStart: func(_, _ string) {
|
||||
t.lock.Lock()
|
||||
if t.dnsDone.IsZero() {
|
||||
t.dnsDone = time.Now()
|
||||
}
|
||||
if t.dnsStart.IsZero() {
|
||||
t.dnsStart = t.dnsDone
|
||||
}
|
||||
t.lock.Unlock()
|
||||
},
|
||||
ConnectDone: func(net, addr string, err error) {
|
||||
t.lock.Lock()
|
||||
t.connectDone = time.Now()
|
||||
t.lock.Unlock()
|
||||
},
|
||||
GetConn: func(_ string) {
|
||||
t.lock.Lock()
|
||||
t.getConn = time.Now()
|
||||
t.lock.Unlock()
|
||||
},
|
||||
GotConn: func(ci httptrace.GotConnInfo) {
|
||||
t.lock.Lock()
|
||||
t.gotConn = time.Now()
|
||||
t.gotConnInfo = ci
|
||||
t.lock.Unlock()
|
||||
},
|
||||
GotFirstResponseByte: func() {
|
||||
t.lock.Lock()
|
||||
t.gotFirstResponseByte = time.Now()
|
||||
t.lock.Unlock()
|
||||
},
|
||||
TLSHandshakeStart: func() {
|
||||
t.lock.Lock()
|
||||
t.tlsHandshakeStart = time.Now()
|
||||
t.lock.Unlock()
|
||||
},
|
||||
TLSHandshakeDone: func(_ tls.ConnectionState, _ error) {
|
||||
t.lock.Lock()
|
||||
t.tlsHandshakeDone = time.Now()
|
||||
t.lock.Unlock()
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
+16
-3
@@ -1450,16 +1450,25 @@ func (n *MappingValueNode) toString() string {
|
||||
}
|
||||
return fmt.Sprintf("%s%s: %s", space, n.Key.String(), value)
|
||||
} else if keyIndentLevel < valueIndentLevel && !n.IsFlowStyle {
|
||||
valueStr := n.Value.String()
|
||||
// For flow-style values indented on the next line, we need to add the proper indentation
|
||||
if m, ok := n.Value.(*MappingNode); ok && m.IsFlowStyle {
|
||||
valueIndent := strings.Repeat(" ", n.Value.GetToken().Position.Column-1)
|
||||
valueStr = valueIndent + valueStr
|
||||
} else if s, ok := n.Value.(*SequenceNode); ok && s.IsFlowStyle {
|
||||
valueIndent := strings.Repeat(" ", n.Value.GetToken().Position.Column-1)
|
||||
valueStr = valueIndent + valueStr
|
||||
}
|
||||
if keyComment != nil {
|
||||
return fmt.Sprintf(
|
||||
"%s%s: %s\n%s",
|
||||
space,
|
||||
n.Key.stringWithoutComment(),
|
||||
keyComment.String(),
|
||||
n.Value.String(),
|
||||
valueStr,
|
||||
)
|
||||
}
|
||||
return fmt.Sprintf("%s%s:\n%s", space, n.Key.String(), n.Value.String())
|
||||
return fmt.Sprintf("%s%s:\n%s", space, n.Key.String(), valueStr)
|
||||
} else if m, ok := n.Value.(*MappingNode); ok && (m.IsFlowStyle || len(m.Values) == 0) {
|
||||
return fmt.Sprintf("%s%s: %s", space, n.Key.String(), n.Value.String())
|
||||
} else if s, ok := n.Value.(*SequenceNode); ok && (s.IsFlowStyle || len(s.Values) == 0) {
|
||||
@@ -1614,7 +1623,11 @@ func (n *SequenceNode) flowStyleString() string {
|
||||
for _, value := range n.Values {
|
||||
values = append(values, value.String())
|
||||
}
|
||||
return fmt.Sprintf("[%s]", strings.Join(values, ", "))
|
||||
seqText := fmt.Sprintf("[%s]", strings.Join(values, ", "))
|
||||
if n.Comment != nil {
|
||||
return addCommentString(seqText, n.Comment)
|
||||
}
|
||||
return seqText
|
||||
}
|
||||
|
||||
func (n *SequenceNode) blockStyleString() string {
|
||||
|
||||
+21
-10
@@ -40,6 +40,7 @@ type Decoder struct {
|
||||
isResolvedReference bool
|
||||
validator StructValidator
|
||||
disallowUnknownField bool
|
||||
allowedFieldPrefixes []string
|
||||
allowDuplicateMapKey bool
|
||||
useOrderedMap bool
|
||||
useJSONUnmarshaler bool
|
||||
@@ -287,7 +288,9 @@ func (d *Decoder) addSequenceNodeCommentToMap(node *ast.SequenceNode) {
|
||||
texts = append(texts, comment.Token.Value)
|
||||
}
|
||||
if len(texts) != 0 {
|
||||
d.addCommentToMap(node.Values[0].GetPath(), HeadComment(texts...))
|
||||
if len(node.Values) != 0 {
|
||||
d.addCommentToMap(node.Values[0].GetPath(), HeadComment(texts...))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -462,8 +465,10 @@ func (d *Decoder) nodeToValue(ctx context.Context, node ast.Node) (any, error) {
|
||||
}
|
||||
return v.Interface(), nil
|
||||
}
|
||||
aliasName := n.Value.GetToken().Value
|
||||
return nil, errors.ErrSyntax(fmt.Sprintf("could not find alias %q", aliasName), n.Value.GetToken())
|
||||
if node, exists := d.anchorNodeMap[text]; exists {
|
||||
return d.nodeToValue(ctx, node)
|
||||
}
|
||||
return nil, errors.ErrSyntax(fmt.Sprintf("could not find alias %q", text), n.Value.GetToken())
|
||||
case *ast.LiteralNode:
|
||||
return n.Value.GetValue(), nil
|
||||
case *ast.MappingKeyNode:
|
||||
@@ -1446,12 +1451,21 @@ func (d *Decoder) decodeStruct(ctx context.Context, dst reflect.Value, src ast.N
|
||||
// Unknown fields are expected (they could be fields from the parent struct).
|
||||
if len(unknownFields) != 0 && d.disallowUnknownField && src.GetToken() != nil {
|
||||
for key, node := range unknownFields {
|
||||
return errors.ErrUnknownField(fmt.Sprintf(`unknown field "%s"`, key), node.GetToken())
|
||||
var ok bool
|
||||
for _, prefix := range d.allowedFieldPrefixes {
|
||||
if strings.HasPrefix(key, prefix) {
|
||||
ok = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !ok {
|
||||
return errors.ErrUnknownField(fmt.Sprintf(`unknown field "%s"`, key), node.GetToken())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if d.validator != nil {
|
||||
if err := d.validator.Struct(dst.Addr().Interface()); err != nil {
|
||||
if err := d.validator.Struct(dst.Interface()); err != nil {
|
||||
ev := reflect.ValueOf(err)
|
||||
if ev.Type().Kind() == reflect.Slice {
|
||||
for i := 0; i < ev.Len(); i++ {
|
||||
@@ -1740,14 +1754,11 @@ func (d *Decoder) decodeMap(ctx context.Context, dst reflect.Value, src ast.Node
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
keyVal, err := d.nodeToValue(ctx, key)
|
||||
keyVal, err := d.createDecodedNewValue(ctx, keyType, reflect.Value{}, key)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
k = reflect.ValueOf(keyVal)
|
||||
if k.IsValid() && k.Type().ConvertibleTo(keyType) {
|
||||
k = k.Convert(keyType)
|
||||
}
|
||||
k = keyVal
|
||||
}
|
||||
|
||||
if k.IsValid() {
|
||||
|
||||
+7
-1
@@ -712,9 +712,15 @@ func (e *Encoder) encodeMap(ctx context.Context, value reflect.Value, column int
|
||||
anchorNode.Value = encoded
|
||||
encoded = anchorNode
|
||||
}
|
||||
|
||||
kn, err := e.encodeValue(ctx, reflect.ValueOf(key), column)
|
||||
keyNode, ok := kn.(ast.MapKeyNode)
|
||||
if !ok || err != nil {
|
||||
keyNode = e.encodeString(fmt.Sprint(key), column)
|
||||
}
|
||||
node.Values = append(node.Values, ast.MappingValue(
|
||||
nil,
|
||||
e.encodeString(keyText, column),
|
||||
keyNode,
|
||||
encoded,
|
||||
))
|
||||
e.setSmartAnchor(vRef, keyText)
|
||||
|
||||
+5
-3
@@ -351,8 +351,9 @@ func (f *Formatter) formatMapping(n *ast.MappingNode) string {
|
||||
var ret string
|
||||
if n.IsFlowStyle {
|
||||
ret = f.origin(n.Start)
|
||||
} else {
|
||||
ret += f.formatCommentGroup(n.Comment)
|
||||
}
|
||||
ret += f.formatCommentGroup(n.Comment)
|
||||
for _, value := range n.Values {
|
||||
if value.CollectEntry != nil {
|
||||
ret += f.origin(value.CollectEntry)
|
||||
@@ -361,6 +362,7 @@ func (f *Formatter) formatMapping(n *ast.MappingNode) string {
|
||||
}
|
||||
if n.IsFlowStyle {
|
||||
ret += f.origin(n.End)
|
||||
ret += f.formatCommentGroup(n.Comment)
|
||||
}
|
||||
return ret
|
||||
}
|
||||
@@ -377,8 +379,7 @@ func (f *Formatter) formatSequence(n *ast.SequenceNode) string {
|
||||
var ret string
|
||||
if n.IsFlowStyle {
|
||||
ret = f.origin(n.Start)
|
||||
}
|
||||
if n.Comment != nil {
|
||||
} else {
|
||||
// add head comment.
|
||||
ret += f.formatCommentGroup(n.Comment)
|
||||
}
|
||||
@@ -387,6 +388,7 @@ func (f *Formatter) formatSequence(n *ast.SequenceNode) string {
|
||||
}
|
||||
if n.IsFlowStyle {
|
||||
ret += f.origin(n.End)
|
||||
ret += f.formatCommentGroup(n.Comment)
|
||||
}
|
||||
ret += f.formatCommentGroup(n.FootComment)
|
||||
return ret
|
||||
|
||||
+9
@@ -69,6 +69,15 @@ func DisallowUnknownField() DecodeOption {
|
||||
}
|
||||
}
|
||||
|
||||
// AllowFieldPrefixes, when paired with [DisallowUnknownField], allows fields
|
||||
// with the specified prefixes to bypass the unknown field check.
|
||||
func AllowFieldPrefixes(prefixes ...string) DecodeOption {
|
||||
return func(d *Decoder) error {
|
||||
d.allowedFieldPrefixes = append(d.allowedFieldPrefixes, prefixes...)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// AllowDuplicateMapKey ignore syntax error when mapping keys that are duplicates.
|
||||
func AllowDuplicateMapKey() DecodeOption {
|
||||
return func(d *Decoder) error {
|
||||
|
||||
+10
@@ -426,6 +426,11 @@ func (p *parser) parseFlowMap(ctx *context) (*ast.MappingNode, error) {
|
||||
if node.End == nil {
|
||||
return nil, errors.ErrSyntax("could not find flow mapping end token '}'", node.Start)
|
||||
}
|
||||
|
||||
// set line comment if exists. e.g.) } # comment
|
||||
if err := setLineComment(ctx, node, ctx.currentToken()); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ctx.goNext() // skip mapping end token.
|
||||
return node, nil
|
||||
}
|
||||
@@ -1066,6 +1071,11 @@ func (p *parser) parseFlowSequence(ctx *context) (*ast.SequenceNode, error) {
|
||||
if node.End == nil {
|
||||
return nil, errors.ErrSyntax("sequence end token ']' not found", node.Start)
|
||||
}
|
||||
|
||||
// set line comment if exists. e.g.) ] # comment
|
||||
if err := setLineComment(ctx, node, ctx.currentToken()); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ctx.goNext() // skip sequence end token.
|
||||
return node, nil
|
||||
}
|
||||
|
||||
+9
-1
@@ -258,6 +258,10 @@ func (p *Path) Filter(target, v interface{}) error {
|
||||
// FilterFile filter from ast.File by YAMLPath.
|
||||
func (p *Path) FilterFile(f *ast.File) (ast.Node, error) {
|
||||
for _, doc := range f.Docs {
|
||||
// For simplicity, directives cannot be the target of operations
|
||||
if doc.Body != nil && doc.Body.Type() == ast.DirectiveType {
|
||||
continue
|
||||
}
|
||||
node, err := p.FilterNode(doc.Body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -352,6 +356,10 @@ func (p *Path) ReplaceWithFile(dst *ast.File, src *ast.File) error {
|
||||
// ReplaceNode replace ast.File with ast.Node.
|
||||
func (p *Path) ReplaceWithNode(dst *ast.File, node ast.Node) error {
|
||||
for _, doc := range dst.Docs {
|
||||
// For simplicity, directives cannot be the target of operations
|
||||
if doc.Body != nil && doc.Body.Type() == ast.DirectiveType {
|
||||
continue
|
||||
}
|
||||
if node.Type() == ast.DocumentType {
|
||||
node = node.(*ast.DocumentNode).Body
|
||||
}
|
||||
@@ -364,7 +372,7 @@ func (p *Path) ReplaceWithNode(dst *ast.File, node ast.Node) error {
|
||||
|
||||
// AnnotateSource add annotation to passed source ( see section 5.1 in README.md ).
|
||||
func (p *Path) AnnotateSource(source []byte, colored bool) ([]byte, error) {
|
||||
file, err := parser.ParseBytes([]byte(source), 0)
|
||||
file, err := parser.ParseBytes(source, 0)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
+22
-2
@@ -777,6 +777,15 @@ func (s *Scanner) scanComment(ctx *Context) bool {
|
||||
func (s *Scanner) scanMultiLine(ctx *Context, c rune) error {
|
||||
state := ctx.getMultiLineState()
|
||||
ctx.addOriginBuf(c)
|
||||
// normalize CR and CRLF to LF
|
||||
if c == '\r' {
|
||||
if ctx.nextChar() == '\n' {
|
||||
ctx.addOriginBuf('\n')
|
||||
s.progress(ctx, 1)
|
||||
s.offset++
|
||||
}
|
||||
c = '\n'
|
||||
}
|
||||
if ctx.isEOS() {
|
||||
if s.isFirstCharAtLine && c == ' ' {
|
||||
state.addIndent(ctx, s.column)
|
||||
@@ -1148,14 +1157,25 @@ func (s *Scanner) scanMultiLineHeaderOption(ctx *Context) error {
|
||||
s.progress(ctx, 1) // skip '|' or '>' character
|
||||
|
||||
var progress int
|
||||
var crlf bool
|
||||
for idx, c := range ctx.src[ctx.idx:] {
|
||||
progress = idx
|
||||
ctx.addOriginBuf(c)
|
||||
if s.isNewLineChar(c) {
|
||||
nextIdx := ctx.idx + idx + 1
|
||||
if c == '\r' && nextIdx < len(ctx.src) && ctx.src[nextIdx] == '\n' {
|
||||
crlf = true
|
||||
continue // process \n in the next iteration
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
value := strings.TrimRight(ctx.source(ctx.idx, ctx.idx+progress), " ")
|
||||
endPos := ctx.idx + progress
|
||||
if crlf {
|
||||
// Exclude \r
|
||||
endPos = endPos - 1
|
||||
}
|
||||
value := strings.TrimRight(ctx.source(ctx.idx, endPos), " ")
|
||||
commentValueIndex := strings.Index(value, "#")
|
||||
opt := value
|
||||
if commentValueIndex > 0 {
|
||||
@@ -1189,7 +1209,7 @@ func (s *Scanner) scanMultiLineHeaderOption(ctx *Context) error {
|
||||
ctx.setFolded(s.lastDelimColumn, opt)
|
||||
}
|
||||
if commentIndex > 0 {
|
||||
comment := string(value[commentValueIndex+1:])
|
||||
comment := value[commentValueIndex+1:]
|
||||
s.offset += len(headerBuf)
|
||||
s.column += len(headerBuf)
|
||||
ctx.addToken(token.Comment(comment, string(ctx.obuf[len(headerBuf):]), s.pos()))
|
||||
|
||||
+31
@@ -324,3 +324,34 @@ func RegisterCustomUnmarshalerContext[T any](unmarshaler func(context.Context, *
|
||||
return unmarshaler(ctx, v.(*T), b)
|
||||
}
|
||||
}
|
||||
|
||||
// RawMessage is a raw encoded YAML value. It implements [BytesMarshaler] and
|
||||
// [BytesUnmarshaler] and can be used to delay YAML decoding or precompute a YAML
|
||||
// encoding.
|
||||
// It also implements [json.Marshaler] and [json.Unmarshaler].
|
||||
//
|
||||
// This is similar to [json.RawMessage] in the stdlib.
|
||||
type RawMessage []byte
|
||||
|
||||
func (m RawMessage) MarshalYAML() ([]byte, error) {
|
||||
if m == nil {
|
||||
return []byte("null"), nil
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func (m *RawMessage) UnmarshalYAML(dt []byte) error {
|
||||
if m == nil {
|
||||
return errors.New("yaml.RawMessage: UnmarshalYAML on nil pointer")
|
||||
}
|
||||
*m = append((*m)[0:0], dt...)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *RawMessage) UnmarshalJSON(b []byte) error {
|
||||
return m.UnmarshalYAML(b)
|
||||
}
|
||||
|
||||
func (m RawMessage) MarshalJSON() ([]byte, error) {
|
||||
return YAMLToJSON(m)
|
||||
}
|
||||
+39
-34
@@ -6,22 +6,21 @@
|
||||
//
|
||||
// As a simple example:
|
||||
//
|
||||
// type Options struct {
|
||||
// Query string `url:"q"`
|
||||
// ShowAll bool `url:"all"`
|
||||
// Page int `url:"page"`
|
||||
// }
|
||||
// type Options struct {
|
||||
// Query string `url:"q"`
|
||||
// ShowAll bool `url:"all"`
|
||||
// Page int `url:"page"`
|
||||
// }
|
||||
//
|
||||
// opt := Options{ "foo", true, 2 }
|
||||
// v, _ := query.Values(opt)
|
||||
// fmt.Print(v.Encode()) // will output: "q=foo&all=true&page=2"
|
||||
// opt := Options{ "foo", true, 2 }
|
||||
// v, _ := query.Values(opt)
|
||||
// fmt.Print(v.Encode()) // will output: "q=foo&all=true&page=2"
|
||||
//
|
||||
// The exact mapping between Go values and url.Values is described in the
|
||||
// documentation for the Values() function.
|
||||
package query
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"net/url"
|
||||
"reflect"
|
||||
@@ -47,8 +46,8 @@ type Encoder interface {
|
||||
//
|
||||
// Each exported struct field is encoded as a URL parameter unless
|
||||
//
|
||||
// - the field's tag is "-", or
|
||||
// - the field is empty and its tag specifies the "omitempty" option
|
||||
// - the field's tag is "-", or
|
||||
// - the field is empty and its tag specifies the "omitempty" option
|
||||
//
|
||||
// The empty values are false, 0, any nil pointer or interface value, any array
|
||||
// slice, map, or string of length zero, and any type (such as time.Time) that
|
||||
@@ -59,19 +58,19 @@ type Encoder interface {
|
||||
// field's tag value is the key name, followed by an optional comma and
|
||||
// options. For example:
|
||||
//
|
||||
// // Field is ignored by this package.
|
||||
// Field int `url:"-"`
|
||||
// // Field is ignored by this package.
|
||||
// Field int `url:"-"`
|
||||
//
|
||||
// // Field appears as URL parameter "myName".
|
||||
// Field int `url:"myName"`
|
||||
// // Field appears as URL parameter "myName".
|
||||
// Field int `url:"myName"`
|
||||
//
|
||||
// // Field appears as URL parameter "myName" and the field is omitted if
|
||||
// // its value is empty
|
||||
// Field int `url:"myName,omitempty"`
|
||||
// // Field appears as URL parameter "myName" and the field is omitted if
|
||||
// // its value is empty
|
||||
// Field int `url:"myName,omitempty"`
|
||||
//
|
||||
// // Field appears as URL parameter "Field" (the default), but the field
|
||||
// // is skipped if empty. Note the leading comma.
|
||||
// Field int `url:",omitempty"`
|
||||
// // Field appears as URL parameter "Field" (the default), but the field
|
||||
// // is skipped if empty. Note the leading comma.
|
||||
// Field int `url:",omitempty"`
|
||||
//
|
||||
// For encoding individual field values, the following type-dependent rules
|
||||
// apply:
|
||||
@@ -88,8 +87,8 @@ type Encoder interface {
|
||||
// "url" tag) will use the value of the "layout" tag as a layout passed to
|
||||
// time.Format. For example:
|
||||
//
|
||||
// // Encode a time.Time as YYYY-MM-DD
|
||||
// Field time.Time `layout:"2006-01-02"`
|
||||
// // Encode a time.Time as YYYY-MM-DD
|
||||
// Field time.Time `layout:"2006-01-02"`
|
||||
//
|
||||
// Slice and Array values default to encoding as multiple URL values of the
|
||||
// same name. Including the "comma" option signals that the field should be
|
||||
@@ -103,9 +102,9 @@ type Encoder interface {
|
||||
// from the "url" tag) will use the value of the "del" tag as the delimiter.
|
||||
// For example:
|
||||
//
|
||||
// // Encode a slice of bools as ints ("1" for true, "0" for false),
|
||||
// // separated by exclamation points "!".
|
||||
// Field []bool `url:",int" del:"!"`
|
||||
// // Encode a slice of bools as ints ("1" for true, "0" for false),
|
||||
// // separated by exclamation points "!".
|
||||
// Field []bool `url:",int" del:"!"`
|
||||
//
|
||||
// Anonymous struct fields are usually encoded as if their inner exported
|
||||
// fields were fields in the outer struct, subject to the standard Go
|
||||
@@ -114,10 +113,10 @@ type Encoder interface {
|
||||
//
|
||||
// Non-nil pointer values are encoded as the value pointed to.
|
||||
//
|
||||
// Nested structs are encoded including parent fields in value names for
|
||||
// scoping. e.g:
|
||||
// Nested structs have their fields processed recursively and are encoded
|
||||
// including parent fields in value names for scoping. For example,
|
||||
//
|
||||
// "user[name]=acme&user[addr][postcode]=1234&user[addr][city]=SFO"
|
||||
// "user[name]=acme&user[addr][postcode]=1234&user[addr][city]=SFO"
|
||||
//
|
||||
// All other values are encoded using their default string representation.
|
||||
//
|
||||
@@ -125,6 +124,11 @@ type Encoder interface {
|
||||
// as multiple URL values of the same name.
|
||||
func Values(v interface{}) (url.Values, error) {
|
||||
values := make(url.Values)
|
||||
|
||||
if v == nil {
|
||||
return values, nil
|
||||
}
|
||||
|
||||
val := reflect.ValueOf(v)
|
||||
for val.Kind() == reflect.Ptr {
|
||||
if val.IsNil() {
|
||||
@@ -133,10 +137,6 @@ func Values(v interface{}) (url.Values, error) {
|
||||
val = val.Elem()
|
||||
}
|
||||
|
||||
if v == nil {
|
||||
return values, nil
|
||||
}
|
||||
|
||||
if val.Kind() != reflect.Struct {
|
||||
return nil, fmt.Errorf("query: Values() expects struct input. Got %v", val.Kind())
|
||||
}
|
||||
@@ -209,6 +209,11 @@ func reflectValue(values url.Values, val reflect.Value, scope string) error {
|
||||
}
|
||||
|
||||
if sv.Kind() == reflect.Slice || sv.Kind() == reflect.Array {
|
||||
if sv.Len() == 0 {
|
||||
// skip if slice or array is empty
|
||||
continue
|
||||
}
|
||||
|
||||
var del string
|
||||
if opts.Contains("comma") {
|
||||
del = ","
|
||||
@@ -223,7 +228,7 @@ func reflectValue(values url.Values, val reflect.Value, scope string) error {
|
||||
}
|
||||
|
||||
if del != "" {
|
||||
s := new(bytes.Buffer)
|
||||
s := new(strings.Builder)
|
||||
first := true
|
||||
for i := 0; i < sv.Len(); i++ {
|
||||
if first {
|
||||
|
||||
+12
-9
@@ -2,11 +2,12 @@ package jsoniter
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/modern-go/reflect2"
|
||||
"io"
|
||||
"reflect"
|
||||
"sort"
|
||||
"unsafe"
|
||||
|
||||
"github.com/modern-go/reflect2"
|
||||
)
|
||||
|
||||
func decoderOfMap(ctx *ctx, typ reflect2.Type) ValDecoder {
|
||||
@@ -106,15 +107,17 @@ func encoderOfMapKey(ctx *ctx, typ reflect2.Type) ValEncoder {
|
||||
}
|
||||
}
|
||||
|
||||
if typ == textMarshalerType {
|
||||
return &directTextMarshalerEncoder{
|
||||
stringEncoder: ctx.EncoderOf(reflect2.TypeOf("")),
|
||||
if typ.Kind() != reflect.String {
|
||||
if typ == textMarshalerType {
|
||||
return &directTextMarshalerEncoder{
|
||||
stringEncoder: ctx.EncoderOf(reflect2.TypeOf("")),
|
||||
}
|
||||
}
|
||||
}
|
||||
if typ.Implements(textMarshalerType) {
|
||||
return &textMarshalerEncoder{
|
||||
valType: typ,
|
||||
stringEncoder: ctx.EncoderOf(reflect2.TypeOf("")),
|
||||
if typ.Implements(textMarshalerType) {
|
||||
return &textMarshalerEncoder{
|
||||
valType: typ,
|
||||
stringEncoder: ctx.EncoderOf(reflect2.TypeOf("")),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+16
@@ -27,6 +27,14 @@ func (stream *Stream) WriteFloat32(val float32) {
|
||||
}
|
||||
}
|
||||
stream.buf = strconv.AppendFloat(stream.buf, float64(val), fmt, -1, 32)
|
||||
if fmt == 'e' {
|
||||
// clean up e-09 to e-9
|
||||
n := len(stream.buf)
|
||||
if n >= 4 && stream.buf[n-4] == 'e' && stream.buf[n-3] == '-' && stream.buf[n-2] == '0' {
|
||||
stream.buf[n-2] = stream.buf[n-1]
|
||||
stream.buf = stream.buf[:n-1]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// WriteFloat32Lossy write float32 to stream with ONLY 6 digits precision although much much faster
|
||||
@@ -76,6 +84,14 @@ func (stream *Stream) WriteFloat64(val float64) {
|
||||
}
|
||||
}
|
||||
stream.buf = strconv.AppendFloat(stream.buf, float64(val), fmt, -1, 64)
|
||||
if fmt == 'e' {
|
||||
// clean up e-09 to e-9
|
||||
n := len(stream.buf)
|
||||
if n >= 4 && stream.buf[n-4] == 'e' && stream.buf[n-3] == '-' && stream.buf[n-2] == '0' {
|
||||
stream.buf[n-2] = stream.buf[n-1]
|
||||
stream.buf = stream.buf[:n-1]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// WriteFloat64Lossy write float64 to stream with ONLY 6 digits precision although much much faster
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
//go:build (appengine || js || nacl || tinygo || wasm) && !windows
|
||||
// +build appengine js nacl tinygo wasm
|
||||
//go:build (appengine || js || nacl || tinygo || wasm || wasip1 || wasip2) && !windows
|
||||
// +build appengine js nacl tinygo wasm wasip1 wasip2
|
||||
// +build !windows
|
||||
|
||||
package isatty
|
||||
|
||||
+7
-3
@@ -31,6 +31,10 @@ func init() {
|
||||
if procGetFileInformationByHandleEx.Find() != nil {
|
||||
procGetFileInformationByHandleEx = nil
|
||||
}
|
||||
// Check if NtQueryObject is available.
|
||||
if procNtQueryObject.Find() != nil {
|
||||
procNtQueryObject = nil
|
||||
}
|
||||
}
|
||||
|
||||
// IsTerminal return true if the file descriptor is terminal.
|
||||
@@ -45,7 +49,7 @@ func IsTerminal(fd uintptr) bool {
|
||||
// \{cygwin,msys}-XXXXXXXXXXXXXXXX-ptyN-{from,to}-master
|
||||
func isCygwinPipeName(name string) bool {
|
||||
token := strings.Split(name, "-")
|
||||
if len(token) < 5 {
|
||||
if len(token) != 5 {
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -75,10 +79,10 @@ func isCygwinPipeName(name string) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// getFileNameByHandle use the undocomented ntdll NtQueryObject to get file full name from file handler
|
||||
// getFileNameByHandle use the undocumented ntdll NtQueryObject to get file full name from file handler
|
||||
// since GetFileInformationByHandleEx is not available under windows Vista and still some old fashion
|
||||
// guys are using Windows XP, this is a workaround for those guys, it will also work on system from
|
||||
// Windows vista to 10
|
||||
// Windows Vista to 10
|
||||
// see https://stackoverflow.com/a/18792477 for details
|
||||
func getFileNameByHandle(fd uintptr) (string, error) {
|
||||
if procNtQueryObject == nil {
|
||||
|
||||
+164
-151
@@ -3,6 +3,16 @@
|
||||
[](https://goreportcard.com/report/miekg/dns)
|
||||
[](https://godoc.org/github.com/miekg/dns)
|
||||
|
||||
DNS version 2 is now available at <https://codeberg.org/miekg/dns>, check it out if you want to
|
||||
help shape the next 15 years of the Go DNS package.
|
||||
|
||||
The version here will see no new features and less and less development, and my time (if any) will be fully
|
||||
devoted towards v2.
|
||||
|
||||
**December 2025**: v2 should be (already) a good replacement, the coming months would be a good time to
|
||||
migrate, see [this file describing the
|
||||
differences](https://codeberg.org/miekg/dns/src/branch/main/README-diff-with-v1.md), to help you get started.
|
||||
|
||||
# Alternative (more granular) approach to a DNS library
|
||||
|
||||
> Less is more.
|
||||
@@ -17,96 +27,97 @@ avoiding breaking changes wherever reasonable. We support the last two versions
|
||||
|
||||
# Goals
|
||||
|
||||
* KISS;
|
||||
* Fast;
|
||||
* Small API. If it's easy to code in Go, don't make a function for it.
|
||||
- KISS;
|
||||
- Fast;
|
||||
- Small API. If it's easy to code in Go, don't make a function for it.
|
||||
|
||||
# Users
|
||||
|
||||
A not-so-up-to-date-list-that-may-be-actually-current:
|
||||
|
||||
* https://github.com/coredns/coredns
|
||||
* https://github.com/abh/geodns
|
||||
* https://github.com/baidu/bfe
|
||||
* http://www.statdns.com/
|
||||
* http://www.dnsinspect.com/
|
||||
* https://github.com/chuangbo/jianbing-dictionary-dns
|
||||
* http://www.dns-lg.com/
|
||||
* https://github.com/fcambus/rrda
|
||||
* https://github.com/kenshinx/godns
|
||||
* https://github.com/skynetservices/skydns
|
||||
* https://github.com/hashicorp/consul
|
||||
* https://github.com/DevelopersPL/godnsagent
|
||||
* https://github.com/duedil-ltd/discodns
|
||||
* https://github.com/StalkR/dns-reverse-proxy
|
||||
* https://github.com/tianon/rawdns
|
||||
* https://mesosphere.github.io/mesos-dns/
|
||||
* https://github.com/fcambus/statzone
|
||||
* https://github.com/benschw/dns-clb-go
|
||||
* https://github.com/corny/dnscheck for <http://public-dns.info/>
|
||||
* https://github.com/miekg/unbound
|
||||
* https://github.com/miekg/exdns
|
||||
* https://dnslookup.org
|
||||
* https://github.com/looterz/grimd
|
||||
* https://github.com/phamhongviet/serf-dns
|
||||
* https://github.com/mehrdadrad/mylg
|
||||
* https://github.com/bamarni/dockness
|
||||
* https://github.com/fffaraz/microdns
|
||||
* https://github.com/ipdcode/hades <https://jd.com>
|
||||
* https://github.com/StackExchange/dnscontrol/
|
||||
* https://www.dnsperf.com/
|
||||
* https://dnssectest.net/
|
||||
* https://github.com/oif/apex
|
||||
* https://github.com/jedisct1/dnscrypt-proxy
|
||||
* https://github.com/jedisct1/rpdns
|
||||
* https://github.com/xor-gate/sshfp
|
||||
* https://github.com/rs/dnstrace
|
||||
* https://blitiri.com.ar/p/dnss ([github mirror](https://github.com/albertito/dnss))
|
||||
* https://render.com
|
||||
* https://github.com/peterzen/goresolver
|
||||
* https://github.com/folbricht/routedns
|
||||
* https://domainr.com/
|
||||
* https://zonedb.org/
|
||||
* https://router7.org/
|
||||
* https://github.com/fortio/dnsping
|
||||
* https://github.com/Luzilla/dnsbl_exporter
|
||||
* https://github.com/bodgit/tsig
|
||||
* https://github.com/v2fly/v2ray-core (test only)
|
||||
* https://kuma.io/
|
||||
* https://www.misaka.io/services/dns
|
||||
* https://ping.sx/dig
|
||||
* https://fleetdeck.io/
|
||||
* https://github.com/markdingo/autoreverse
|
||||
* https://github.com/slackhq/nebula
|
||||
* https://addr.tools/
|
||||
* https://dnscheck.tools/
|
||||
* https://github.com/egbakou/domainverifier
|
||||
* https://github.com/semihalev/sdns
|
||||
* https://github.com/wintbiit/NineDNS
|
||||
* https://linuxcontainers.org/incus/
|
||||
* https://ifconfig.es
|
||||
* https://github.com/zmap/zdns
|
||||
* https://framagit.org/bortzmeyer/check-soa
|
||||
- https://github.com/coredns/coredns
|
||||
- https://github.com/abh/geodns
|
||||
- https://github.com/baidu/bfe
|
||||
- http://www.statdns.com/
|
||||
- http://www.dnsinspect.com/
|
||||
- https://github.com/chuangbo/jianbing-dictionary-dns
|
||||
- http://www.dns-lg.com/
|
||||
- https://github.com/fcambus/rrda
|
||||
- https://github.com/kenshinx/godns
|
||||
- https://github.com/skynetservices/skydns
|
||||
- https://github.com/hashicorp/consul
|
||||
- https://github.com/DevelopersPL/godnsagent
|
||||
- https://github.com/duedil-ltd/discodns
|
||||
- https://github.com/StalkR/dns-reverse-proxy
|
||||
- https://github.com/tianon/rawdns
|
||||
- https://mesosphere.github.io/mesos-dns/
|
||||
- https://github.com/fcambus/statzone
|
||||
- https://github.com/benschw/dns-clb-go
|
||||
- https://github.com/corny/dnscheck for <http://public-dns.info/>
|
||||
- https://github.com/miekg/unbound
|
||||
- https://github.com/miekg/exdns
|
||||
- https://dnslookup.org
|
||||
- https://github.com/looterz/grimd
|
||||
- https://github.com/phamhongviet/serf-dns
|
||||
- https://github.com/mehrdadrad/mylg
|
||||
- https://github.com/bamarni/dockness
|
||||
- https://github.com/fffaraz/microdns
|
||||
- https://github.com/ipdcode/hades <https://jd.com>
|
||||
- https://github.com/StackExchange/dnscontrol/
|
||||
- https://www.dnsperf.com/
|
||||
- https://dnssectest.net/
|
||||
- https://github.com/oif/apex
|
||||
- https://github.com/jedisct1/dnscrypt-proxy (migrated to v2)
|
||||
- https://github.com/jedisct1/rpdns
|
||||
- https://github.com/xor-gate/sshfp
|
||||
- https://github.com/rs/dnstrace
|
||||
- https://blitiri.com.ar/p/dnss ([github mirror](https://github.com/albertito/dnss))
|
||||
- https://render.com
|
||||
- https://github.com/peterzen/goresolver
|
||||
- https://github.com/folbricht/routedns
|
||||
- https://domainr.com/
|
||||
- https://zonedb.org/
|
||||
- https://router7.org/
|
||||
- https://github.com/fortio/dnsping
|
||||
- https://github.com/Luzilla/dnsbl_exporter
|
||||
- https://github.com/bodgit/tsig
|
||||
- https://github.com/v2fly/v2ray-core (test only)
|
||||
- https://kuma.io/
|
||||
- https://www.misaka.io/services/dns
|
||||
- https://ping.sx/dig
|
||||
- https://fleetdeck.io/
|
||||
- https://github.com/markdingo/autoreverse
|
||||
- https://github.com/slackhq/nebula
|
||||
- https://addr.tools/
|
||||
- https://dnscheck.tools/
|
||||
- https://github.com/egbakou/domainverifier
|
||||
- https://github.com/semihalev/sdns
|
||||
- https://github.com/wintbiit/NineDNS
|
||||
- https://linuxcontainers.org/incus/
|
||||
- https://ifconfig.es
|
||||
- https://github.com/zmap/zdns
|
||||
- https://framagit.org/bortzmeyer/check-soa
|
||||
- https://github.com/jkerdreux-imt/owns
|
||||
|
||||
Send pull request if you want to be listed here.
|
||||
|
||||
# Features
|
||||
|
||||
* UDP/TCP queries, IPv4 and IPv6
|
||||
* RFC 1035 zone file parsing ($INCLUDE, $ORIGIN, $TTL and $GENERATE (for all record types) are supported
|
||||
* Fast
|
||||
* Server side programming (mimicking the net/http package)
|
||||
* Client side programming
|
||||
* DNSSEC: signing, validating and key generation for DSA, RSA, ECDSA and Ed25519
|
||||
* EDNS0, NSID, Cookies
|
||||
* AXFR/IXFR
|
||||
* TSIG, SIG(0)
|
||||
* DNS over TLS (DoT): encrypted connection between client and server over TCP
|
||||
* DNS name compression
|
||||
- UDP/TCP queries, IPv4 and IPv6
|
||||
- RFC 1035 zone file parsing ($INCLUDE, $ORIGIN, $TTL and $GENERATE (for all record types) are supported
|
||||
- Fast
|
||||
- Server side programming (mimicking the net/http package)
|
||||
- Client side programming
|
||||
- DNSSEC: signing, validating and key generation for DSA, RSA, ECDSA and Ed25519
|
||||
- EDNS0, NSID, Cookies
|
||||
- AXFR/IXFR
|
||||
- TSIG, SIG(0)
|
||||
- DNS over TLS (DoT): encrypted connection between client and server over TCP
|
||||
- DNS name compression
|
||||
|
||||
Have fun!
|
||||
|
||||
Miek Gieben - 2010-2012 - <miek@miek.nl>
|
||||
Miek Gieben - 2010-2012 - <miek@miek.nl>
|
||||
DNS Authors 2012-
|
||||
|
||||
# Building
|
||||
@@ -126,81 +137,83 @@ Example programs can be found in the `github.com/miekg/exdns` repository.
|
||||
|
||||
## Supported RFCs
|
||||
|
||||
*all of them*
|
||||
_all of them_
|
||||
|
||||
* 103{4,5} - DNS standard
|
||||
* 1183 - ISDN, X25 and other deprecated records
|
||||
* 1348 - NSAP record (removed the record)
|
||||
* 1982 - Serial Arithmetic
|
||||
* 1876 - LOC record
|
||||
* 1995 - IXFR
|
||||
* 1996 - DNS notify
|
||||
* 2136 - DNS Update (dynamic updates)
|
||||
* 2181 - RRset definition - there is no RRset type though, just []RR
|
||||
* 2537 - RSAMD5 DNS keys
|
||||
* 2065 - DNSSEC (updated in later RFCs)
|
||||
* 2671 - EDNS record
|
||||
* 2782 - SRV record
|
||||
* 2845 - TSIG record
|
||||
* 2915 - NAPTR record
|
||||
* 2929 - DNS IANA Considerations
|
||||
* 3110 - RSASHA1 DNS keys
|
||||
* 3123 - APL record
|
||||
* 3225 - DO bit (DNSSEC OK)
|
||||
* 340{1,2,3} - NAPTR record
|
||||
* 3445 - Limiting the scope of (DNS)KEY
|
||||
* 3596 - AAAA record
|
||||
* 3597 - Unknown RRs
|
||||
* 4025 - A Method for Storing IPsec Keying Material in DNS
|
||||
* 403{3,4,5} - DNSSEC + validation functions
|
||||
* 4255 - SSHFP record
|
||||
* 4343 - Case insensitivity
|
||||
* 4408 - SPF record
|
||||
* 4509 - SHA256 Hash in DS
|
||||
* 4592 - Wildcards in the DNS
|
||||
* 4635 - HMAC SHA TSIG
|
||||
* 4701 - DHCID
|
||||
* 4892 - id.server
|
||||
* 5001 - NSID
|
||||
* 5155 - NSEC3 record
|
||||
* 5205 - HIP record
|
||||
* 5702 - SHA2 in the DNS
|
||||
* 5936 - AXFR
|
||||
* 5966 - TCP implementation recommendations
|
||||
* 6605 - ECDSA
|
||||
* 6725 - IANA Registry Update
|
||||
* 6742 - ILNP DNS
|
||||
* 6840 - Clarifications and Implementation Notes for DNS Security
|
||||
* 6844 - CAA record
|
||||
* 6891 - EDNS0 update
|
||||
* 6895 - DNS IANA considerations
|
||||
* 6944 - DNSSEC DNSKEY Algorithm Status
|
||||
* 6975 - Algorithm Understanding in DNSSEC
|
||||
* 7043 - EUI48/EUI64 records
|
||||
* 7314 - DNS (EDNS) EXPIRE Option
|
||||
* 7477 - CSYNC RR
|
||||
* 7828 - edns-tcp-keepalive EDNS0 Option
|
||||
* 7553 - URI record
|
||||
* 7858 - DNS over TLS: Initiation and Performance Considerations
|
||||
* 7871 - EDNS0 Client Subnet
|
||||
* 7873 - Domain Name System (DNS) Cookies
|
||||
* 8080 - EdDSA for DNSSEC
|
||||
* 8490 - DNS Stateful Operations
|
||||
* 8499 - DNS Terminology
|
||||
* 8659 - DNS Certification Authority Authorization (CAA) Resource Record
|
||||
* 8777 - DNS Reverse IP Automatic Multicast Tunneling (AMT) Discovery
|
||||
* 8914 - Extended DNS Errors
|
||||
* 8976 - Message Digest for DNS Zones (ZONEMD RR)
|
||||
* 9460 - Service Binding and Parameter Specification via the DNS
|
||||
* 9461 - Service Binding Mapping for DNS Servers
|
||||
* 9462 - Discovery of Designated Resolvers
|
||||
* 9460 - SVCB and HTTPS Records
|
||||
* 9606 - DNS Resolver Information
|
||||
* Draft - Compact Denial of Existence in DNSSEC
|
||||
- 103{4,5} - DNS standard
|
||||
- 1183 - ISDN, X25 and other deprecated records
|
||||
- 1348 - NSAP record (removed the record)
|
||||
- 1982 - Serial Arithmetic
|
||||
- 1876 - LOC record
|
||||
- 1995 - IXFR
|
||||
- 1996 - DNS notify
|
||||
- 2136 - DNS Update (dynamic updates)
|
||||
- 2181 - RRset definition - there is no RRset type though, just []RR
|
||||
- 2537 - RSAMD5 DNS keys
|
||||
- 2065 - DNSSEC (updated in later RFCs)
|
||||
- 2671 - EDNS record
|
||||
- 2782 - SRV record
|
||||
- 2845 - TSIG record
|
||||
- 2915 - NAPTR record
|
||||
- 2929 - DNS IANA Considerations
|
||||
- 3110 - RSASHA1 DNS keys
|
||||
- 3123 - APL record
|
||||
- 3225 - DO bit (DNSSEC OK)
|
||||
- 340{1,2,3} - NAPTR record
|
||||
- 3445 - Limiting the scope of (DNS)KEY
|
||||
- 3596 - AAAA record
|
||||
- 3597 - Unknown RRs
|
||||
- 4025 - A Method for Storing IPsec Keying Material in DNS
|
||||
- 403{3,4,5} - DNSSEC + validation functions
|
||||
- 4255 - SSHFP record
|
||||
- 4343 - Case insensitivity
|
||||
- 4408 - SPF record
|
||||
- 4509 - SHA256 Hash in DS
|
||||
- 4592 - Wildcards in the DNS
|
||||
- 4635 - HMAC SHA TSIG
|
||||
- 4701 - DHCID
|
||||
- 4892 - id.server
|
||||
- 5001 - NSID
|
||||
- 5155 - NSEC3 record
|
||||
- 5205 - HIP record
|
||||
- 5702 - SHA2 in the DNS
|
||||
- 5936 - AXFR
|
||||
- 5966 - TCP implementation recommendations
|
||||
- 6605 - ECDSA
|
||||
- 6725 - IANA Registry Update
|
||||
- 6742 - ILNP DNS
|
||||
- 6840 - Clarifications and Implementation Notes for DNS Security
|
||||
- 6844 - CAA record
|
||||
- 6891 - EDNS0 update
|
||||
- 6895 - DNS IANA considerations
|
||||
- 6944 - DNSSEC DNSKEY Algorithm Status
|
||||
- 6975 - Algorithm Understanding in DNSSEC
|
||||
- 7043 - EUI48/EUI64 records
|
||||
- 7314 - DNS (EDNS) EXPIRE Option
|
||||
- 7477 - CSYNC RR
|
||||
- 7828 - edns-tcp-keepalive EDNS0 Option
|
||||
- 7553 - URI record
|
||||
- 7858 - DNS over TLS: Initiation and Performance Considerations
|
||||
- 7871 - EDNS0 Client Subnet
|
||||
- 7873 - Domain Name System (DNS) Cookies
|
||||
- 8080 - EdDSA for DNSSEC
|
||||
- 8490 - DNS Stateful Operations
|
||||
- 8499 - DNS Terminology
|
||||
- 8659 - DNS Certification Authority Authorization (CAA) Resource Record
|
||||
- 8777 - DNS Reverse IP Automatic Multicast Tunneling (AMT) Discovery
|
||||
- 8914 - Extended DNS Errors
|
||||
- 8976 - Message Digest for DNS Zones (ZONEMD RR)
|
||||
- 9460 - Service Binding and Parameter Specification via the DNS
|
||||
- 9461 - Service Binding Mapping for DNS Servers
|
||||
- 9462 - Discovery of Designated Resolvers
|
||||
- 9460 - SVCB and HTTPS Records
|
||||
- 9567 - DNS Error Reporting
|
||||
- 9606 - DNS Resolver Information
|
||||
- 9660 - DNS Zone Version (ZONEVERSION) Option
|
||||
- Draft - Compact Denial of Existence in DNSSEC
|
||||
|
||||
## Loosely Based Upon
|
||||
|
||||
* ldns - <https://nlnetlabs.nl/projects/ldns/about/>
|
||||
* NSD - <https://nlnetlabs.nl/projects/nsd/about/>
|
||||
* Net::DNS - <http://www.net-dns.org/>
|
||||
* GRONG - <https://github.com/bortzmeyer/grong>
|
||||
- ldns - <https://nlnetlabs.nl/projects/ldns/about/>
|
||||
- NSD - <https://nlnetlabs.nl/projects/nsd/about/>
|
||||
- Net::DNS - <http://www.net-dns.org/>
|
||||
- GRONG - <https://github.com/bortzmeyer/grong>
|
||||
+8
-2
@@ -57,8 +57,8 @@ type Client struct {
|
||||
// Client.Dialer) or context.Context.Deadline (see ExchangeContext)
|
||||
Timeout time.Duration
|
||||
DialTimeout time.Duration // net.DialTimeout, defaults to 2 seconds, or net.Dialer.Timeout if expiring earlier - overridden by Timeout when that value is non-zero
|
||||
ReadTimeout time.Duration // net.Conn.SetReadTimeout value for connections, defaults to 2 seconds - overridden by Timeout when that value is non-zero
|
||||
WriteTimeout time.Duration // net.Conn.SetWriteTimeout value for connections, defaults to 2 seconds - overridden by Timeout when that value is non-zero
|
||||
ReadTimeout time.Duration // net.Conn.SetReadDeadline value for connections, defaults to 2 seconds - overridden by Timeout when that value is non-zero
|
||||
WriteTimeout time.Duration // net.Conn.SetWriteDeadline value for connections, defaults to 2 seconds - overridden by Timeout when that value is non-zero
|
||||
TsigSecret map[string]string // secret(s) for Tsig map[<zonename>]<base64 secret>, zonename must be in canonical form (lowercase, fqdn, see RFC 4034 Section 6.2)
|
||||
TsigProvider TsigProvider // An implementation of the TsigProvider interface. If defined it replaces TsigSecret and is used for all TSIG operations.
|
||||
|
||||
@@ -92,6 +92,9 @@ func (c *Client) dialTimeout() time.Duration {
|
||||
}
|
||||
|
||||
func (c *Client) readTimeout() time.Duration {
|
||||
if c.Timeout != 0 {
|
||||
return c.Timeout
|
||||
}
|
||||
if c.ReadTimeout != 0 {
|
||||
return c.ReadTimeout
|
||||
}
|
||||
@@ -99,6 +102,9 @@ func (c *Client) readTimeout() time.Duration {
|
||||
}
|
||||
|
||||
func (c *Client) writeTimeout() time.Duration {
|
||||
if c.Timeout != 0 {
|
||||
return c.Timeout
|
||||
}
|
||||
if c.WriteTimeout != 0 {
|
||||
return c.WriteTimeout
|
||||
}
|
||||
|
||||
+112
-19
@@ -24,6 +24,8 @@ const (
|
||||
EDNS0TCPKEEPALIVE = 0xb // EDNS0 tcp keep alive (See RFC 7828)
|
||||
EDNS0PADDING = 0xc // EDNS0 padding (See RFC 7830)
|
||||
EDNS0EDE = 0xf // EDNS0 extended DNS errors (See RFC 8914)
|
||||
EDNS0REPORTING = 0x12 // EDNS0 reporting (See RFC 9567)
|
||||
EDNS0ZONEVERSION = 0x13 // EDNS0 Zone Version (See RFC 9660)
|
||||
EDNS0LOCALSTART = 0xFDE9 // Beginning of range reserved for local/experimental use (See RFC 6891)
|
||||
EDNS0LOCALEND = 0xFFFE // End of range reserved for local/experimental use (See RFC 6891)
|
||||
_DO = 1 << 15 // DNSSEC OK
|
||||
@@ -60,6 +62,10 @@ func makeDataOpt(code uint16) EDNS0 {
|
||||
return new(EDNS0_EDE)
|
||||
case EDNS0ESU:
|
||||
return new(EDNS0_ESU)
|
||||
case EDNS0REPORTING:
|
||||
return new(EDNS0_REPORTING)
|
||||
case EDNS0ZONEVERSION:
|
||||
return new(EDNS0_ZONEVERSION)
|
||||
default:
|
||||
e := new(EDNS0_LOCAL)
|
||||
e.Code = code
|
||||
@@ -75,17 +81,16 @@ type OPT struct {
|
||||
|
||||
func (rr *OPT) String() string {
|
||||
s := "\n;; OPT PSEUDOSECTION:\n; EDNS: version " + strconv.Itoa(int(rr.Version())) + "; "
|
||||
s += "flags:"
|
||||
if rr.Do() {
|
||||
if rr.Co() {
|
||||
s += "flags: do, co; "
|
||||
} else {
|
||||
s += "flags: do; "
|
||||
}
|
||||
} else {
|
||||
s += "flags:; "
|
||||
s += " do"
|
||||
}
|
||||
if rr.Hdr.Ttl&0x7FFF != 0 {
|
||||
s += fmt.Sprintf("MBZ: 0x%04x, ", rr.Hdr.Ttl&0x7FFF)
|
||||
if rr.Co() {
|
||||
s += " co"
|
||||
}
|
||||
s += "; "
|
||||
if z := rr.Z(); z != 0 {
|
||||
s += fmt.Sprintf("MBZ: 0x%04x, ", z)
|
||||
}
|
||||
s += "udp: " + strconv.Itoa(int(rr.UDPSize()))
|
||||
|
||||
@@ -127,6 +132,10 @@ func (rr *OPT) String() string {
|
||||
s += "\n; EDE: " + o.String()
|
||||
case *EDNS0_ESU:
|
||||
s += "\n; ESU: " + o.String()
|
||||
case *EDNS0_REPORTING:
|
||||
s += "\n; REPORT-CHANNEL: " + o.String()
|
||||
case *EDNS0_ZONEVERSION:
|
||||
s += "\n; ZONEVERSION: " + o.String()
|
||||
}
|
||||
}
|
||||
return s
|
||||
@@ -308,10 +317,6 @@ type EDNS0_SUBNET struct {
|
||||
func (e *EDNS0_SUBNET) Option() uint16 { return EDNS0SUBNET }
|
||||
|
||||
func (e *EDNS0_SUBNET) pack() ([]byte, error) {
|
||||
b := make([]byte, 4)
|
||||
binary.BigEndian.PutUint16(b[0:], e.Family)
|
||||
b[2] = e.SourceNetmask
|
||||
b[3] = e.SourceScope
|
||||
switch e.Family {
|
||||
case 0:
|
||||
// "dig" sets AddressFamily to 0 if SourceNetmask is also 0
|
||||
@@ -319,16 +324,27 @@ func (e *EDNS0_SUBNET) pack() ([]byte, error) {
|
||||
if e.SourceNetmask != 0 {
|
||||
return nil, errors.New("bad address family")
|
||||
}
|
||||
b := make([]byte, 4)
|
||||
b[3] = e.SourceScope
|
||||
return b, nil
|
||||
case 1:
|
||||
if e.SourceNetmask > net.IPv4len*8 {
|
||||
return nil, errors.New("bad netmask")
|
||||
}
|
||||
if len(e.Address.To4()) != net.IPv4len {
|
||||
ip4 := e.Address.To4()
|
||||
if len(ip4) != net.IPv4len {
|
||||
return nil, errors.New("bad address")
|
||||
}
|
||||
ip := e.Address.To4().Mask(net.CIDRMask(int(e.SourceNetmask), net.IPv4len*8))
|
||||
needLength := (e.SourceNetmask + 8 - 1) / 8 // division rounding up
|
||||
b = append(b, ip[:needLength]...)
|
||||
b := make([]byte, 4+needLength)
|
||||
binary.BigEndian.PutUint16(b[0:], e.Family)
|
||||
b[2] = e.SourceNetmask
|
||||
b[3] = e.SourceScope
|
||||
if needLength > 0 {
|
||||
ip := ip4.Mask(net.CIDRMask(int(e.SourceNetmask), net.IPv4len*8))
|
||||
copy(b[4:], ip[:needLength])
|
||||
}
|
||||
return b, nil
|
||||
case 2:
|
||||
if e.SourceNetmask > net.IPv6len*8 {
|
||||
return nil, errors.New("bad netmask")
|
||||
@@ -336,13 +352,19 @@ func (e *EDNS0_SUBNET) pack() ([]byte, error) {
|
||||
if len(e.Address) != net.IPv6len {
|
||||
return nil, errors.New("bad address")
|
||||
}
|
||||
ip := e.Address.Mask(net.CIDRMask(int(e.SourceNetmask), net.IPv6len*8))
|
||||
needLength := (e.SourceNetmask + 8 - 1) / 8 // division rounding up
|
||||
b = append(b, ip[:needLength]...)
|
||||
b := make([]byte, 4+needLength)
|
||||
binary.BigEndian.PutUint16(b[0:], e.Family)
|
||||
b[2] = e.SourceNetmask
|
||||
b[3] = e.SourceScope
|
||||
if needLength > 0 {
|
||||
ip := e.Address.Mask(net.CIDRMask(int(e.SourceNetmask), net.IPv6len*8))
|
||||
copy(b[4:], ip[:needLength])
|
||||
}
|
||||
return b, nil
|
||||
default:
|
||||
return nil, errors.New("bad address family")
|
||||
}
|
||||
return b, nil
|
||||
}
|
||||
|
||||
func (e *EDNS0_SUBNET) unpack(b []byte) error {
|
||||
@@ -875,3 +897,74 @@ func (e *EDNS0_ESU) unpack(b []byte) error {
|
||||
e.Uri = string(b)
|
||||
return nil
|
||||
}
|
||||
|
||||
// EDNS0_REPORTING implements the EDNS0 Reporting Channel option (RFC 9567).
|
||||
type EDNS0_REPORTING struct {
|
||||
Code uint16 // always EDNS0REPORTING
|
||||
AgentDomain string
|
||||
}
|
||||
|
||||
func (e *EDNS0_REPORTING) Option() uint16 { return EDNS0REPORTING }
|
||||
func (e *EDNS0_REPORTING) String() string { return e.AgentDomain }
|
||||
func (e *EDNS0_REPORTING) copy() EDNS0 { return &EDNS0_REPORTING{e.Code, e.AgentDomain} }
|
||||
func (e *EDNS0_REPORTING) pack() ([]byte, error) {
|
||||
b := make([]byte, 255)
|
||||
off1, err := PackDomainName(Fqdn(e.AgentDomain), b, 0, nil, false)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("bad agent domain: %w", err)
|
||||
}
|
||||
return b[:off1], nil
|
||||
}
|
||||
func (e *EDNS0_REPORTING) unpack(b []byte) error {
|
||||
domain, _, err := UnpackDomainName(b, 0)
|
||||
if err != nil {
|
||||
return fmt.Errorf("bad agent domain: %w", err)
|
||||
}
|
||||
e.AgentDomain = domain
|
||||
return nil
|
||||
}
|
||||
|
||||
// EDNS0_ZONEVERSION implements the EDNS0 Zone Version option (RFC 9660).
|
||||
type EDNS0_ZONEVERSION struct {
|
||||
// always EDNS0ZONEVERSION (19)
|
||||
Code uint16
|
||||
// An unsigned 1-octet Label Count indicating
|
||||
// the number of labels for the name of the zone that VERSION value refers to.
|
||||
LabelCount uint8
|
||||
// An unsigned 1-octet type number distinguishing the format and meaning of version.
|
||||
// 0 SOA-SERIAL, 1-245 Unassigned, 246-255 Reserved for private use, see RFC 9660.
|
||||
Type uint8
|
||||
// An opaque octet string conveying the zone version data (VERSION).
|
||||
Version string
|
||||
}
|
||||
|
||||
func (e *EDNS0_ZONEVERSION) Option() uint16 { return EDNS0ZONEVERSION }
|
||||
func (e *EDNS0_ZONEVERSION) String() string { return e.Version }
|
||||
func (e *EDNS0_ZONEVERSION) copy() EDNS0 {
|
||||
return &EDNS0_ZONEVERSION{e.Code, e.LabelCount, e.Type, e.Version}
|
||||
}
|
||||
func (e *EDNS0_ZONEVERSION) pack() ([]byte, error) {
|
||||
b := []byte{
|
||||
// first octet label count
|
||||
e.LabelCount,
|
||||
// second octet is type
|
||||
e.Type,
|
||||
}
|
||||
if len(e.Version) > 0 {
|
||||
b = append(b, []byte(e.Version)...)
|
||||
}
|
||||
return b, nil
|
||||
}
|
||||
func (e *EDNS0_ZONEVERSION) unpack(b []byte) error {
|
||||
if len(b) < 2 {
|
||||
return ErrBuf
|
||||
}
|
||||
e.LabelCount = b[0]
|
||||
e.Type = b[1]
|
||||
if len(b) > 2 {
|
||||
e.Version = string(b[2:])
|
||||
} else {
|
||||
e.Version = ""
|
||||
}
|
||||
return nil
|
||||
}
|
||||
+3
-1
@@ -338,11 +338,13 @@ loop:
|
||||
return off + 2, nil
|
||||
}
|
||||
|
||||
// Trailing root label
|
||||
if off < len(msg) {
|
||||
msg[off] = 0
|
||||
return off + 1, nil
|
||||
}
|
||||
|
||||
return off + 1, nil
|
||||
return off, ErrBuf
|
||||
}
|
||||
|
||||
// isRootLabel returns whether s or bs, from off to end, is the root
|
||||
|
||||
+7
-3
@@ -5,6 +5,7 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"io/fs"
|
||||
"math"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
@@ -1231,7 +1232,7 @@ func typeToInt(token string) (uint16, bool) {
|
||||
|
||||
// stringToTTL parses things like 2w, 2m, etc, and returns the time in seconds.
|
||||
func stringToTTL(token string) (uint32, bool) {
|
||||
var s, i uint32
|
||||
var s, i uint
|
||||
for _, c := range token {
|
||||
switch c {
|
||||
case 's', 'S':
|
||||
@@ -1251,12 +1252,15 @@ func stringToTTL(token string) (uint32, bool) {
|
||||
i = 0
|
||||
case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
|
||||
i *= 10
|
||||
i += uint32(c) - '0'
|
||||
i += uint(c) - '0'
|
||||
default:
|
||||
return 0, false
|
||||
}
|
||||
}
|
||||
return s + i, true
|
||||
if s+i > math.MaxUint32 {
|
||||
return 0, false
|
||||
}
|
||||
return uint32(s + i), true
|
||||
}
|
||||
|
||||
// Parse LOC records' <digits>[.<digits>][mM] into a
|
||||
|
||||
+3
-1
@@ -194,7 +194,9 @@ type DecorateWriter func(Writer) Writer
|
||||
// rejected (or ignored) by the MsgAcceptFunc, or passed to this function.
|
||||
type MsgInvalidFunc func(m []byte, err error)
|
||||
|
||||
func DefaultMsgInvalidFunc(m []byte, err error) {}
|
||||
var DefaultMsgInvalidFunc MsgInvalidFunc = defaultMsgInvalidFunc
|
||||
|
||||
func defaultMsgInvalidFunc(m []byte, err error) {}
|
||||
|
||||
// A Server defines parameters for running an DNS server.
|
||||
type Server struct {
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ package dns
|
||||
import "fmt"
|
||||
|
||||
// Version is current version of this library.
|
||||
var Version = v{1, 1, 68}
|
||||
var Version = v{1, 1, 72}
|
||||
|
||||
// v holds the version of this library.
|
||||
type v struct {
|
||||
|
||||
+2
-2
@@ -159,7 +159,7 @@ func NewUnary(m map[string]interface{}, unprotected []string, tp trace.TracerPro
|
||||
ctx = ctxpkg.ContextSetScopes(ctx, tokenScope)
|
||||
// TODO: MFA enforcement should be moved to the individual service level, so each service can
|
||||
// decide which endpoints require MFA and which are accessible without it.
|
||||
if conf.MFAEnabled {
|
||||
if conf.MFAEnabled && u.Id.Type != userpb.UserType_USER_TYPE_SERVICE {
|
||||
if mfav := metadata.ValueFromIncomingContext(ctx, ctxpkg.MFAOutgoingHeader); !slices.Contains(mfav, "true") {
|
||||
log.Warn().Str("user_id", u.Id.OpaqueId).Strs("mfa_values", mfav).Msg("MFA is required")
|
||||
return mfaResponse(ctx, req, info)
|
||||
@@ -256,7 +256,7 @@ func NewStream(m map[string]interface{}, unprotected []string, tp trace.TracerPr
|
||||
ctx = ctxpkg.ContextSetScopes(ctx, tokenScope)
|
||||
// TODO: MFA enforcement should be moved to the individual service level, so each service can
|
||||
// decide which endpoints require MFA and which are accessible without it.
|
||||
if conf.MFAEnabled {
|
||||
if conf.MFAEnabled && u.Id.Type != userpb.UserType_USER_TYPE_SERVICE {
|
||||
if mfav := metadata.ValueFromIncomingContext(ctx, ctxpkg.MFAOutgoingHeader); !slices.Contains(mfav, "true") {
|
||||
log.Warn().Str("user_id", u.Id.OpaqueId).Strs("mfa_values", mfav).Msg("MFA is required")
|
||||
return status.Errorf(codes.PermissionDenied, "MFA required to access vault storage")
|
||||
|
||||
Generated
Vendored
+2
@@ -24,6 +24,7 @@ import (
|
||||
"github.com/owncloud/reva/v2/internal/http/services/owncloud/ocs/config"
|
||||
"github.com/owncloud/reva/v2/internal/http/services/owncloud/ocs/response"
|
||||
"github.com/owncloud/reva/v2/pkg/owncloud/ocs"
|
||||
"github.com/owncloud/reva/v2/pkg/utils"
|
||||
)
|
||||
|
||||
// Handler renders the capability endpoint
|
||||
@@ -260,5 +261,6 @@ func (h *Handler) vaultCapabilities(c ocs.CapabilitiesData) ocs.CapabilitiesData
|
||||
caps := *c.Capabilities
|
||||
caps.FilesSharing = &sharing
|
||||
c.Capabilities = &caps
|
||||
c.Capabilities.Vault.VaultStorageProvider = utils.VaultStorageProviderID
|
||||
return c
|
||||
}
|
||||
+2
-1
@@ -337,5 +337,6 @@ type Version struct {
|
||||
|
||||
// CapabilitiesVault holds vault capabilities
|
||||
type CapabilitiesVault struct {
|
||||
Enabled ocsBool `json:"enabled" xml:"enabled" mapstructure:"enabled"`
|
||||
Enabled ocsBool `json:"enabled" xml:"enabled" mapstructure:"enabled"`
|
||||
VaultStorageProvider string `json:"vault_storage_provider" xml:"vault_storage_provider" mapstructure:"vault_storage_provider"`
|
||||
}
|
||||
+30
-19
@@ -1,8 +1,6 @@
|
||||
# Objx
|
||||
[](https://travis-ci.org/stretchr/objx)
|
||||
[](https://goreportcard.com/report/github.com/stretchr/objx)
|
||||
[](https://codeclimate.com/github/stretchr/objx/maintainability)
|
||||
[](https://codeclimate.com/github/stretchr/objx/test_coverage)
|
||||
[](https://sourcegraph.com/github.com/stretchr/objx)
|
||||
[](https://pkg.go.dev/github.com/stretchr/objx)
|
||||
|
||||
@@ -19,49 +17,62 @@ Objx provides the `objx.Map` type, which is a `map[string]interface{}` that expo
|
||||
### Pattern
|
||||
Objx uses a predictable pattern to make access data from within `map[string]interface{}` easy. Call one of the `objx.` functions to create your `objx.Map` to get going:
|
||||
|
||||
m, err := objx.FromJSON(json)
|
||||
```go
|
||||
m, err := objx.FromJSON(json)
|
||||
```
|
||||
|
||||
NOTE: Any methods or functions with the `Must` prefix will panic if something goes wrong, the rest will be optimistic and try to figure things out without panicking.
|
||||
|
||||
Use `Get` to access the value you're interested in. You can use dot and array
|
||||
notation too:
|
||||
|
||||
m.Get("places[0].latlng")
|
||||
```go
|
||||
m.Get("places[0].latlng")
|
||||
```
|
||||
|
||||
Once you have sought the `Value` you're interested in, you can use the `Is*` methods to determine its type.
|
||||
|
||||
if m.Get("code").IsStr() { // Your code... }
|
||||
```go
|
||||
if m.Get("code").IsStr() { // Your code... }
|
||||
```
|
||||
|
||||
Or you can just assume the type, and use one of the strong type methods to extract the real value:
|
||||
|
||||
m.Get("code").Int()
|
||||
```go
|
||||
m.Get("code").Int()
|
||||
```
|
||||
|
||||
If there's no value there (or if it's the wrong type) then a default value will be returned, or you can be explicit about the default value.
|
||||
|
||||
Get("code").Int(-1)
|
||||
|
||||
```go
|
||||
Get("code").Int(-1)
|
||||
```
|
||||
If you're dealing with a slice of data as a value, Objx provides many useful methods for iterating, manipulating and selecting that data. You can find out more by exploring the index below.
|
||||
|
||||
### Reading data
|
||||
A simple example of how to use Objx:
|
||||
|
||||
// Use MustFromJSON to make an objx.Map from some JSON
|
||||
m := objx.MustFromJSON(`{"name": "Mat", "age": 30}`)
|
||||
```go
|
||||
// Use MustFromJSON to make an objx.Map from some JSON
|
||||
m := objx.MustFromJSON(`{"name": "Mat", "age": 30}`)
|
||||
|
||||
// Get the details
|
||||
name := m.Get("name").Str()
|
||||
age := m.Get("age").Int()
|
||||
// Get the details
|
||||
name := m.Get("name").Str()
|
||||
age := m.Get("age").Int()
|
||||
|
||||
// Get their nickname (or use their name if they don't have one)
|
||||
nickname := m.Get("nickname").Str(name)
|
||||
// Get their nickname (or use their name if they don't have one)
|
||||
nickname := m.Get("nickname").Str(name)
|
||||
```
|
||||
|
||||
### Ranging
|
||||
Since `objx.Map` is a `map[string]interface{}` you can treat it as such. For example, to `range` the data, do what you would expect:
|
||||
|
||||
m := objx.MustFromJSON(json)
|
||||
for key, value := range m {
|
||||
// Your code...
|
||||
}
|
||||
```go
|
||||
m := objx.MustFromJSON(json)
|
||||
for key, value := range m {
|
||||
// Your code...
|
||||
}
|
||||
```
|
||||
|
||||
## Installation
|
||||
To install Objx, use go get:
|
||||
|
||||
Generated
Vendored
+8
-1
@@ -61,7 +61,7 @@ func (w *RespWriterWrapper) Write(p []byte) (int, error) {
|
||||
|
||||
// WriteHeader persists initial statusCode for span attribution.
|
||||
// All calls to WriteHeader will be propagated to the underlying ResponseWriter
|
||||
// and will persist the statusCode from the first call.
|
||||
// and will persist the statusCode from the first call (except for informational response status codes).
|
||||
// Blocking consecutive calls to WriteHeader alters expected behavior and will
|
||||
// remove warning logs from net/http where developers will notice incorrect handler implementations.
|
||||
func (w *RespWriterWrapper) WriteHeader(statusCode int) {
|
||||
@@ -77,6 +77,13 @@ func (w *RespWriterWrapper) WriteHeader(statusCode int) {
|
||||
// parent method.
|
||||
func (w *RespWriterWrapper) writeHeader(statusCode int) {
|
||||
if !w.wroteHeader {
|
||||
// Ignore informational response status codes.
|
||||
// Based on https://github.com/golang/go/blob/go1.24.1/src/net/http/server.go#L1216
|
||||
if statusCode >= 100 && statusCode <= 199 && statusCode != http.StatusSwitchingProtocols {
|
||||
w.ResponseWriter.WriteHeader(statusCode)
|
||||
return
|
||||
}
|
||||
|
||||
w.wroteHeader = true
|
||||
w.statusCode = statusCode
|
||||
}
|
||||
|
||||
Generated
Vendored
+2
-2
@@ -19,8 +19,8 @@ import (
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/codes"
|
||||
"go.opentelemetry.io/otel/metric"
|
||||
"go.opentelemetry.io/otel/semconv/v1.39.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.39.0/httpconv"
|
||||
"go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.40.0/httpconv"
|
||||
)
|
||||
|
||||
type HTTPClient struct {
|
||||
|
||||
Generated
Vendored
+2
-2
@@ -20,8 +20,8 @@ import (
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/codes"
|
||||
"go.opentelemetry.io/otel/metric"
|
||||
"go.opentelemetry.io/otel/semconv/v1.39.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.39.0/httpconv"
|
||||
"go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.40.0/httpconv"
|
||||
)
|
||||
|
||||
type RequestTraceAttrsOpts struct {
|
||||
|
||||
Generated
Vendored
+1
-1
@@ -15,7 +15,7 @@ import (
|
||||
|
||||
"go.opentelemetry.io/otel"
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
semconvNew "go.opentelemetry.io/otel/semconv/v1.39.0"
|
||||
semconvNew "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
)
|
||||
|
||||
// SplitHostPort splits a network address hostport of the form "host",
|
||||
|
||||
Generated
Vendored
+24
-20
@@ -5,7 +5,6 @@ package otelhttp // import "go.opentelemetry.io/contrib/instrumentation/net/http
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/http/httptrace"
|
||||
@@ -16,7 +15,7 @@ import (
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/codes"
|
||||
"go.opentelemetry.io/otel/propagation"
|
||||
otelsemconv "go.opentelemetry.io/otel/semconv/v1.39.0"
|
||||
otelsemconv "go.opentelemetry.io/otel/semconv/v1.40.0"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
|
||||
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/request"
|
||||
@@ -85,8 +84,6 @@ func defaultTransportFormatter(_ string, r *http.Request) string {
|
||||
// RoundTrip creates a Span and propagates its context via the provided request's headers
|
||||
// before handing the request to the configured base RoundTripper. The created span will
|
||||
// end when the response body is closed or when a read from the body returns io.EOF.
|
||||
// If GetBody returns an error, the error is reported via otel.Handle and the request
|
||||
// continues with the original Body.
|
||||
func (t *Transport) RoundTrip(r *http.Request) (*http.Response, error) {
|
||||
requestStartTime := time.Now()
|
||||
for _, f := range t.filters {
|
||||
@@ -119,23 +116,26 @@ func (t *Transport) RoundTrip(r *http.Request) (*http.Response, error) {
|
||||
|
||||
r = r.Clone(ctx) // According to RoundTripper spec, we shouldn't modify the origin request.
|
||||
|
||||
// GetBody is preferred over direct access to Body if the function is set.
|
||||
// If the resulting body is nil or is NoBody, we don't want to mutate the body as it
|
||||
// will affect the identity of it in an unforeseeable way because we assert
|
||||
// ReadCloser fulfills a certain interface and it is indeed nil or NoBody.
|
||||
body := r.Body
|
||||
if r.GetBody != nil {
|
||||
b, err := r.GetBody()
|
||||
if err != nil {
|
||||
otel.Handle(fmt.Errorf("http.Request GetBody returned an error: %w", err))
|
||||
} else {
|
||||
body = b
|
||||
var lastBW *request.BodyWrapper // Records the last body wrapper. Can be nil.
|
||||
maybeWrapBody := func(body io.ReadCloser) io.ReadCloser {
|
||||
if body == nil || body == http.NoBody {
|
||||
return body
|
||||
}
|
||||
bw := request.NewBodyWrapper(body, func(int64) {})
|
||||
lastBW = bw
|
||||
return bw
|
||||
}
|
||||
|
||||
bw := request.NewBodyWrapper(body, func(int64) {})
|
||||
if body != nil && body != http.NoBody {
|
||||
r.Body = bw
|
||||
r.Body = maybeWrapBody(r.Body)
|
||||
if r.GetBody != nil {
|
||||
originalGetBody := r.GetBody
|
||||
r.GetBody = func() (io.ReadCloser, error) {
|
||||
b, err := originalGetBody()
|
||||
if err != nil {
|
||||
lastBW = nil // The underlying transport will fail to make a retry request, hence, record no data.
|
||||
return nil, err
|
||||
}
|
||||
return maybeWrapBody(b), nil
|
||||
}
|
||||
}
|
||||
|
||||
span.SetAttributes(t.semconv.RequestTraceAttrs(r)...)
|
||||
@@ -148,10 +148,14 @@ func (t *Transport) RoundTrip(r *http.Request) (*http.Response, error) {
|
||||
if err == nil {
|
||||
statusCode = res.StatusCode
|
||||
}
|
||||
var requestSize int64
|
||||
if lastBW != nil {
|
||||
requestSize = lastBW.BytesRead()
|
||||
}
|
||||
t.semconv.RecordMetrics(
|
||||
ctx,
|
||||
semconv.MetricData{
|
||||
RequestSize: bw.BytesRead(),
|
||||
RequestSize: requestSize,
|
||||
RequestDuration: time.Since(requestStartTime),
|
||||
},
|
||||
t.semconv.MetricOptions(semconv.MetricAttributes{
|
||||
|
||||
+1
-1
@@ -4,4 +4,4 @@
|
||||
package otelhttp // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
|
||||
|
||||
// Version is the current release version of the otelhttp instrumentation.
|
||||
const Version = "0.66.0"
|
||||
const Version = "0.67.0"
|
||||
Loaded 100 of 109 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user