Upgrade Golang packages (#18376)

1. Upgrade golang.org/x/net to 0.7.0
2. Upgrade helm.sh/helm/v3 to 3.11.1

Signed-off-by: AllForNothing <sshijun@vmware.com>
This commit is contained in:
Shijun Sun 2023-03-20 15:59:37 +08:00 committed by GitHub
parent 79c0a22ce8
commit 2b3f178a50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
325 changed files with 34067 additions and 7164 deletions

View File

@ -49,11 +49,11 @@ require (
github.com/opencontainers/go-digest v1.0.0
github.com/opencontainers/image-spec v1.1.0-rc2
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.13.0
github.com/prometheus/client_golang v1.14.0
github.com/robfig/cron v1.0.0 // indirect
github.com/robfig/cron/v3 v3.0.0
github.com/spf13/viper v1.8.1
github.com/stretchr/testify v1.8.0
github.com/stretchr/testify v1.8.1
github.com/tencentcloud/tencentcloud-sdk-go v1.0.62
github.com/theupdateframework/notary v0.6.1
github.com/vmihailenco/msgpack/v5 v5.0.0-rc.2
@ -65,21 +65,21 @@ require (
go.opentelemetry.io/otel/sdk v1.8.0
go.opentelemetry.io/otel/trace v1.8.0
go.uber.org/ratelimit v0.2.0
golang.org/x/crypto v0.1.0
golang.org/x/net v0.2.0
golang.org/x/crypto v0.5.0
golang.org/x/net v0.7.0
golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8
gopkg.in/h2non/gock.v1 v1.0.16
gopkg.in/yaml.v2 v2.4.0
helm.sh/helm/v3 v3.10.3
k8s.io/api v0.25.2
k8s.io/apimachinery v0.25.2
k8s.io/client-go v0.25.2
helm.sh/helm/v3 v3.11.1
k8s.io/api v0.26.0
k8s.io/apimachinery v0.26.0
k8s.io/client-go v0.26.0
)
require (
github.com/beego/beego/v2 v2.0.6
golang.org/x/text v0.4.0
golang.org/x/text v0.7.0
)
require (
@ -94,10 +94,8 @@ require (
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
github.com/Azure/go-ntlmssp v0.0.0-20200615164410-66371956d46c // indirect
github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible // indirect
github.com/Masterminds/semver/v3 v3.1.1 // indirect
github.com/Masterminds/semver/v3 v3.2.0 // indirect
github.com/Microsoft/go-winio v0.5.1 // indirect
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/Unknwon/goconfig v0.0.0-20160216183935-5f601ca6ef4d // indirect
github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412 // indirect
github.com/andres-erbsen/clock v0.0.0-20160526145045-9e14626cd129 // indirect
@ -112,13 +110,13 @@ require (
github.com/dnaeon/go-vcr v1.2.0 // indirect
github.com/docker/go v0.0.0-20160303222718-d30aec9fd63c // indirect
github.com/docker/go-metrics v0.0.1 // indirect
github.com/felixge/httpsnoop v1.0.2 // indirect
github.com/felixge/httpsnoop v1.0.3 // indirect
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-openapi/analysis v0.19.10 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.20.0 // indirect
github.com/go-stack/stack v1.8.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
@ -145,24 +143,24 @@ require (
github.com/magiconair/properties v1.8.5 // indirect
github.com/mailru/easyjson v0.7.6 // indirect
github.com/mattn/go-runewidth v0.0.9 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/mitchellh/mapstructure v1.4.3 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/pelletier/go-toml v1.9.3 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.37.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
github.com/satori/go.uuid v1.2.0 // indirect
github.com/shiena/ansicolor v0.0.0-20200904210342-c7312218db18 // indirect
github.com/sirupsen/logrus v1.8.1 // indirect
github.com/sirupsen/logrus v1.9.0 // indirect
github.com/spf13/afero v1.6.0 // indirect
github.com/spf13/cast v1.4.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/objx v0.4.0 // indirect
github.com/stretchr/objx v0.5.0 // indirect
github.com/subosito/gotenv v1.2.0 // indirect
github.com/vmihailenco/tagparser v0.1.2 // indirect
go.mongodb.org/mongo-driver v1.7.0 // indirect
@ -175,13 +173,13 @@ require (
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
go.uber.org/zap v1.19.0 // indirect
golang.org/x/sys v0.2.0 // indirect
golang.org/x/term v0.2.0 // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/term v0.5.0 // indirect
google.golang.org/api v0.61.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/cloud v0.0.0-20151119220103-975617b05ea8 // indirect
google.golang.org/genproto v0.0.0-20220502173005-c8bf987b8c21 // indirect
google.golang.org/grpc v1.47.0 // indirect
google.golang.org/grpc v1.49.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/dancannon/gorethink.v3 v3.0.5 // indirect
gopkg.in/fatih/pool.v2 v2.0.0 // indirect
@ -190,8 +188,8 @@ require (
gopkg.in/ini.v1 v1.62.0 // indirect
gopkg.in/square/go-jose.v2 v2.5.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/klog/v2 v2.70.1 // indirect
k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed // indirect
k8s.io/klog/v2 v2.80.1 // indirect
k8s.io/utils v0.0.0-20221107191617-1a15be271d1d // indirect
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect

View File

@ -87,8 +87,9 @@ github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible h1
github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0=
github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww=
github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y=
github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030IGemrRc=
github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs=
github.com/Masterminds/semver/v3 v3.2.0 h1:3MEsd0SM6jqZojhjLWWeBY+Kcjy9i6MQAeY7YgDP83g=
github.com/Masterminds/semver/v3 v3.2.0/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ=
github.com/Microsoft/go-winio v0.4.11/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA=
github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA=
github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw=
@ -113,9 +114,7 @@ github.com/Microsoft/hcsshim/test v0.0.0-20210227013316-43a75bb4edd3/go.mod h1:m
github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ=
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
github.com/PuerkitoBio/purell v1.1.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI=
github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M=
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
github.com/Shopify/logrus-bugsnag v0.0.0-20171204204709-577dee27f20d h1:UrqY+r/OJnIp5u0s1SbQ8dVfLCZJsnvazdBP5hS4iRs=
github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo=
@ -387,7 +386,7 @@ github.com/distribution/distribution v2.8.1+incompatible/go.mod h1:EgLm2NgWtdKgz
github.com/dnaeon/go-vcr v1.2.0 h1:zHCHvJYTMh1N7xnV7zf1m1GPBF9Ad0Jk/whtQ1663qI=
github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ=
github.com/docker/docker v20.10.9+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/docker v20.10.17+incompatible h1:JYCuMrWaVNophQTOrMMoSwudOVEfcegoZZrleKc1xwE=
github.com/docker/docker v20.10.21+incompatible h1:UTLdBmHk3bEY+w8qeO5KttOhy6OmXWsl/FEet9Uswog=
github.com/docker/go v0.0.0-20160303222718-d30aec9fd63c h1:Ggg7IiOtghyZzn3ozi31kPHpV6qSjMgmesXaWCijYNM=
github.com/docker/go v0.0.0-20160303222718-d30aec9fd63c/go.mod h1:CADgU4DSXK5QUlFslkQu2yW2TKzFZcXq/leZfM0UH5Q=
github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ=
@ -415,7 +414,7 @@ github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkg
github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
github.com/emicklei/go-restful v2.9.5+incompatible h1:spTtZBk5DYEvbxMVutUuTyh1Ao2r4iyvLdACqsl/Ljk=
github.com/emicklei/go-restful v2.9.5+incompatible/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
github.com/emicklei/go-restful/v3 v3.8.0 h1:eCZ8ulSerjdAiaNpF7GxXIE7ZCMo1moN1qX+S609eVw=
github.com/emicklei/go-restful/v3 v3.9.0 h1:XwGDlfxEnQZzuopoqxwSEllNcCOM9DhhFyhFIIGKwxE=
github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g=
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
@ -430,8 +429,9 @@ github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5/go.mod h1:a
github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/felixge/httpsnoop v1.0.2 h1:+nS9g82KMXccJ/wp0zyRW9ZBHFETmMGtkk+2CTTrW4o=
github.com/felixge/httpsnoop v1.0.2/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/felixge/httpsnoop v1.0.3 h1:s/nj+GCswXYzN5v2DpNMuMQYe+0DDwt5WVCU6CWBdXk=
github.com/felixge/httpsnoop v1.0.3/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=
github.com/fogleman/gg v1.3.0/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=
github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k=
@ -506,8 +506,8 @@ github.com/go-openapi/jsonreference v0.17.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3Hfo
github.com/go-openapi/jsonreference v0.18.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I=
github.com/go-openapi/jsonreference v0.19.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwohSTlpa0o73RUL1owJc=
github.com/go-openapi/jsonreference v0.19.3/go.mod h1:rjx6GuL8TTa9VaixXglHmQmIL98+wF9xc8zWvFonSJ8=
github.com/go-openapi/jsonreference v0.19.5 h1:1WJP/wi4OjB4iV8KVbH73rQaoialJrqv8gitZLxGLtM=
github.com/go-openapi/jsonreference v0.19.5/go.mod h1:RdybgQwPxbL4UEjuAruzK1x3nE69AqPYEJeo/TWfEeg=
github.com/go-openapi/jsonreference v0.20.0 h1:MYlu0sBgChmCfJxxUKZ8g1cPWFOB37YSZqewK7OKeyA=
github.com/go-openapi/jsonreference v0.20.0/go.mod h1:Ag74Ico3lPc+zR+qjn4XBUmXymS4zJbYVCZmcgkasdo=
github.com/go-openapi/loads v0.17.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU=
github.com/go-openapi/loads v0.18.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU=
github.com/go-openapi/loads v0.19.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU=
@ -672,7 +672,7 @@ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
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=
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-github/v35 v35.2.0/go.mod h1:s0515YVTI+IMrDoy9Y4pHt9ShGpzHvHO8rZ7L7acgvs=
github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk=
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
@ -916,7 +916,7 @@ github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/lib/pq v1.8.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/lib/pq v1.10.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/lib/pq v1.10.6 h1:jbk+ZieJ0D7EVGJYpL9QTz7/YW6UHbmdnZWYyK5cdBs=
github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw=
github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM=
github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4=
github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ=
@ -955,8 +955,9 @@ github.com/mattn/go-sqlite3 v1.10.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsO
github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
github.com/mattn/go-sqlite3 v1.14.7 h1:fxWBnXkxfM6sRiuH3bqJ4CfzZojMOLVc0UTsTglEghA=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 h1:I0XW9+e1XWDxdcEniV4rQAIOPUGDq67JSCiRCgGCZLI=
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=
github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo=
github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
github.com/miekg/pkcs11 v1.0.3/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs=
github.com/miekg/pkcs11 v1.1.1 h1:Ugu9pdy6vAYku5DEpVWVFPYnzV+bxB+iRdbuFSu7TvU=
@ -980,8 +981,8 @@ github.com/moby/sys/mountinfo v0.4.0/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2J
github.com/moby/sys/mountinfo v0.4.1/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2JI+6q0qou+A=
github.com/moby/sys/symlink v0.1.0/go.mod h1:GGDODQmbFOjFsXvfLVn3+ZRxkch54RkSiGqsZeMYowQ=
github.com/moby/term v0.0.0-20200312100748-672ec06f55cd/go.mod h1:DdlQx2hp0Ss5/fLikoLlEeIYiATotOjgB//nb973jeo=
github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6 h1:dcztxKSvZ4Id8iPpHERQBbIJfabdt4wUm5qy3wOL2Zc=
github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6/go.mod h1:E2VnQOmVuvZB6UYnnDB0qG5Nq/1tD9acaOpo6xmt0Kw=
github.com/moby/term v0.0.0-20221205130635-1aeaba878587 h1:HfkjXDfhgVaN5rmueG8cL8KKeFNecRCXFhaJ2qZ5SKA=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
@ -1046,7 +1047,7 @@ github.com/onsi/gomega v1.9.0/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoT
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
github.com/onsi/gomega v1.10.3/go.mod h1:V9xEwhxec5O8UDM77eCW8vLymOMltsqPVYWrpDsH8xc=
github.com/onsi/gomega v1.16.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY=
github.com/onsi/gomega v1.20.1 h1:PA/3qinGoukvymdIDV8pii6tiZgC8kbmJO6Z5+b002Q=
github.com/onsi/gomega v1.23.0 h1:/oxKu9c2HVap+F3PfKort2Hw5DEU+HGlW8n+tguWsys=
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk=
github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s=
github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s=
@ -1120,15 +1121,16 @@ github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeD
github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M=
github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0=
github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY=
github.com/prometheus/client_golang v1.13.0 h1:b71QUfeo5M8gq2+evJdTPfZhYMAU0uKPkyPJ7TPsloU=
github.com/prometheus/client_golang v1.13.0/go.mod h1:vTeo+zgvILHsnnj/39Ou/1fPN5nJFOEMgftOUOmlvYQ=
github.com/prometheus/client_golang v1.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj0VP62TMhnw=
github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y=
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M=
github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4=
github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w=
github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
@ -1195,8 +1197,9 @@ github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMB
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
@ -1237,8 +1240,9 @@ github.com/stretchr/objx v0.0.0-20180129172003-8a3f7159479f/go.mod h1:HFkY916IF+
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
github.com/stretchr/objx v0.4.0 h1:M2gUjqZET1qApGOWNSnZ49BAIMX4F/1plDv3+l31EJ4=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v0.0.0-20180303142811-b89eecf5ca5d/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
@ -1247,8 +1251,9 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s=
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww=
@ -1416,8 +1421,8 @@ golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5y
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.1.0 h1:MDRAIl0xIo9Io2xV565hzXHw3zVseKrJKodhohM5CjU=
golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw=
golang.org/x/crypto v0.5.0 h1:U/0M97KRkSFvyD/3FSmdP5W5swImpNgle/EHFhOsQPE=
golang.org/x/crypto v0.5.0/go.mod h1:NK/OQwhpMQP3MwtdjgLlYHnH9ebylxKWv3e0fK+mkQU=
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
@ -1524,8 +1529,8 @@ golang.org/x/net v0.0.0-20211013171255-e13a2654a71e/go.mod h1:9nx3DQGgdP8bBQD5qx
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/net v0.2.0 h1:sZfSu1wtKLGlWI4ZZayP0ck9Y73K1ynO6gqzTdBVdPU=
golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY=
golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g=
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/oauth2 v0.0.0-20180227000427-d7d64896b5ff/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
@ -1647,13 +1652,14 @@ golang.org/x/sys v0.0.0-20210818153620-00dd8d7831e7/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20211013075003-97ac67df715c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.2.0 h1:ljd4t30dBnAvMZaQCevtY0xLLD0A+bRZXbgLMLU1F/A=
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.2.0 h1:z85xZCsEl7bi/KwbNADeBYoOP0++7W1ipu+aGnpwzRM=
golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc=
golang.org/x/term v0.5.0 h1:n2a8QNdAb0sZNpU9R1ALUXBbY+w51fCQDN+7EdxNBsY=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@ -1663,8 +1669,8 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg=
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
@ -1835,8 +1841,8 @@ google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9K
google.golang.org/grpc v1.41.0/go.mod h1:U3l9uK9J0sini8mHphKoXyaqDA/8VyGnDee1zzIUK6k=
google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk=
google.golang.org/grpc v1.47.0 h1:9n77onPX5F3qfFCqjy9dhn8PbNQsIKeVU04J9G7umt8=
google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk=
google.golang.org/grpc v1.49.0 h1:WTLtQzmQori5FUH25Pq4WT22oCsv8USpQ+F6rqtsmxw=
google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
@ -1914,8 +1920,8 @@ gorm.io/gorm v1.21.4/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw=
gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk=
gotest.tools/v3 v3.0.3/go.mod h1:Z7Lb0S5l+klDB31fvDQX8ss/FlKDxtlFlw3Oa8Ymbl8=
helm.sh/helm/v3 v3.10.3 h1:wL7IUZ7Zyukm5Kz0OUmIFZgKHuAgByCrUcJBtY0kDyw=
helm.sh/helm/v3 v3.10.3/go.mod h1:CXOcs02AYvrlPMWARNYNRgf2rNP7gLJQsi/Ubd4EDrI=
helm.sh/helm/v3 v3.11.1 h1:cmL9fFohOoNQf+wnp2Wa0OhNFH0KFnSzEkVxi3fcc3I=
helm.sh/helm/v3 v3.11.1/go.mod h1:z/Bu/BylToGno/6dtNGuSmjRqxKq5gaH+FU0BPO+AQ8=
honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
@ -1927,21 +1933,21 @@ honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9
k8s.io/api v0.20.1/go.mod h1:KqwcCVogGxQY3nBlRpwt+wpAMF/KjaCc7RpywacvqUo=
k8s.io/api v0.20.4/go.mod h1:++lNL1AJMkDymriNniQsWRkMDzRaX2Y/POTUi8yvqYQ=
k8s.io/api v0.20.6/go.mod h1:X9e8Qag6JV/bL5G6bU8sdVRltWKmdHsFUGS3eVndqE8=
k8s.io/api v0.25.2 h1:v6G8RyFcwf0HR5jQGIAYlvtRNrxMJQG1xJzaSeVnIS8=
k8s.io/api v0.25.2/go.mod h1:qP1Rn4sCVFwx/xIhe+we2cwBLTXNcheRyYXwajonhy0=
k8s.io/api v0.26.0 h1:IpPlZnxBpV1xl7TGk/X6lFtpgjgntCg8PJ+qrPHAC7I=
k8s.io/api v0.26.0/go.mod h1:k6HDTaIFC8yn1i6pSClSqIwLABIcLV9l5Q4EcngKnQg=
k8s.io/apimachinery v0.20.1/go.mod h1:WlLqWAHZGg07AeltaI0MV5uk1Omp8xaN0JGLY6gkRpU=
k8s.io/apimachinery v0.20.4/go.mod h1:WlLqWAHZGg07AeltaI0MV5uk1Omp8xaN0JGLY6gkRpU=
k8s.io/apimachinery v0.20.6/go.mod h1:ejZXtW1Ra6V1O5H8xPBGz+T3+4gfkTCeExAHKU57MAc=
k8s.io/apimachinery v0.25.2 h1:WbxfAjCx+AeN8Ilp9joWnyJ6xu9OMeS/fsfjK/5zaQs=
k8s.io/apimachinery v0.25.2/go.mod h1:hqqA1X0bsgsxI6dXsJ4HnNTBOmJNxyPp8dw3u2fSHwA=
k8s.io/apimachinery v0.26.0 h1:1feANjElT7MvPqp0JT6F3Ss6TWDwmcjLypwoPpEf7zg=
k8s.io/apimachinery v0.26.0/go.mod h1:tnPmbONNJ7ByJNz9+n9kMjNP8ON+1qoAIIC70lztu74=
k8s.io/apiserver v0.20.1/go.mod h1:ro5QHeQkgMS7ZGpvf4tSMx6bBOgPfE+f52KwvXfScaU=
k8s.io/apiserver v0.20.4/go.mod h1:Mc80thBKOyy7tbvFtB4kJv1kbdD0eIH8k8vianJcbFM=
k8s.io/apiserver v0.20.6/go.mod h1:QIJXNt6i6JB+0YQRNcS0hdRHJlMhflFmsBDeSgT1r8Q=
k8s.io/client-go v0.20.1/go.mod h1:/zcHdt1TeWSd5HoUe6elJmHSQ6uLLgp4bIJHVEuy+/Y=
k8s.io/client-go v0.20.4/go.mod h1:LiMv25ND1gLUdBeYxBIwKpkSC5IsozMMmOOeSJboP+k=
k8s.io/client-go v0.20.6/go.mod h1:nNQMnOvEUEsOzRRFIIkdmYOjAZrC8bgq0ExboWSU1I0=
k8s.io/client-go v0.25.2 h1:SUPp9p5CwM0yXGQrwYurw9LWz+YtMwhWd0GqOsSiefo=
k8s.io/client-go v0.25.2/go.mod h1:i7cNU7N+yGQmJkewcRD2+Vuj4iz7b30kI8OcL3horQ4=
k8s.io/client-go v0.26.0 h1:lT1D3OfO+wIi9UFolCrifbjUUgu7CpLca0AD8ghRLI8=
k8s.io/client-go v0.26.0/go.mod h1:I2Sh57A79EQsDmn7F7ASpmru1cceh3ocVT9KlX2jEZg=
k8s.io/component-base v0.20.1/go.mod h1:guxkoJnNoh8LNrbtiQOlyp2Y2XFCZQmrcg2n/DeYNLk=
k8s.io/component-base v0.20.4/go.mod h1:t4p9EdiagbVCJKrQ1RsA5/V4rFQNDfRlevJajlGwgjI=
k8s.io/component-base v0.20.6/go.mod h1:6f1MPBAeI+mvuts3sIdtpjljHWBQ2cIy38oBIWMYnrM=
@ -1952,14 +1958,14 @@ k8s.io/cri-api v0.20.6/go.mod h1:ew44AjNXwyn1s0U4xCKGodU7J1HzBeZ1MpGrpa5r8Yc=
k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE=
k8s.io/klog/v2 v2.4.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y=
k8s.io/klog/v2 v2.70.1 h1:7aaoSdahviPmR+XkS7FyxlkkXs6tHISSG03RxleQAVQ=
k8s.io/klog/v2 v2.70.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4=
k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
k8s.io/kube-openapi v0.0.0-20201113171705-d219536bb9fd/go.mod h1:WOJ3KddDSol4tAGcJo0Tvi+dK12EcqSLqcWsryKMpfM=
k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1 h1:MQ8BAZPZlWk3S9K4a9NCkIFQtZShWqoha7snGixVgEA=
k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280 h1:+70TFaan3hfJzs+7VK2o+OGxg8HsuBr/5f6tVAjDu6E=
k8s.io/kubernetes v1.13.0/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk=
k8s.io/utils v0.0.0-20201110183641-67b214c5f920/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed h1:jAne/RjBTyawwAy0utX5eqigAwz/lQhTmy+Hr/Cpue4=
k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
k8s.io/utils v0.0.0-20221107191617-1a15be271d1d h1:0Smp/HP1OH4Rvhe+4B8nWGERtlqAGSftbSbbmm45oFs=
k8s.io/utils v0.0.0-20221107191617-1a15be271d1d/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
modernc.org/b v1.0.0/go.mod h1:uZWcZfRj1BpYzfN9JTerzlNUnnPsV9O2ZA8JsRcubNg=
modernc.org/cc/v3 v3.32.4/go.mod h1:0R6jl1aZlIl2avnYfbfHBS1QB6/f+16mihBObaBC878=
modernc.org/ccgo/v3 v3.9.2/go.mod h1:gnJpy6NIVqkETT+L5zPsQFj7L2kkhfPMzOghRNv/CFo=

View File

@ -4,23 +4,27 @@ run:
linters:
disable-all: true
enable:
- deadcode
- dupl
- errcheck
- gofmt
- goimports
- golint
- gosimple
- govet
- ineffassign
- misspell
- nakedret
- structcheck
- unused
- govet
- staticcheck
- deadcode
- errcheck
- varcheck
- unparam
- ineffassign
- nakedret
- gocyclo
- dupl
- goimports
- revive
- gosec
- gosimple
- typecheck
- unused
linters-settings:
gofmt:
simplify: true
dupl:
threshold: 400
threshold: 600

View File

@ -1,5 +1,25 @@
# Changelog
## 3.2.0 (2022-11-28)
### Added
- #190: Added text marshaling and unmarshaling
- #167: Added JSON marshalling for constraints (thanks @SimonTheLeg)
- #173: Implement encoding.TextMarshaler and encoding.TextUnmarshaler on Version (thanks @MarkRosemaker)
- #179: Added New() version constructor (thanks @kazhuravlev)
### Changed
- #182/#183: Updated CI testing setup
### Fixed
- #186: Fixing issue where validation of constraint section gave false positives
- #176: Fix constraints check with *-0 (thanks @mtt0)
- #181: Fixed Caret operator (^) gives unexpected results when the minor version in constraint is 0 (thanks @arshchimni)
- #161: Fixed godoc (thanks @afirth)
## 3.1.1 (2020-11-23)
### Fixed

View File

@ -134,6 +134,23 @@ func (cs Constraints) String() string {
return strings.Join(buf, " || ")
}
// UnmarshalText implements the encoding.TextUnmarshaler interface.
func (cs *Constraints) UnmarshalText(text []byte) error {
temp, err := NewConstraint(string(text))
if err != nil {
return err
}
*cs = *temp
return nil
}
// MarshalText implements the encoding.TextMarshaler interface.
func (cs Constraints) MarshalText() ([]byte, error) {
return []byte(cs.String()), nil
}
var constraintOps map[string]cfunc
var constraintRegex *regexp.Regexp
var constraintRangeRegex *regexp.Regexp
@ -180,8 +197,13 @@ func init() {
ops,
cvRegex))
// The first time a constraint shows up will look slightly different from
// future times it shows up due to a leading space or comma in a given
// string.
validConstraintRegex = regexp.MustCompile(fmt.Sprintf(
`^(\s*(%s)\s*(%s)\s*\,?)+$`,
`^(\s*(%s)\s*(%s)\s*)((?:\s+|,\s*)(%s)\s*(%s)\s*)*$`,
ops,
cvRegex,
ops,
cvRegex))
}
@ -233,7 +255,7 @@ func parseConstraint(c string) (*constraint, error) {
patchDirty := false
dirty := false
if isX(m[3]) || m[3] == "" {
ver = "0.0.0"
ver = fmt.Sprintf("0.0.0%s", m[6])
dirty = true
} else if isX(strings.TrimPrefix(m[4], ".")) || m[4] == "" {
minorDirty = true
@ -534,6 +556,10 @@ func constraintCaret(v *Version, c *constraint) (bool, error) {
}
return false, fmt.Errorf("%s does not have same minor version as %s. Expected minor versions to match when constraint major version is 0", v, c.orig)
}
// ^ when the minor is 0 and minor > 0 is =0.0.z
if c.con.Minor() == 0 && v.Minor() > 0 {
return false, fmt.Errorf("%s does not have same minor version as %s", v, c.orig)
}
// At this point the major is 0 and the minor is 0 and not dirty. The patch
// is not dirty so we need to check if they are equal. If they are not equal

View File

@ -3,12 +3,12 @@ Package semver provides the ability to work with Semantic Versions (http://semve
Specifically it provides the ability to:
* Parse semantic versions
* Sort semantic versions
* Check if a semantic version fits within a set of constraints
* Optionally work with a `v` prefix
- Parse semantic versions
- Sort semantic versions
- Check if a semantic version fits within a set of constraints
- Optionally work with a `v` prefix
Parsing Semantic Versions
# Parsing Semantic Versions
There are two functions that can parse semantic versions. The `StrictNewVersion`
function only parses valid version 2 semantic versions as outlined in the
@ -21,48 +21,48 @@ that can be sorted, compared, and used in constraints.
When parsing a version an optional error can be returned if there is an issue
parsing the version. For example,
v, err := semver.NewVersion("1.2.3-beta.1+b345")
v, err := semver.NewVersion("1.2.3-beta.1+b345")
The version object has methods to get the parts of the version, compare it to
other versions, convert the version back into a string, and get the original
string. For more details please see the documentation
at https://godoc.org/github.com/Masterminds/semver.
Sorting Semantic Versions
# Sorting Semantic Versions
A set of versions can be sorted using the `sort` package from the standard library.
For example,
raw := []string{"1.2.3", "1.0", "1.3", "2", "0.4.2",}
vs := make([]*semver.Version, len(raw))
for i, r := range raw {
v, err := semver.NewVersion(r)
if err != nil {
t.Errorf("Error parsing version: %s", err)
raw := []string{"1.2.3", "1.0", "1.3", "2", "0.4.2",}
vs := make([]*semver.Version, len(raw))
for i, r := range raw {
v, err := semver.NewVersion(r)
if err != nil {
t.Errorf("Error parsing version: %s", err)
}
vs[i] = v
}
vs[i] = v
}
sort.Sort(semver.Collection(vs))
sort.Sort(semver.Collection(vs))
Checking Version Constraints and Comparing Versions
# Checking Version Constraints and Comparing Versions
There are two methods for comparing versions. One uses comparison methods on
`Version` instances and the other is using Constraints. There are some important
differences to notes between these two methods of comparison.
1. When two versions are compared using functions such as `Compare`, `LessThan`,
and others it will follow the specification and always include prereleases
within the comparison. It will provide an answer valid with the comparison
spec section at https://semver.org/#spec-item-11
2. When constraint checking is used for checks or validation it will follow a
different set of rules that are common for ranges with tools like npm/js
and Rust/Cargo. This includes considering prereleases to be invalid if the
ranges does not include on. If you want to have it include pre-releases a
simple solution is to include `-0` in your range.
3. Constraint ranges can have some complex rules including the shorthard use of
~ and ^. For more details on those see the options below.
1. When two versions are compared using functions such as `Compare`, `LessThan`,
and others it will follow the specification and always include prereleases
within the comparison. It will provide an answer valid with the comparison
spec section at https://semver.org/#spec-item-11
2. When constraint checking is used for checks or validation it will follow a
different set of rules that are common for ranges with tools like npm/js
and Rust/Cargo. This includes considering prereleases to be invalid if the
ranges does not include on. If you want to have it include pre-releases a
simple solution is to include `-0` in your range.
3. Constraint ranges can have some complex rules including the shorthard use of
~ and ^. For more details on those see the options below.
There are differences between the two methods or checking versions because the
comparison methods on `Version` follow the specification while comparison ranges
@ -76,19 +76,19 @@ patters with their versions.
Checking a version against version constraints is one of the most featureful
parts of the package.
c, err := semver.NewConstraint(">= 1.2.3")
if err != nil {
// Handle constraint not being parsable.
}
c, err := semver.NewConstraint(">= 1.2.3")
if err != nil {
// Handle constraint not being parsable.
}
v, err := semver.NewVersion("1.3")
if err != nil {
// Handle version not being parsable.
}
// Check if the version meets the constraints. The a variable will be true.
a := c.Check(v)
v, err := semver.NewVersion("1.3")
if err != nil {
// Handle version not being parsable.
}
// Check if the version meets the constraints. The a variable will be true.
a := c.Check(v)
Basic Comparisons
# Basic Comparisons
There are two elements to the comparisons. First, a comparison string is a list
of comma or space separated AND comparisons. These are then separated by || (OR)
@ -99,31 +99,31 @@ greater than or equal to 4.2.3. This can also be written as
The basic comparisons are:
* `=`: equal (aliased to no operator)
* `!=`: not equal
* `>`: greater than
* `<`: less than
* `>=`: greater than or equal to
* `<=`: less than or equal to
- `=`: equal (aliased to no operator)
- `!=`: not equal
- `>`: greater than
- `<`: less than
- `>=`: greater than or equal to
- `<=`: less than or equal to
Hyphen Range Comparisons
# Hyphen Range Comparisons
There are multiple methods to handle ranges and the first is hyphens ranges.
These look like:
* `1.2 - 1.4.5` which is equivalent to `>= 1.2, <= 1.4.5`
* `2.3.4 - 4.5` which is equivalent to `>= 2.3.4 <= 4.5`
- `1.2 - 1.4.5` which is equivalent to `>= 1.2, <= 1.4.5`
- `2.3.4 - 4.5` which is equivalent to `>= 2.3.4 <= 4.5`
Wildcards In Comparisons
# Wildcards In Comparisons
The `x`, `X`, and `*` characters can be used as a wildcard character. This works
for all comparison operators. When used on the `=` operator it falls
back to the tilde operation. For example,
* `1.2.x` is equivalent to `>= 1.2.0 < 1.3.0`
* `>= 1.2.x` is equivalent to `>= 1.2.0`
* `<= 2.x` is equivalent to `<= 3`
* `*` is equivalent to `>= 0.0.0`
- `1.2.x` is equivalent to `>= 1.2.0 < 1.3.0`
- `>= 1.2.x` is equivalent to `>= 1.2.0`
- `<= 2.x` is equivalent to `<= 3`
- `*` is equivalent to `>= 0.0.0`
Tilde Range Comparisons (Patch)
@ -131,11 +131,11 @@ The tilde (`~`) comparison operator is for patch level ranges when a minor
version is specified and major level changes when the minor number is missing.
For example,
* `~1.2.3` is equivalent to `>= 1.2.3 < 1.3.0`
* `~1` is equivalent to `>= 1, < 2`
* `~2.3` is equivalent to `>= 2.3 < 2.4`
* `~1.2.x` is equivalent to `>= 1.2.0 < 1.3.0`
* `~1.x` is equivalent to `>= 1 < 2`
- `~1.2.3` is equivalent to `>= 1.2.3 < 1.3.0`
- `~1` is equivalent to `>= 1, < 2`
- `~2.3` is equivalent to `>= 2.3 < 2.4`
- `~1.2.x` is equivalent to `>= 1.2.0 < 1.3.0`
- `~1.x` is equivalent to `>= 1 < 2`
Caret Range Comparisons (Major)
@ -144,41 +144,41 @@ The caret (`^`) comparison operator is for major level changes once a stable
as the API stability level. This is useful when comparisons of API versions as a
major change is API breaking. For example,
* `^1.2.3` is equivalent to `>= 1.2.3, < 2.0.0`
* `^1.2.x` is equivalent to `>= 1.2.0, < 2.0.0`
* `^2.3` is equivalent to `>= 2.3, < 3`
* `^2.x` is equivalent to `>= 2.0.0, < 3`
* `^0.2.3` is equivalent to `>=0.2.3 <0.3.0`
* `^0.2` is equivalent to `>=0.2.0 <0.3.0`
* `^0.0.3` is equivalent to `>=0.0.3 <0.0.4`
* `^0.0` is equivalent to `>=0.0.0 <0.1.0`
* `^0` is equivalent to `>=0.0.0 <1.0.0`
- `^1.2.3` is equivalent to `>= 1.2.3, < 2.0.0`
- `^1.2.x` is equivalent to `>= 1.2.0, < 2.0.0`
- `^2.3` is equivalent to `>= 2.3, < 3`
- `^2.x` is equivalent to `>= 2.0.0, < 3`
- `^0.2.3` is equivalent to `>=0.2.3 <0.3.0`
- `^0.2` is equivalent to `>=0.2.0 <0.3.0`
- `^0.0.3` is equivalent to `>=0.0.3 <0.0.4`
- `^0.0` is equivalent to `>=0.0.0 <0.1.0`
- `^0` is equivalent to `>=0.0.0 <1.0.0`
Validation
# Validation
In addition to testing a version against a constraint, a version can be validated
against a constraint. When validation fails a slice of errors containing why a
version didn't meet the constraint is returned. For example,
c, err := semver.NewConstraint("<= 1.2.3, >= 1.4")
if err != nil {
// Handle constraint not being parseable.
}
c, err := semver.NewConstraint("<= 1.2.3, >= 1.4")
if err != nil {
// Handle constraint not being parseable.
}
v, _ := semver.NewVersion("1.3")
if err != nil {
// Handle version not being parseable.
}
v, _ := semver.NewVersion("1.3")
if err != nil {
// Handle version not being parseable.
}
// Validate a version against a constraint.
a, msgs := c.Validate(v)
// a is false
for _, m := range msgs {
fmt.Println(m)
// Validate a version against a constraint.
a, msgs := c.Validate(v)
// a is false
for _, m := range msgs {
fmt.Println(m)
// Loops over the errors which would read
// "1.3 is greater than 1.2.3"
// "1.3 is less than 1.4"
}
// Loops over the errors which would read
// "1.3 is greater than 1.2.3"
// "1.3 is less than 1.4"
}
*/
package semver

View File

@ -55,14 +55,16 @@ func init() {
versionRegex = regexp.MustCompile("^" + semVerRegex + "$")
}
const num string = "0123456789"
const allowed string = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-" + num
const (
num string = "0123456789"
allowed string = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-" + num
)
// StrictNewVersion parses a given version and returns an instance of Version or
// an error if unable to parse the version. Only parses valid semantic versions.
// Performs checking that can find errors within the version.
// If you want to coerce a version, such as 1 or 1.2, and perse that as the 1.x
// releases of semver provided use the NewSemver() function.
// If you want to coerce a version such as 1 or 1.2 and parse it as the 1.x
// releases of semver did, use the NewVersion() function.
func StrictNewVersion(v string) (*Version, error) {
// Parsing here does not use RegEx in order to increase performance and reduce
// allocations.
@ -207,6 +209,23 @@ func NewVersion(v string) (*Version, error) {
return sv, nil
}
// New creates a new instance of Version with each of the parts passed in as
// arguments instead of parsing a version string.
func New(major, minor, patch uint64, pre, metadata string) *Version {
v := Version{
major: major,
minor: minor,
patch: patch,
pre: pre,
metadata: metadata,
original: "",
}
v.original = v.String()
return &v
}
// MustParse parses a given version and panics on error.
func MustParse(v string) *Version {
sv, err := NewVersion(v)
@ -267,7 +286,6 @@ func (v Version) Metadata() string {
// originalVPrefix returns the original 'v' prefix if any.
func (v Version) originalVPrefix() string {
// Note, only lowercase v is supported as a prefix by the parser.
if v.original != "" && v.original[:1] == "v" {
return v.original[:1]
@ -436,6 +454,23 @@ func (v Version) MarshalJSON() ([]byte, error) {
return json.Marshal(v.String())
}
// UnmarshalText implements the encoding.TextUnmarshaler interface.
func (v *Version) UnmarshalText(text []byte) error {
temp, err := NewVersion(string(text))
if err != nil {
return err
}
*v = *temp
return nil
}
// MarshalText implements the encoding.TextMarshaler interface.
func (v Version) MarshalText() ([]byte, error) {
return []byte(v.String()), nil
}
// Scan implements the SQL.Scanner interface.
func (v *Version) Scan(value interface{}) error {
var s string
@ -470,7 +505,6 @@ func compareSegment(v, o uint64) int {
}
func comparePrerelease(v, o string) int {
// split the prelease versions by their part. The separator, per the spec,
// is a .
sparts := strings.Split(v, ".")
@ -562,7 +596,6 @@ func comparePrePart(s, o string) int {
return 1
}
return -1
}
// Like strings.ContainsAny but does an only instead of any.

View File

@ -1,5 +0,0 @@
*.sublime-*
.DS_Store
*.swp
*.swo
tags

View File

@ -1,12 +0,0 @@
language: go
go:
- 1.4.x
- 1.5.x
- 1.6.x
- 1.7.x
- 1.8.x
- 1.9.x
- "1.10.x"
- "1.11.x"
- tip

View File

@ -1,12 +0,0 @@
Copyright (c) 2012, Martin Angers
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -1,188 +0,0 @@
# Purell
Purell is a tiny Go library to normalize URLs. It returns a pure URL. Pure-ell. Sanitizer and all. Yeah, I know...
Based on the [wikipedia paper][wiki] and the [RFC 3986 document][rfc].
[![build status](https://travis-ci.org/PuerkitoBio/purell.svg?branch=master)](http://travis-ci.org/PuerkitoBio/purell)
## Install
`go get github.com/PuerkitoBio/purell`
## Changelog
* **v1.1.1** : Fix failing test due to Go1.12 changes (thanks to @ianlancetaylor).
* **2016-11-14 (v1.1.0)** : IDN: Conform to RFC 5895: Fold character width (thanks to @beeker1121).
* **2016-07-27 (v1.0.0)** : Normalize IDN to ASCII (thanks to @zenovich).
* **2015-02-08** : Add fix for relative paths issue ([PR #5][pr5]) and add fix for unnecessary encoding of reserved characters ([see issue #7][iss7]).
* **v0.2.0** : Add benchmarks, Attempt IDN support.
* **v0.1.0** : Initial release.
## Examples
From `example_test.go` (note that in your code, you would import "github.com/PuerkitoBio/purell", and would prefix references to its methods and constants with "purell."):
```go
package purell
import (
"fmt"
"net/url"
)
func ExampleNormalizeURLString() {
if normalized, err := NormalizeURLString("hTTp://someWEBsite.com:80/Amazing%3f/url/",
FlagLowercaseScheme|FlagLowercaseHost|FlagUppercaseEscapes); err != nil {
panic(err)
} else {
fmt.Print(normalized)
}
// Output: http://somewebsite.com:80/Amazing%3F/url/
}
func ExampleMustNormalizeURLString() {
normalized := MustNormalizeURLString("hTTpS://someWEBsite.com:443/Amazing%fa/url/",
FlagsUnsafeGreedy)
fmt.Print(normalized)
// Output: http://somewebsite.com/Amazing%FA/url
}
func ExampleNormalizeURL() {
if u, err := url.Parse("Http://SomeUrl.com:8080/a/b/.././c///g?c=3&a=1&b=9&c=0#target"); err != nil {
panic(err)
} else {
normalized := NormalizeURL(u, FlagsUsuallySafeGreedy|FlagRemoveDuplicateSlashes|FlagRemoveFragment)
fmt.Print(normalized)
}
// Output: http://someurl.com:8080/a/c/g?c=3&a=1&b=9&c=0
}
```
## API
As seen in the examples above, purell offers three methods, `NormalizeURLString(string, NormalizationFlags) (string, error)`, `MustNormalizeURLString(string, NormalizationFlags) (string)` and `NormalizeURL(*url.URL, NormalizationFlags) (string)`. They all normalize the provided URL based on the specified flags. Here are the available flags:
```go
const (
// Safe normalizations
FlagLowercaseScheme NormalizationFlags = 1 << iota // HTTP://host -> http://host, applied by default in Go1.1
FlagLowercaseHost // http://HOST -> http://host
FlagUppercaseEscapes // http://host/t%ef -> http://host/t%EF
FlagDecodeUnnecessaryEscapes // http://host/t%41 -> http://host/tA
FlagEncodeNecessaryEscapes // http://host/!"#$ -> http://host/%21%22#$
FlagRemoveDefaultPort // http://host:80 -> http://host
FlagRemoveEmptyQuerySeparator // http://host/path? -> http://host/path
// Usually safe normalizations
FlagRemoveTrailingSlash // http://host/path/ -> http://host/path
FlagAddTrailingSlash // http://host/path -> http://host/path/ (should choose only one of these add/remove trailing slash flags)
FlagRemoveDotSegments // http://host/path/./a/b/../c -> http://host/path/a/c
// Unsafe normalizations
FlagRemoveDirectoryIndex // http://host/path/index.html -> http://host/path/
FlagRemoveFragment // http://host/path#fragment -> http://host/path
FlagForceHTTP // https://host -> http://host
FlagRemoveDuplicateSlashes // http://host/path//a///b -> http://host/path/a/b
FlagRemoveWWW // http://www.host/ -> http://host/
FlagAddWWW // http://host/ -> http://www.host/ (should choose only one of these add/remove WWW flags)
FlagSortQuery // http://host/path?c=3&b=2&a=1&b=1 -> http://host/path?a=1&b=1&b=2&c=3
// Normalizations not in the wikipedia article, required to cover tests cases
// submitted by jehiah
FlagDecodeDWORDHost // http://1113982867 -> http://66.102.7.147
FlagDecodeOctalHost // http://0102.0146.07.0223 -> http://66.102.7.147
FlagDecodeHexHost // http://0x42660793 -> http://66.102.7.147
FlagRemoveUnnecessaryHostDots // http://.host../path -> http://host/path
FlagRemoveEmptyPortSeparator // http://host:/path -> http://host/path
// Convenience set of safe normalizations
FlagsSafe NormalizationFlags = FlagLowercaseHost | FlagLowercaseScheme | FlagUppercaseEscapes | FlagDecodeUnnecessaryEscapes | FlagEncodeNecessaryEscapes | FlagRemoveDefaultPort | FlagRemoveEmptyQuerySeparator
// For convenience sets, "greedy" uses the "remove trailing slash" and "remove www. prefix" flags,
// while "non-greedy" uses the "add (or keep) the trailing slash" and "add www. prefix".
// Convenience set of usually safe normalizations (includes FlagsSafe)
FlagsUsuallySafeGreedy NormalizationFlags = FlagsSafe | FlagRemoveTrailingSlash | FlagRemoveDotSegments
FlagsUsuallySafeNonGreedy NormalizationFlags = FlagsSafe | FlagAddTrailingSlash | FlagRemoveDotSegments
// Convenience set of unsafe normalizations (includes FlagsUsuallySafe)
FlagsUnsafeGreedy NormalizationFlags = FlagsUsuallySafeGreedy | FlagRemoveDirectoryIndex | FlagRemoveFragment | FlagForceHTTP | FlagRemoveDuplicateSlashes | FlagRemoveWWW | FlagSortQuery
FlagsUnsafeNonGreedy NormalizationFlags = FlagsUsuallySafeNonGreedy | FlagRemoveDirectoryIndex | FlagRemoveFragment | FlagForceHTTP | FlagRemoveDuplicateSlashes | FlagAddWWW | FlagSortQuery
// Convenience set of all available flags
FlagsAllGreedy = FlagsUnsafeGreedy | FlagDecodeDWORDHost | FlagDecodeOctalHost | FlagDecodeHexHost | FlagRemoveUnnecessaryHostDots | FlagRemoveEmptyPortSeparator
FlagsAllNonGreedy = FlagsUnsafeNonGreedy | FlagDecodeDWORDHost | FlagDecodeOctalHost | FlagDecodeHexHost | FlagRemoveUnnecessaryHostDots | FlagRemoveEmptyPortSeparator
)
```
For convenience, the set of flags `FlagsSafe`, `FlagsUsuallySafe[Greedy|NonGreedy]`, `FlagsUnsafe[Greedy|NonGreedy]` and `FlagsAll[Greedy|NonGreedy]` are provided for the similarly grouped normalizations on [wikipedia's URL normalization page][wiki]. You can add (using the bitwise OR `|` operator) or remove (using the bitwise AND NOT `&^` operator) individual flags from the sets if required, to build your own custom set.
The [full godoc reference is available on gopkgdoc][godoc].
Some things to note:
* `FlagDecodeUnnecessaryEscapes`, `FlagEncodeNecessaryEscapes`, `FlagUppercaseEscapes` and `FlagRemoveEmptyQuerySeparator` are always implicitly set, because internally, the URL string is parsed as an URL object, which automatically decodes unnecessary escapes, uppercases and encodes necessary ones, and removes empty query separators (an unnecessary `?` at the end of the url). So this operation cannot **not** be done. For this reason, `FlagRemoveEmptyQuerySeparator` (as well as the other three) has been included in the `FlagsSafe` convenience set, instead of `FlagsUnsafe`, where Wikipedia puts it.
* The `FlagDecodeUnnecessaryEscapes` decodes the following escapes (*from -> to*):
- %24 -> $
- %26 -> &
- %2B-%3B -> +,-./0123456789:;
- %3D -> =
- %40-%5A -> @ABCDEFGHIJKLMNOPQRSTUVWXYZ
- %5F -> _
- %61-%7A -> abcdefghijklmnopqrstuvwxyz
- %7E -> ~
* When the `NormalizeURL` function is used (passing an URL object), this source URL object is modified (that is, after the call, the URL object will be modified to reflect the normalization).
* The *replace IP with domain name* normalization (`http://208.77.188.166/ → http://www.example.com/`) is obviously not possible for a library without making some network requests. This is not implemented in purell.
* The *remove unused query string parameters* and *remove default query parameters* are also not implemented, since this is a very case-specific normalization, and it is quite trivial to do with an URL object.
### Safe vs Usually Safe vs Unsafe
Purell allows you to control the level of risk you take while normalizing an URL. You can aggressively normalize, play it totally safe, or anything in between.
Consider the following URL:
`HTTPS://www.RooT.com/toto/t%45%1f///a/./b/../c/?z=3&w=2&a=4&w=1#invalid`
Normalizing with the `FlagsSafe` gives:
`https://www.root.com/toto/tE%1F///a/./b/../c/?z=3&w=2&a=4&w=1#invalid`
With the `FlagsUsuallySafeGreedy`:
`https://www.root.com/toto/tE%1F///a/c?z=3&w=2&a=4&w=1#invalid`
And with `FlagsUnsafeGreedy`:
`http://root.com/toto/tE%1F/a/c?a=4&w=1&w=2&z=3`
## TODOs
* Add a class/default instance to allow specifying custom directory index names? At the moment, removing directory index removes `(^|/)((?:default|index)\.\w{1,4})$`.
## Thanks / Contributions
@rogpeppe
@jehiah
@opennota
@pchristopher1275
@zenovich
@beeker1121
## License
The [BSD 3-Clause license][bsd].
[bsd]: http://opensource.org/licenses/BSD-3-Clause
[wiki]: http://en.wikipedia.org/wiki/URL_normalization
[rfc]: http://tools.ietf.org/html/rfc3986#section-6
[godoc]: http://go.pkgdoc.org/github.com/PuerkitoBio/purell
[pr5]: https://github.com/PuerkitoBio/purell/pull/5
[iss7]: https://github.com/PuerkitoBio/purell/issues/7

View File

@ -1,379 +0,0 @@
/*
Package purell offers URL normalization as described on the wikipedia page:
http://en.wikipedia.org/wiki/URL_normalization
*/
package purell
import (
"bytes"
"fmt"
"net/url"
"regexp"
"sort"
"strconv"
"strings"
"github.com/PuerkitoBio/urlesc"
"golang.org/x/net/idna"
"golang.org/x/text/unicode/norm"
"golang.org/x/text/width"
)
// A set of normalization flags determines how a URL will
// be normalized.
type NormalizationFlags uint
const (
// Safe normalizations
FlagLowercaseScheme NormalizationFlags = 1 << iota // HTTP://host -> http://host, applied by default in Go1.1
FlagLowercaseHost // http://HOST -> http://host
FlagUppercaseEscapes // http://host/t%ef -> http://host/t%EF
FlagDecodeUnnecessaryEscapes // http://host/t%41 -> http://host/tA
FlagEncodeNecessaryEscapes // http://host/!"#$ -> http://host/%21%22#$
FlagRemoveDefaultPort // http://host:80 -> http://host
FlagRemoveEmptyQuerySeparator // http://host/path? -> http://host/path
// Usually safe normalizations
FlagRemoveTrailingSlash // http://host/path/ -> http://host/path
FlagAddTrailingSlash // http://host/path -> http://host/path/ (should choose only one of these add/remove trailing slash flags)
FlagRemoveDotSegments // http://host/path/./a/b/../c -> http://host/path/a/c
// Unsafe normalizations
FlagRemoveDirectoryIndex // http://host/path/index.html -> http://host/path/
FlagRemoveFragment // http://host/path#fragment -> http://host/path
FlagForceHTTP // https://host -> http://host
FlagRemoveDuplicateSlashes // http://host/path//a///b -> http://host/path/a/b
FlagRemoveWWW // http://www.host/ -> http://host/
FlagAddWWW // http://host/ -> http://www.host/ (should choose only one of these add/remove WWW flags)
FlagSortQuery // http://host/path?c=3&b=2&a=1&b=1 -> http://host/path?a=1&b=1&b=2&c=3
// Normalizations not in the wikipedia article, required to cover tests cases
// submitted by jehiah
FlagDecodeDWORDHost // http://1113982867 -> http://66.102.7.147
FlagDecodeOctalHost // http://0102.0146.07.0223 -> http://66.102.7.147
FlagDecodeHexHost // http://0x42660793 -> http://66.102.7.147
FlagRemoveUnnecessaryHostDots // http://.host../path -> http://host/path
FlagRemoveEmptyPortSeparator // http://host:/path -> http://host/path
// Convenience set of safe normalizations
FlagsSafe NormalizationFlags = FlagLowercaseHost | FlagLowercaseScheme | FlagUppercaseEscapes | FlagDecodeUnnecessaryEscapes | FlagEncodeNecessaryEscapes | FlagRemoveDefaultPort | FlagRemoveEmptyQuerySeparator
// For convenience sets, "greedy" uses the "remove trailing slash" and "remove www. prefix" flags,
// while "non-greedy" uses the "add (or keep) the trailing slash" and "add www. prefix".
// Convenience set of usually safe normalizations (includes FlagsSafe)
FlagsUsuallySafeGreedy NormalizationFlags = FlagsSafe | FlagRemoveTrailingSlash | FlagRemoveDotSegments
FlagsUsuallySafeNonGreedy NormalizationFlags = FlagsSafe | FlagAddTrailingSlash | FlagRemoveDotSegments
// Convenience set of unsafe normalizations (includes FlagsUsuallySafe)
FlagsUnsafeGreedy NormalizationFlags = FlagsUsuallySafeGreedy | FlagRemoveDirectoryIndex | FlagRemoveFragment | FlagForceHTTP | FlagRemoveDuplicateSlashes | FlagRemoveWWW | FlagSortQuery
FlagsUnsafeNonGreedy NormalizationFlags = FlagsUsuallySafeNonGreedy | FlagRemoveDirectoryIndex | FlagRemoveFragment | FlagForceHTTP | FlagRemoveDuplicateSlashes | FlagAddWWW | FlagSortQuery
// Convenience set of all available flags
FlagsAllGreedy = FlagsUnsafeGreedy | FlagDecodeDWORDHost | FlagDecodeOctalHost | FlagDecodeHexHost | FlagRemoveUnnecessaryHostDots | FlagRemoveEmptyPortSeparator
FlagsAllNonGreedy = FlagsUnsafeNonGreedy | FlagDecodeDWORDHost | FlagDecodeOctalHost | FlagDecodeHexHost | FlagRemoveUnnecessaryHostDots | FlagRemoveEmptyPortSeparator
)
const (
defaultHttpPort = ":80"
defaultHttpsPort = ":443"
)
// Regular expressions used by the normalizations
var rxPort = regexp.MustCompile(`(:\d+)/?$`)
var rxDirIndex = regexp.MustCompile(`(^|/)((?:default|index)\.\w{1,4})$`)
var rxDupSlashes = regexp.MustCompile(`/{2,}`)
var rxDWORDHost = regexp.MustCompile(`^(\d+)((?:\.+)?(?:\:\d*)?)$`)
var rxOctalHost = regexp.MustCompile(`^(0\d*)\.(0\d*)\.(0\d*)\.(0\d*)((?:\.+)?(?:\:\d*)?)$`)
var rxHexHost = regexp.MustCompile(`^0x([0-9A-Fa-f]+)((?:\.+)?(?:\:\d*)?)$`)
var rxHostDots = regexp.MustCompile(`^(.+?)(:\d+)?$`)
var rxEmptyPort = regexp.MustCompile(`:+$`)
// Map of flags to implementation function.
// FlagDecodeUnnecessaryEscapes has no action, since it is done automatically
// by parsing the string as an URL. Same for FlagUppercaseEscapes and FlagRemoveEmptyQuerySeparator.
// Since maps have undefined traversing order, make a slice of ordered keys
var flagsOrder = []NormalizationFlags{
FlagLowercaseScheme,
FlagLowercaseHost,
FlagRemoveDefaultPort,
FlagRemoveDirectoryIndex,
FlagRemoveDotSegments,
FlagRemoveFragment,
FlagForceHTTP, // Must be after remove default port (because https=443/http=80)
FlagRemoveDuplicateSlashes,
FlagRemoveWWW,
FlagAddWWW,
FlagSortQuery,
FlagDecodeDWORDHost,
FlagDecodeOctalHost,
FlagDecodeHexHost,
FlagRemoveUnnecessaryHostDots,
FlagRemoveEmptyPortSeparator,
FlagRemoveTrailingSlash, // These two (add/remove trailing slash) must be last
FlagAddTrailingSlash,
}
// ... and then the map, where order is unimportant
var flags = map[NormalizationFlags]func(*url.URL){
FlagLowercaseScheme: lowercaseScheme,
FlagLowercaseHost: lowercaseHost,
FlagRemoveDefaultPort: removeDefaultPort,
FlagRemoveDirectoryIndex: removeDirectoryIndex,
FlagRemoveDotSegments: removeDotSegments,
FlagRemoveFragment: removeFragment,
FlagForceHTTP: forceHTTP,
FlagRemoveDuplicateSlashes: removeDuplicateSlashes,
FlagRemoveWWW: removeWWW,
FlagAddWWW: addWWW,
FlagSortQuery: sortQuery,
FlagDecodeDWORDHost: decodeDWORDHost,
FlagDecodeOctalHost: decodeOctalHost,
FlagDecodeHexHost: decodeHexHost,
FlagRemoveUnnecessaryHostDots: removeUnncessaryHostDots,
FlagRemoveEmptyPortSeparator: removeEmptyPortSeparator,
FlagRemoveTrailingSlash: removeTrailingSlash,
FlagAddTrailingSlash: addTrailingSlash,
}
// MustNormalizeURLString returns the normalized string, and panics if an error occurs.
// It takes an URL string as input, as well as the normalization flags.
func MustNormalizeURLString(u string, f NormalizationFlags) string {
result, e := NormalizeURLString(u, f)
if e != nil {
panic(e)
}
return result
}
// NormalizeURLString returns the normalized string, or an error if it can't be parsed into an URL object.
// It takes an URL string as input, as well as the normalization flags.
func NormalizeURLString(u string, f NormalizationFlags) (string, error) {
parsed, err := url.Parse(u)
if err != nil {
return "", err
}
if f&FlagLowercaseHost == FlagLowercaseHost {
parsed.Host = strings.ToLower(parsed.Host)
}
// The idna package doesn't fully conform to RFC 5895
// (https://tools.ietf.org/html/rfc5895), so we do it here.
// Taken from Go 1.8 cycle source, courtesy of bradfitz.
// TODO: Remove when (if?) idna package conforms to RFC 5895.
parsed.Host = width.Fold.String(parsed.Host)
parsed.Host = norm.NFC.String(parsed.Host)
if parsed.Host, err = idna.ToASCII(parsed.Host); err != nil {
return "", err
}
return NormalizeURL(parsed, f), nil
}
// NormalizeURL returns the normalized string.
// It takes a parsed URL object as input, as well as the normalization flags.
func NormalizeURL(u *url.URL, f NormalizationFlags) string {
for _, k := range flagsOrder {
if f&k == k {
flags[k](u)
}
}
return urlesc.Escape(u)
}
func lowercaseScheme(u *url.URL) {
if len(u.Scheme) > 0 {
u.Scheme = strings.ToLower(u.Scheme)
}
}
func lowercaseHost(u *url.URL) {
if len(u.Host) > 0 {
u.Host = strings.ToLower(u.Host)
}
}
func removeDefaultPort(u *url.URL) {
if len(u.Host) > 0 {
scheme := strings.ToLower(u.Scheme)
u.Host = rxPort.ReplaceAllStringFunc(u.Host, func(val string) string {
if (scheme == "http" && val == defaultHttpPort) || (scheme == "https" && val == defaultHttpsPort) {
return ""
}
return val
})
}
}
func removeTrailingSlash(u *url.URL) {
if l := len(u.Path); l > 0 {
if strings.HasSuffix(u.Path, "/") {
u.Path = u.Path[:l-1]
}
} else if l = len(u.Host); l > 0 {
if strings.HasSuffix(u.Host, "/") {
u.Host = u.Host[:l-1]
}
}
}
func addTrailingSlash(u *url.URL) {
if l := len(u.Path); l > 0 {
if !strings.HasSuffix(u.Path, "/") {
u.Path += "/"
}
} else if l = len(u.Host); l > 0 {
if !strings.HasSuffix(u.Host, "/") {
u.Host += "/"
}
}
}
func removeDotSegments(u *url.URL) {
if len(u.Path) > 0 {
var dotFree []string
var lastIsDot bool
sections := strings.Split(u.Path, "/")
for _, s := range sections {
if s == ".." {
if len(dotFree) > 0 {
dotFree = dotFree[:len(dotFree)-1]
}
} else if s != "." {
dotFree = append(dotFree, s)
}
lastIsDot = (s == "." || s == "..")
}
// Special case if host does not end with / and new path does not begin with /
u.Path = strings.Join(dotFree, "/")
if u.Host != "" && !strings.HasSuffix(u.Host, "/") && !strings.HasPrefix(u.Path, "/") {
u.Path = "/" + u.Path
}
// Special case if the last segment was a dot, make sure the path ends with a slash
if lastIsDot && !strings.HasSuffix(u.Path, "/") {
u.Path += "/"
}
}
}
func removeDirectoryIndex(u *url.URL) {
if len(u.Path) > 0 {
u.Path = rxDirIndex.ReplaceAllString(u.Path, "$1")
}
}
func removeFragment(u *url.URL) {
u.Fragment = ""
}
func forceHTTP(u *url.URL) {
if strings.ToLower(u.Scheme) == "https" {
u.Scheme = "http"
}
}
func removeDuplicateSlashes(u *url.URL) {
if len(u.Path) > 0 {
u.Path = rxDupSlashes.ReplaceAllString(u.Path, "/")
}
}
func removeWWW(u *url.URL) {
if len(u.Host) > 0 && strings.HasPrefix(strings.ToLower(u.Host), "www.") {
u.Host = u.Host[4:]
}
}
func addWWW(u *url.URL) {
if len(u.Host) > 0 && !strings.HasPrefix(strings.ToLower(u.Host), "www.") {
u.Host = "www." + u.Host
}
}
func sortQuery(u *url.URL) {
q := u.Query()
if len(q) > 0 {
arKeys := make([]string, len(q))
i := 0
for k := range q {
arKeys[i] = k
i++
}
sort.Strings(arKeys)
buf := new(bytes.Buffer)
for _, k := range arKeys {
sort.Strings(q[k])
for _, v := range q[k] {
if buf.Len() > 0 {
buf.WriteRune('&')
}
buf.WriteString(fmt.Sprintf("%s=%s", k, urlesc.QueryEscape(v)))
}
}
// Rebuild the raw query string
u.RawQuery = buf.String()
}
}
func decodeDWORDHost(u *url.URL) {
if len(u.Host) > 0 {
if matches := rxDWORDHost.FindStringSubmatch(u.Host); len(matches) > 2 {
var parts [4]int64
dword, _ := strconv.ParseInt(matches[1], 10, 0)
for i, shift := range []uint{24, 16, 8, 0} {
parts[i] = dword >> shift & 0xFF
}
u.Host = fmt.Sprintf("%d.%d.%d.%d%s", parts[0], parts[1], parts[2], parts[3], matches[2])
}
}
}
func decodeOctalHost(u *url.URL) {
if len(u.Host) > 0 {
if matches := rxOctalHost.FindStringSubmatch(u.Host); len(matches) > 5 {
var parts [4]int64
for i := 1; i <= 4; i++ {
parts[i-1], _ = strconv.ParseInt(matches[i], 8, 0)
}
u.Host = fmt.Sprintf("%d.%d.%d.%d%s", parts[0], parts[1], parts[2], parts[3], matches[5])
}
}
}
func decodeHexHost(u *url.URL) {
if len(u.Host) > 0 {
if matches := rxHexHost.FindStringSubmatch(u.Host); len(matches) > 2 {
// Conversion is safe because of regex validation
parsed, _ := strconv.ParseInt(matches[1], 16, 0)
// Set host as DWORD (base 10) encoded host
u.Host = fmt.Sprintf("%d%s", parsed, matches[2])
// The rest is the same as decoding a DWORD host
decodeDWORDHost(u)
}
}
}
func removeUnncessaryHostDots(u *url.URL) {
if len(u.Host) > 0 {
if matches := rxHostDots.FindStringSubmatch(u.Host); len(matches) > 1 {
// Trim the leading and trailing dots
u.Host = strings.Trim(matches[1], ".")
if len(matches) > 2 {
u.Host += matches[2]
}
}
}
}
func removeEmptyPortSeparator(u *url.URL) {
if len(u.Host) > 0 {
u.Host = rxEmptyPort.ReplaceAllString(u.Host, "")
}
}

View File

@ -1,15 +0,0 @@
language: go
go:
- 1.4.x
- 1.5.x
- 1.6.x
- 1.7.x
- 1.8.x
- tip
install:
- go build .
script:
- go test -v

View File

@ -1,27 +0,0 @@
Copyright (c) 2012 The Go Authors. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -1,16 +0,0 @@
urlesc [![Build Status](https://travis-ci.org/PuerkitoBio/urlesc.svg?branch=master)](https://travis-ci.org/PuerkitoBio/urlesc) [![GoDoc](http://godoc.org/github.com/PuerkitoBio/urlesc?status.svg)](http://godoc.org/github.com/PuerkitoBio/urlesc)
======
Package urlesc implements query escaping as per RFC 3986.
It contains some parts of the net/url package, modified so as to allow
some reserved characters incorrectly escaped by net/url (see [issue 5684](https://github.com/golang/go/issues/5684)).
## Install
go get github.com/PuerkitoBio/urlesc
## License
Go license (BSD-3-Clause)

View File

@ -1,180 +0,0 @@
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package urlesc implements query escaping as per RFC 3986.
// It contains some parts of the net/url package, modified so as to allow
// some reserved characters incorrectly escaped by net/url.
// See https://github.com/golang/go/issues/5684
package urlesc
import (
"bytes"
"net/url"
"strings"
)
type encoding int
const (
encodePath encoding = 1 + iota
encodeUserPassword
encodeQueryComponent
encodeFragment
)
// Return true if the specified character should be escaped when
// appearing in a URL string, according to RFC 3986.
func shouldEscape(c byte, mode encoding) bool {
// §2.3 Unreserved characters (alphanum)
if 'A' <= c && c <= 'Z' || 'a' <= c && c <= 'z' || '0' <= c && c <= '9' {
return false
}
switch c {
case '-', '.', '_', '~': // §2.3 Unreserved characters (mark)
return false
// §2.2 Reserved characters (reserved)
case ':', '/', '?', '#', '[', ']', '@', // gen-delims
'!', '$', '&', '\'', '(', ')', '*', '+', ',', ';', '=': // sub-delims
// Different sections of the URL allow a few of
// the reserved characters to appear unescaped.
switch mode {
case encodePath: // §3.3
// The RFC allows sub-delims and : @.
// '/', '[' and ']' can be used to assign meaning to individual path
// segments. This package only manipulates the path as a whole,
// so we allow those as well. That leaves only ? and # to escape.
return c == '?' || c == '#'
case encodeUserPassword: // §3.2.1
// The RFC allows : and sub-delims in
// userinfo. The parsing of userinfo treats ':' as special so we must escape
// all the gen-delims.
return c == ':' || c == '/' || c == '?' || c == '#' || c == '[' || c == ']' || c == '@'
case encodeQueryComponent: // §3.4
// The RFC allows / and ?.
return c != '/' && c != '?'
case encodeFragment: // §4.1
// The RFC text is silent but the grammar allows
// everything, so escape nothing but #
return c == '#'
}
}
// Everything else must be escaped.
return true
}
// QueryEscape escapes the string so it can be safely placed
// inside a URL query.
func QueryEscape(s string) string {
return escape(s, encodeQueryComponent)
}
func escape(s string, mode encoding) string {
spaceCount, hexCount := 0, 0
for i := 0; i < len(s); i++ {
c := s[i]
if shouldEscape(c, mode) {
if c == ' ' && mode == encodeQueryComponent {
spaceCount++
} else {
hexCount++
}
}
}
if spaceCount == 0 && hexCount == 0 {
return s
}
t := make([]byte, len(s)+2*hexCount)
j := 0
for i := 0; i < len(s); i++ {
switch c := s[i]; {
case c == ' ' && mode == encodeQueryComponent:
t[j] = '+'
j++
case shouldEscape(c, mode):
t[j] = '%'
t[j+1] = "0123456789ABCDEF"[c>>4]
t[j+2] = "0123456789ABCDEF"[c&15]
j += 3
default:
t[j] = s[i]
j++
}
}
return string(t)
}
var uiReplacer = strings.NewReplacer(
"%21", "!",
"%27", "'",
"%28", "(",
"%29", ")",
"%2A", "*",
)
// unescapeUserinfo unescapes some characters that need not to be escaped as per RFC3986.
func unescapeUserinfo(s string) string {
return uiReplacer.Replace(s)
}
// Escape reassembles the URL into a valid URL string.
// The general form of the result is one of:
//
// scheme:opaque
// scheme://userinfo@host/path?query#fragment
//
// If u.Opaque is non-empty, String uses the first form;
// otherwise it uses the second form.
//
// In the second form, the following rules apply:
// - if u.Scheme is empty, scheme: is omitted.
// - if u.User is nil, userinfo@ is omitted.
// - if u.Host is empty, host/ is omitted.
// - if u.Scheme and u.Host are empty and u.User is nil,
// the entire scheme://userinfo@host/ is omitted.
// - if u.Host is non-empty and u.Path begins with a /,
// the form host/path does not add its own /.
// - if u.RawQuery is empty, ?query is omitted.
// - if u.Fragment is empty, #fragment is omitted.
func Escape(u *url.URL) string {
var buf bytes.Buffer
if u.Scheme != "" {
buf.WriteString(u.Scheme)
buf.WriteByte(':')
}
if u.Opaque != "" {
buf.WriteString(u.Opaque)
} else {
if u.Scheme != "" || u.Host != "" || u.User != nil {
buf.WriteString("//")
if ui := u.User; ui != nil {
buf.WriteString(unescapeUserinfo(ui.String()))
buf.WriteByte('@')
}
if h := u.Host; h != "" {
buf.WriteString(h)
}
}
if u.Path != "" && u.Path[0] != '/' && u.Host != "" {
buf.WriteByte('/')
}
buf.WriteString(escape(u.Path, encodePath))
}
if u.RawQuery != "" {
buf.WriteByte('?')
buf.WriteString(u.RawQuery)
}
if u.Fragment != "" {
buf.WriteByte('#')
buf.WriteString(escape(u.Fragment, encodeFragment))
}
return buf.String()
}

View File

@ -35,9 +35,17 @@ func CaptureMetrics(hnd http.Handler, w http.ResponseWriter, r *http.Request) Me
// sugar on top of this func), but is a more usable interface if your
// application doesn't use the Go http.Handler interface.
func CaptureMetricsFn(w http.ResponseWriter, fn func(http.ResponseWriter)) Metrics {
m := Metrics{Code: http.StatusOK}
m.CaptureMetrics(w, fn)
return m
}
// CaptureMetrics wraps w and calls fn with the wrapped w and updates
// Metrics m with the resulting metrics. This is similar to CaptureMetricsFn,
// but allows one to customize starting Metrics object.
func (m *Metrics) CaptureMetrics(w http.ResponseWriter, fn func(http.ResponseWriter)) {
var (
start = time.Now()
m = Metrics{Code: http.StatusOK}
headerWritten bool
hooks = Hooks{
WriteHeader: func(next WriteHeaderFunc) WriteHeaderFunc {
@ -74,6 +82,5 @@ func CaptureMetricsFn(w http.ResponseWriter, fn func(http.ResponseWriter)) Metri
)
fn(Wrap(w, hooks))
m.Duration = time.Since(start)
return m
m.Duration += time.Since(start)
}

View File

@ -0,0 +1,63 @@
package internal
import (
"net/url"
"regexp"
"strings"
)
const (
defaultHttpPort = ":80"
defaultHttpsPort = ":443"
)
// Regular expressions used by the normalizations
var rxPort = regexp.MustCompile(`(:\d+)/?$`)
var rxDupSlashes = regexp.MustCompile(`/{2,}`)
// NormalizeURL will normalize the specified URL
// This was added to replace a previous call to the no longer maintained purell library:
// The call that was used looked like the following:
// url.Parse(purell.NormalizeURL(parsed, purell.FlagsSafe|purell.FlagRemoveDuplicateSlashes))
//
// To explain all that was included in the call above, purell.FlagsSafe was really just the following:
// - FlagLowercaseScheme
// - FlagLowercaseHost
// - FlagRemoveDefaultPort
// - FlagRemoveDuplicateSlashes (and this was mixed in with the |)
func NormalizeURL(u *url.URL) {
lowercaseScheme(u)
lowercaseHost(u)
removeDefaultPort(u)
removeDuplicateSlashes(u)
}
func lowercaseScheme(u *url.URL) {
if len(u.Scheme) > 0 {
u.Scheme = strings.ToLower(u.Scheme)
}
}
func lowercaseHost(u *url.URL) {
if len(u.Host) > 0 {
u.Host = strings.ToLower(u.Host)
}
}
func removeDefaultPort(u *url.URL) {
if len(u.Host) > 0 {
scheme := strings.ToLower(u.Scheme)
u.Host = rxPort.ReplaceAllStringFunc(u.Host, func(val string) string {
if (scheme == "http" && val == defaultHttpPort) || (scheme == "https" && val == defaultHttpsPort) {
return ""
}
return val
})
}
}
func removeDuplicateSlashes(u *url.URL) {
if len(u.Path) > 0 {
u.Path = rxDupSlashes.ReplaceAllString(u.Path, "/")
}
}

View File

@ -30,8 +30,8 @@ import (
"net/url"
"strings"
"github.com/PuerkitoBio/purell"
"github.com/go-openapi/jsonpointer"
"github.com/go-openapi/jsonreference/internal"
)
const (
@ -114,7 +114,9 @@ func (r *Ref) parse(jsonReferenceString string) error {
return err
}
r.referenceURL, _ = url.Parse(purell.NormalizeURL(parsed, purell.FlagsSafe|purell.FlagRemoveDuplicateSlashes))
internal.NormalizeURL(parsed)
r.referenceURL = parsed
refURL := r.referenceURL
if refURL.Scheme != "" && refURL.Host != "" {

View File

@ -140,12 +140,13 @@ func (c *counter) get() float64 {
}
func (c *counter) Write(out *dto.Metric) error {
val := c.get()
// Read the Exemplar first and the value second. This is to avoid a race condition
// where users see an exemplar for a not-yet-existing observation.
var exemplar *dto.Exemplar
if e := c.exemplar.Load(); e != nil {
exemplar = e.(*dto.Exemplar)
}
val := c.get()
return populateMetric(CounterValue, val, c.labelPairs, exemplar, out)
}
@ -245,7 +246,8 @@ func (v *CounterVec) GetMetricWith(labels Labels) (Counter, error) {
// WithLabelValues works as GetMetricWithLabelValues, but panics where
// GetMetricWithLabelValues would have returned an error. Not returning an
// error allows shortcuts like
// myVec.WithLabelValues("404", "GET").Add(42)
//
// myVec.WithLabelValues("404", "GET").Add(42)
func (v *CounterVec) WithLabelValues(lvs ...string) Counter {
c, err := v.GetMetricWithLabelValues(lvs...)
if err != nil {
@ -256,7 +258,8 @@ func (v *CounterVec) WithLabelValues(lvs ...string) Counter {
// With works as GetMetricWith, but panics where GetMetricWithLabels would have
// returned an error. Not returning an error allows shortcuts like
// myVec.With(prometheus.Labels{"code": "404", "method": "GET"}).Add(42)
//
// myVec.With(prometheus.Labels{"code": "404", "method": "GET"}).Add(42)
func (v *CounterVec) With(labels Labels) Counter {
c, err := v.GetMetricWith(labels)
if err != nil {

View File

@ -21,55 +21,66 @@
// All exported functions and methods are safe to be used concurrently unless
// specified otherwise.
//
// A Basic Example
// # A Basic Example
//
// As a starting point, a very basic usage example:
//
// package main
// package main
//
// import (
// "log"
// "net/http"
// import (
// "log"
// "net/http"
//
// "github.com/prometheus/client_golang/prometheus"
// "github.com/prometheus/client_golang/prometheus/promhttp"
// )
// "github.com/prometheus/client_golang/prometheus"
// "github.com/prometheus/client_golang/prometheus/promhttp"
// )
//
// var (
// cpuTemp = prometheus.NewGauge(prometheus.GaugeOpts{
// Name: "cpu_temperature_celsius",
// Help: "Current temperature of the CPU.",
// })
// hdFailures = prometheus.NewCounterVec(
// prometheus.CounterOpts{
// Name: "hd_errors_total",
// Help: "Number of hard-disk errors.",
// },
// []string{"device"},
// )
// )
// type metrics struct {
// cpuTemp prometheus.Gauge
// hdFailures *prometheus.CounterVec
// }
//
// func init() {
// // Metrics have to be registered to be exposed:
// prometheus.MustRegister(cpuTemp)
// prometheus.MustRegister(hdFailures)
// }
// func NewMetrics(reg prometheus.Registerer) *metrics {
// m := &metrics{
// cpuTemp: prometheus.NewGauge(prometheus.GaugeOpts{
// Name: "cpu_temperature_celsius",
// Help: "Current temperature of the CPU.",
// }),
// hdFailures: prometheus.NewCounterVec(
// prometheus.CounterOpts{
// Name: "hd_errors_total",
// Help: "Number of hard-disk errors.",
// },
// []string{"device"},
// ),
// }
// reg.MustRegister(m.cpuTemp)
// reg.MustRegister(m.hdFailures)
// return m
// }
//
// func main() {
// cpuTemp.Set(65.3)
// hdFailures.With(prometheus.Labels{"device":"/dev/sda"}).Inc()
// func main() {
// // Create a non-global registry.
// reg := prometheus.NewRegistry()
//
// // The Handler function provides a default handler to expose metrics
// // via an HTTP server. "/metrics" is the usual endpoint for that.
// http.Handle("/metrics", promhttp.Handler())
// log.Fatal(http.ListenAndServe(":8080", nil))
// }
// // Create new metrics and register them using the custom registry.
// m := NewMetrics(reg)
// // Set values for the new created metrics.
// m.cpuTemp.Set(65.3)
// m.hdFailures.With(prometheus.Labels{"device":"/dev/sda"}).Inc()
//
// // Expose metrics and custom registry via an HTTP server
// // using the HandleFor function. "/metrics" is the usual endpoint for that.
// http.Handle("/metrics", promhttp.HandlerFor(reg, promhttp.HandlerOpts{Registry: reg}))
// log.Fatal(http.ListenAndServe(":8080", nil))
// }
//
// This is a complete program that exports two metrics, a Gauge and a Counter,
// the latter with a label attached to turn it into a (one-dimensional) vector.
// It register the metrics using a custom registry and exposes them via an HTTP server
// on the /metrics endpoint.
//
// Metrics
// # Metrics
//
// The number of exported identifiers in this package might appear a bit
// overwhelming. However, in addition to the basic plumbing shown in the example
@ -100,7 +111,7 @@
// To create instances of Metrics and their vector versions, you need a suitable
// …Opts struct, i.e. GaugeOpts, CounterOpts, SummaryOpts, or HistogramOpts.
//
// Custom Collectors and constant Metrics
// # Custom Collectors and constant Metrics
//
// While you could create your own implementations of Metric, most likely you
// will only ever implement the Collector interface on your own. At a first
@ -141,7 +152,7 @@
// a metric, GaugeFunc, CounterFunc, or UntypedFunc might be interesting
// shortcuts.
//
// Advanced Uses of the Registry
// # Advanced Uses of the Registry
//
// While MustRegister is the by far most common way of registering a Collector,
// sometimes you might want to handle the errors the registration might cause.
@ -176,23 +187,23 @@
// NewProcessCollector). With a custom registry, you are in control and decide
// yourself about the Collectors to register.
//
// HTTP Exposition
// # HTTP Exposition
//
// The Registry implements the Gatherer interface. The caller of the Gather
// method can then expose the gathered metrics in some way. Usually, the metrics
// are served via HTTP on the /metrics endpoint. That's happening in the example
// above. The tools to expose metrics via HTTP are in the promhttp sub-package.
//
// Pushing to the Pushgateway
// # Pushing to the Pushgateway
//
// Function for pushing to the Pushgateway can be found in the push sub-package.
//
// Graphite Bridge
// # Graphite Bridge
//
// Functions and examples to push metrics from a Gatherer to Graphite can be
// found in the graphite sub-package.
//
// Other Means of Exposition
// # Other Means of Exposition
//
// More ways of exposing metrics can easily be added by following the approaches
// of the existing implementations.

View File

@ -210,7 +210,8 @@ func (v *GaugeVec) GetMetricWith(labels Labels) (Gauge, error) {
// WithLabelValues works as GetMetricWithLabelValues, but panics where
// GetMetricWithLabelValues would have returned an error. Not returning an
// error allows shortcuts like
// myVec.WithLabelValues("404", "GET").Add(42)
//
// myVec.WithLabelValues("404", "GET").Add(42)
func (v *GaugeVec) WithLabelValues(lvs ...string) Gauge {
g, err := v.GetMetricWithLabelValues(lvs...)
if err != nil {
@ -221,7 +222,8 @@ func (v *GaugeVec) WithLabelValues(lvs ...string) Gauge {
// With works as GetMetricWith, but panics where GetMetricWithLabels would have
// returned an error. Not returning an error allows shortcuts like
// myVec.With(prometheus.Labels{"code": "404", "method": "GET"}).Add(42)
//
// myVec.With(prometheus.Labels{"code": "404", "method": "GET"}).Add(42)
func (v *GaugeVec) With(labels Labels) Gauge {
g, err := v.GetMetricWith(labels)
if err != nil {

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,60 @@
// Copyright (c) 2015 Björn Rabenstein
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// The code in this package is copy/paste to avoid a dependency. Hence this file
// carries the copyright of the original repo.
// https://github.com/beorn7/floats
package internal
import (
"math"
)
// minNormalFloat64 is the smallest positive normal value of type float64.
var minNormalFloat64 = math.Float64frombits(0x0010000000000000)
// AlmostEqualFloat64 returns true if a and b are equal within a relative error
// of epsilon. See http://floating-point-gui.de/errors/comparison/ for the
// details of the applied method.
func AlmostEqualFloat64(a, b, epsilon float64) bool {
if a == b {
return true
}
absA := math.Abs(a)
absB := math.Abs(b)
diff := math.Abs(a - b)
if a == 0 || b == 0 || absA+absB < minNormalFloat64 {
return diff < epsilon*minNormalFloat64
}
return diff/math.Min(absA+absB, math.MaxFloat64) < epsilon
}
// AlmostEqualFloat64s is the slice form of AlmostEqualFloat64.
func AlmostEqualFloat64s(a, b []float64, epsilon float64) bool {
if len(a) != len(b) {
return false
}
for i := range a {
if !AlmostEqualFloat64(a[i], b[i], epsilon) {
return false
}
}
return true
}

View File

@ -201,12 +201,15 @@ func (m *SequenceMatcher) isBJunk(s string) bool {
// If IsJunk is not defined:
//
// Return (i,j,k) such that a[i:i+k] is equal to b[j:j+k], where
// alo <= i <= i+k <= ahi
// blo <= j <= j+k <= bhi
//
// alo <= i <= i+k <= ahi
// blo <= j <= j+k <= bhi
//
// and for all (i',j',k') meeting those conditions,
// k >= k'
// i <= i'
// and if i == i', j <= j'
//
// k >= k'
// i <= i'
// and if i == i', j <= j'
//
// In other words, of all maximal matching blocks, return one that
// starts earliest in a, and of all those maximal matching blocks that

View File

@ -25,7 +25,8 @@ import (
// Labels represents a collection of label name -> value mappings. This type is
// commonly used with the With(Labels) and GetMetricWith(Labels) methods of
// metric vector Collectors, e.g.:
// myVec.With(Labels{"code": "404", "method": "GET"}).Add(42)
//
// myVec.With(Labels{"code": "404", "method": "GET"}).Add(42)
//
// The other use-case is the specification of constant label pairs in Opts or to
// create a Desc.

View File

@ -187,7 +187,7 @@ func (m *withExemplarsMetric) Write(pb *dto.Metric) error {
} else {
// The +Inf bucket should be explicitly added if there is an exemplar for it, similar to non-const histogram logic in https://github.com/prometheus/client_golang/blob/main/prometheus/histogram.go#L357-L365.
b := &dto.Bucket{
CumulativeCount: proto.Uint64(pb.Histogram.Bucket[len(pb.Histogram.GetBucket())-1].GetCumulativeCount()),
CumulativeCount: proto.Uint64(pb.Histogram.GetSampleCount()),
UpperBound: proto.Float64(math.Inf(1)),
Exemplar: e,
}

View File

@ -73,12 +73,11 @@ func InstrumentRoundTripperCounter(counter *prometheus.CounterVec, next http.Rou
return func(r *http.Request) (*http.Response, error) {
resp, err := next.RoundTrip(r)
if err == nil {
exemplarAdd(
addWithExemplar(
counter.With(labels(code, method, r.Method, resp.StatusCode, rtOpts.extraMethods...)),
1,
rtOpts.getExemplarFn(r.Context()),
)
counter.With(labels(code, method, r.Method, resp.StatusCode, rtOpts.extraMethods...)).Inc()
}
return resp, err
}
@ -117,7 +116,7 @@ func InstrumentRoundTripperDuration(obs prometheus.ObserverVec, next http.RoundT
start := time.Now()
resp, err := next.RoundTrip(r)
if err == nil {
exemplarObserve(
observeWithExemplar(
obs.With(labels(code, method, r.Method, resp.StatusCode, rtOpts.extraMethods...)),
time.Since(start).Seconds(),
rtOpts.getExemplarFn(r.Context()),

View File

@ -28,7 +28,9 @@ import (
// magicString is used for the hacky label test in checkLabels. Remove once fixed.
const magicString = "zZgWfBxLqvG8kc8IMv3POi2Bb0tZI3vAnBx+gBaFi9FyPzB/CzKUer1yufDa"
func exemplarObserve(obs prometheus.Observer, val float64, labels map[string]string) {
// observeWithExemplar is a wrapper for [prometheus.ExemplarAdder.ExemplarObserver],
// which falls back to [prometheus.Observer.Observe] if no labels are provided.
func observeWithExemplar(obs prometheus.Observer, val float64, labels map[string]string) {
if labels == nil {
obs.Observe(val)
return
@ -36,7 +38,9 @@ func exemplarObserve(obs prometheus.Observer, val float64, labels map[string]str
obs.(prometheus.ExemplarObserver).ObserveWithExemplar(val, labels)
}
func exemplarAdd(obs prometheus.Counter, val float64, labels map[string]string) {
// addWithExemplar is a wrapper for [prometheus.ExemplarAdder.AddWithExemplar],
// which falls back to [prometheus.Counter.Add] if no labels are provided.
func addWithExemplar(obs prometheus.Counter, val float64, labels map[string]string) {
if labels == nil {
obs.Add(val)
return
@ -91,7 +95,7 @@ func InstrumentHandlerDuration(obs prometheus.ObserverVec, next http.Handler, op
d := newDelegator(w, nil)
next.ServeHTTP(d, r)
exemplarObserve(
observeWithExemplar(
obs.With(labels(code, method, r.Method, d.Status(), hOpts.extraMethods...)),
time.Since(now).Seconds(),
hOpts.getExemplarFn(r.Context()),
@ -103,7 +107,7 @@ func InstrumentHandlerDuration(obs prometheus.ObserverVec, next http.Handler, op
now := time.Now()
next.ServeHTTP(w, r)
exemplarObserve(
observeWithExemplar(
obs.With(labels(code, method, r.Method, 0, hOpts.extraMethods...)),
time.Since(now).Seconds(),
hOpts.getExemplarFn(r.Context()),
@ -141,7 +145,7 @@ func InstrumentHandlerCounter(counter *prometheus.CounterVec, next http.Handler,
d := newDelegator(w, nil)
next.ServeHTTP(d, r)
exemplarAdd(
addWithExemplar(
counter.With(labels(code, method, r.Method, d.Status(), hOpts.extraMethods...)),
1,
hOpts.getExemplarFn(r.Context()),
@ -151,7 +155,7 @@ func InstrumentHandlerCounter(counter *prometheus.CounterVec, next http.Handler,
return func(w http.ResponseWriter, r *http.Request) {
next.ServeHTTP(w, r)
exemplarAdd(
addWithExemplar(
counter.With(labels(code, method, r.Method, 0, hOpts.extraMethods...)),
1,
hOpts.getExemplarFn(r.Context()),
@ -192,7 +196,7 @@ func InstrumentHandlerTimeToWriteHeader(obs prometheus.ObserverVec, next http.Ha
return func(w http.ResponseWriter, r *http.Request) {
now := time.Now()
d := newDelegator(w, func(status int) {
exemplarObserve(
observeWithExemplar(
obs.With(labels(code, method, r.Method, status, hOpts.extraMethods...)),
time.Since(now).Seconds(),
hOpts.getExemplarFn(r.Context()),
@ -233,7 +237,7 @@ func InstrumentHandlerRequestSize(obs prometheus.ObserverVec, next http.Handler,
d := newDelegator(w, nil)
next.ServeHTTP(d, r)
size := computeApproximateRequestSize(r)
exemplarObserve(
observeWithExemplar(
obs.With(labels(code, method, r.Method, d.Status(), hOpts.extraMethods...)),
float64(size),
hOpts.getExemplarFn(r.Context()),
@ -244,7 +248,7 @@ func InstrumentHandlerRequestSize(obs prometheus.ObserverVec, next http.Handler,
return func(w http.ResponseWriter, r *http.Request) {
next.ServeHTTP(w, r)
size := computeApproximateRequestSize(r)
exemplarObserve(
observeWithExemplar(
obs.With(labels(code, method, r.Method, 0, hOpts.extraMethods...)),
float64(size),
hOpts.getExemplarFn(r.Context()),
@ -282,7 +286,7 @@ func InstrumentHandlerResponseSize(obs prometheus.ObserverVec, next http.Handler
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
d := newDelegator(w, nil)
next.ServeHTTP(d, r)
exemplarObserve(
observeWithExemplar(
obs.With(labels(code, method, r.Method, d.Status(), hOpts.extraMethods...)),
float64(d.Written()),
hOpts.getExemplarFn(r.Context()),

View File

@ -252,9 +252,12 @@ func (errs MultiError) MaybeUnwrap() error {
}
// Registry registers Prometheus collectors, collects their metrics, and gathers
// them into MetricFamilies for exposition. It implements both Registerer and
// Gatherer. The zero value is not usable. Create instances with NewRegistry or
// NewPedanticRegistry.
// them into MetricFamilies for exposition. It implements Registerer, Gatherer,
// and Collector. The zero value is not usable. Create instances with
// NewRegistry or NewPedanticRegistry.
//
// Registry implements Collector to allow it to be used for creating groups of
// metrics. See the Grouping example for how this can be done.
type Registry struct {
mtx sync.RWMutex
collectorsByID map[uint64]Collector // ID is a hash of the descIDs.
@ -556,6 +559,31 @@ func (r *Registry) Gather() ([]*dto.MetricFamily, error) {
return internal.NormalizeMetricFamilies(metricFamiliesByName), errs.MaybeUnwrap()
}
// Describe implements Collector.
func (r *Registry) Describe(ch chan<- *Desc) {
r.mtx.RLock()
defer r.mtx.RUnlock()
// Only report the checked Collectors; unchecked collectors don't report any
// Desc.
for _, c := range r.collectorsByID {
c.Describe(ch)
}
}
// Collect implements Collector.
func (r *Registry) Collect(ch chan<- Metric) {
r.mtx.RLock()
defer r.mtx.RUnlock()
for _, c := range r.collectorsByID {
c.Collect(ch)
}
for _, c := range r.uncheckedCollectors {
c.Collect(ch)
}
}
// WriteToTextfile calls Gather on the provided Gatherer, encodes the result in the
// Prometheus text format, and writes it to a temporary file. Upon success, the
// temporary file is renamed to the provided filename.

View File

@ -603,7 +603,8 @@ func (v *SummaryVec) GetMetricWith(labels Labels) (Observer, error) {
// WithLabelValues works as GetMetricWithLabelValues, but panics where
// GetMetricWithLabelValues would have returned an error. Not returning an
// error allows shortcuts like
// myVec.WithLabelValues("404", "GET").Observe(42.21)
//
// myVec.WithLabelValues("404", "GET").Observe(42.21)
func (v *SummaryVec) WithLabelValues(lvs ...string) Observer {
s, err := v.GetMetricWithLabelValues(lvs...)
if err != nil {
@ -614,7 +615,8 @@ func (v *SummaryVec) WithLabelValues(lvs ...string) Observer {
// With works as GetMetricWith, but panics where GetMetricWithLabels would have
// returned an error. Not returning an error allows shortcuts like
// myVec.With(prometheus.Labels{"code": "404", "method": "GET"}).Observe(42.21)
//
// myVec.With(prometheus.Labels{"code": "404", "method": "GET"}).Observe(42.21)
func (v *SummaryVec) With(labels Labels) Observer {
s, err := v.GetMetricWith(labels)
if err != nil {
@ -701,7 +703,8 @@ func (s *constSummary) Write(out *dto.Metric) error {
//
// quantiles maps ranks to quantile values. For example, a median latency of
// 0.23s and a 99th percentile latency of 0.56s would be expressed as:
// map[float64]float64{0.5: 0.23, 0.99: 0.56}
//
// map[float64]float64{0.5: 0.23, 0.99: 0.56}
//
// NewConstSummary returns an error if the length of labelValues is not
// consistent with the variable labels in Desc or if Desc is invalid.

View File

@ -25,11 +25,12 @@ type Timer struct {
// NewTimer creates a new Timer. The provided Observer is used to observe a
// duration in seconds. Timer is usually used to time a function call in the
// following way:
// func TimeMe() {
// timer := NewTimer(myHistogram)
// defer timer.ObserveDuration()
// // Do actual work.
// }
//
// func TimeMe() {
// timer := NewTimer(myHistogram)
// defer timer.ObserveDuration()
// // Do actual work.
// }
func NewTimer(o Observer) *Timer {
return &Timer{
begin: time.Now(),

View File

@ -1,5 +1,5 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: metrics.proto
// source: io/prometheus/client/metrics.proto
package io_prometheus_client
@ -24,11 +24,18 @@ const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
type MetricType int32
const (
MetricType_COUNTER MetricType = 0
MetricType_GAUGE MetricType = 1
MetricType_SUMMARY MetricType = 2
MetricType_UNTYPED MetricType = 3
// COUNTER must use the Metric field "counter".
MetricType_COUNTER MetricType = 0
// GAUGE must use the Metric field "gauge".
MetricType_GAUGE MetricType = 1
// SUMMARY must use the Metric field "summary".
MetricType_SUMMARY MetricType = 2
// UNTYPED must use the Metric field "untyped".
MetricType_UNTYPED MetricType = 3
// HISTOGRAM must use the Metric field "histogram".
MetricType_HISTOGRAM MetricType = 4
// GAUGE_HISTOGRAM must use the Metric field "histogram".
MetricType_GAUGE_HISTOGRAM MetricType = 5
)
var MetricType_name = map[int32]string{
@ -37,14 +44,16 @@ var MetricType_name = map[int32]string{
2: "SUMMARY",
3: "UNTYPED",
4: "HISTOGRAM",
5: "GAUGE_HISTOGRAM",
}
var MetricType_value = map[string]int32{
"COUNTER": 0,
"GAUGE": 1,
"SUMMARY": 2,
"UNTYPED": 3,
"HISTOGRAM": 4,
"COUNTER": 0,
"GAUGE": 1,
"SUMMARY": 2,
"UNTYPED": 3,
"HISTOGRAM": 4,
"GAUGE_HISTOGRAM": 5,
}
func (x MetricType) Enum() *MetricType {
@ -67,7 +76,7 @@ func (x *MetricType) UnmarshalJSON(data []byte) error {
}
func (MetricType) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_6039342a2ba47b72, []int{0}
return fileDescriptor_d1e5ddb18987a258, []int{0}
}
type LabelPair struct {
@ -82,7 +91,7 @@ func (m *LabelPair) Reset() { *m = LabelPair{} }
func (m *LabelPair) String() string { return proto.CompactTextString(m) }
func (*LabelPair) ProtoMessage() {}
func (*LabelPair) Descriptor() ([]byte, []int) {
return fileDescriptor_6039342a2ba47b72, []int{0}
return fileDescriptor_d1e5ddb18987a258, []int{0}
}
func (m *LabelPair) XXX_Unmarshal(b []byte) error {
@ -128,7 +137,7 @@ func (m *Gauge) Reset() { *m = Gauge{} }
func (m *Gauge) String() string { return proto.CompactTextString(m) }
func (*Gauge) ProtoMessage() {}
func (*Gauge) Descriptor() ([]byte, []int) {
return fileDescriptor_6039342a2ba47b72, []int{1}
return fileDescriptor_d1e5ddb18987a258, []int{1}
}
func (m *Gauge) XXX_Unmarshal(b []byte) error {
@ -168,7 +177,7 @@ func (m *Counter) Reset() { *m = Counter{} }
func (m *Counter) String() string { return proto.CompactTextString(m) }
func (*Counter) ProtoMessage() {}
func (*Counter) Descriptor() ([]byte, []int) {
return fileDescriptor_6039342a2ba47b72, []int{2}
return fileDescriptor_d1e5ddb18987a258, []int{2}
}
func (m *Counter) XXX_Unmarshal(b []byte) error {
@ -215,7 +224,7 @@ func (m *Quantile) Reset() { *m = Quantile{} }
func (m *Quantile) String() string { return proto.CompactTextString(m) }
func (*Quantile) ProtoMessage() {}
func (*Quantile) Descriptor() ([]byte, []int) {
return fileDescriptor_6039342a2ba47b72, []int{3}
return fileDescriptor_d1e5ddb18987a258, []int{3}
}
func (m *Quantile) XXX_Unmarshal(b []byte) error {
@ -263,7 +272,7 @@ func (m *Summary) Reset() { *m = Summary{} }
func (m *Summary) String() string { return proto.CompactTextString(m) }
func (*Summary) ProtoMessage() {}
func (*Summary) Descriptor() ([]byte, []int) {
return fileDescriptor_6039342a2ba47b72, []int{4}
return fileDescriptor_d1e5ddb18987a258, []int{4}
}
func (m *Summary) XXX_Unmarshal(b []byte) error {
@ -316,7 +325,7 @@ func (m *Untyped) Reset() { *m = Untyped{} }
func (m *Untyped) String() string { return proto.CompactTextString(m) }
func (*Untyped) ProtoMessage() {}
func (*Untyped) Descriptor() ([]byte, []int) {
return fileDescriptor_6039342a2ba47b72, []int{5}
return fileDescriptor_d1e5ddb18987a258, []int{5}
}
func (m *Untyped) XXX_Unmarshal(b []byte) error {
@ -345,9 +354,34 @@ func (m *Untyped) GetValue() float64 {
}
type Histogram struct {
SampleCount *uint64 `protobuf:"varint,1,opt,name=sample_count,json=sampleCount" json:"sample_count,omitempty"`
SampleSum *float64 `protobuf:"fixed64,2,opt,name=sample_sum,json=sampleSum" json:"sample_sum,omitempty"`
Bucket []*Bucket `protobuf:"bytes,3,rep,name=bucket" json:"bucket,omitempty"`
SampleCount *uint64 `protobuf:"varint,1,opt,name=sample_count,json=sampleCount" json:"sample_count,omitempty"`
SampleCountFloat *float64 `protobuf:"fixed64,4,opt,name=sample_count_float,json=sampleCountFloat" json:"sample_count_float,omitempty"`
SampleSum *float64 `protobuf:"fixed64,2,opt,name=sample_sum,json=sampleSum" json:"sample_sum,omitempty"`
// Buckets for the conventional histogram.
Bucket []*Bucket `protobuf:"bytes,3,rep,name=bucket" json:"bucket,omitempty"`
// schema defines the bucket schema. Currently, valid numbers are -4 <= n <= 8.
// They are all for base-2 bucket schemas, where 1 is a bucket boundary in each case, and
// then each power of two is divided into 2^n logarithmic buckets.
// Or in other words, each bucket boundary is the previous boundary times 2^(2^-n).
// In the future, more bucket schemas may be added using numbers < -4 or > 8.
Schema *int32 `protobuf:"zigzag32,5,opt,name=schema" json:"schema,omitempty"`
ZeroThreshold *float64 `protobuf:"fixed64,6,opt,name=zero_threshold,json=zeroThreshold" json:"zero_threshold,omitempty"`
ZeroCount *uint64 `protobuf:"varint,7,opt,name=zero_count,json=zeroCount" json:"zero_count,omitempty"`
ZeroCountFloat *float64 `protobuf:"fixed64,8,opt,name=zero_count_float,json=zeroCountFloat" json:"zero_count_float,omitempty"`
// Negative buckets for the native histogram.
NegativeSpan []*BucketSpan `protobuf:"bytes,9,rep,name=negative_span,json=negativeSpan" json:"negative_span,omitempty"`
// Use either "negative_delta" or "negative_count", the former for
// regular histograms with integer counts, the latter for float
// histograms.
NegativeDelta []int64 `protobuf:"zigzag64,10,rep,name=negative_delta,json=negativeDelta" json:"negative_delta,omitempty"`
NegativeCount []float64 `protobuf:"fixed64,11,rep,name=negative_count,json=negativeCount" json:"negative_count,omitempty"`
// Positive buckets for the native histogram.
PositiveSpan []*BucketSpan `protobuf:"bytes,12,rep,name=positive_span,json=positiveSpan" json:"positive_span,omitempty"`
// Use either "positive_delta" or "positive_count", the former for
// regular histograms with integer counts, the latter for float
// histograms.
PositiveDelta []int64 `protobuf:"zigzag64,13,rep,name=positive_delta,json=positiveDelta" json:"positive_delta,omitempty"`
PositiveCount []float64 `protobuf:"fixed64,14,rep,name=positive_count,json=positiveCount" json:"positive_count,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@ -357,7 +391,7 @@ func (m *Histogram) Reset() { *m = Histogram{} }
func (m *Histogram) String() string { return proto.CompactTextString(m) }
func (*Histogram) ProtoMessage() {}
func (*Histogram) Descriptor() ([]byte, []int) {
return fileDescriptor_6039342a2ba47b72, []int{6}
return fileDescriptor_d1e5ddb18987a258, []int{6}
}
func (m *Histogram) XXX_Unmarshal(b []byte) error {
@ -385,6 +419,13 @@ func (m *Histogram) GetSampleCount() uint64 {
return 0
}
func (m *Histogram) GetSampleCountFloat() float64 {
if m != nil && m.SampleCountFloat != nil {
return *m.SampleCountFloat
}
return 0
}
func (m *Histogram) GetSampleSum() float64 {
if m != nil && m.SampleSum != nil {
return *m.SampleSum
@ -399,8 +440,81 @@ func (m *Histogram) GetBucket() []*Bucket {
return nil
}
func (m *Histogram) GetSchema() int32 {
if m != nil && m.Schema != nil {
return *m.Schema
}
return 0
}
func (m *Histogram) GetZeroThreshold() float64 {
if m != nil && m.ZeroThreshold != nil {
return *m.ZeroThreshold
}
return 0
}
func (m *Histogram) GetZeroCount() uint64 {
if m != nil && m.ZeroCount != nil {
return *m.ZeroCount
}
return 0
}
func (m *Histogram) GetZeroCountFloat() float64 {
if m != nil && m.ZeroCountFloat != nil {
return *m.ZeroCountFloat
}
return 0
}
func (m *Histogram) GetNegativeSpan() []*BucketSpan {
if m != nil {
return m.NegativeSpan
}
return nil
}
func (m *Histogram) GetNegativeDelta() []int64 {
if m != nil {
return m.NegativeDelta
}
return nil
}
func (m *Histogram) GetNegativeCount() []float64 {
if m != nil {
return m.NegativeCount
}
return nil
}
func (m *Histogram) GetPositiveSpan() []*BucketSpan {
if m != nil {
return m.PositiveSpan
}
return nil
}
func (m *Histogram) GetPositiveDelta() []int64 {
if m != nil {
return m.PositiveDelta
}
return nil
}
func (m *Histogram) GetPositiveCount() []float64 {
if m != nil {
return m.PositiveCount
}
return nil
}
// A Bucket of a conventional histogram, each of which is treated as
// an individual counter-like time series by Prometheus.
type Bucket struct {
CumulativeCount *uint64 `protobuf:"varint,1,opt,name=cumulative_count,json=cumulativeCount" json:"cumulative_count,omitempty"`
CumulativeCountFloat *float64 `protobuf:"fixed64,4,opt,name=cumulative_count_float,json=cumulativeCountFloat" json:"cumulative_count_float,omitempty"`
UpperBound *float64 `protobuf:"fixed64,2,opt,name=upper_bound,json=upperBound" json:"upper_bound,omitempty"`
Exemplar *Exemplar `protobuf:"bytes,3,opt,name=exemplar" json:"exemplar,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
@ -412,7 +526,7 @@ func (m *Bucket) Reset() { *m = Bucket{} }
func (m *Bucket) String() string { return proto.CompactTextString(m) }
func (*Bucket) ProtoMessage() {}
func (*Bucket) Descriptor() ([]byte, []int) {
return fileDescriptor_6039342a2ba47b72, []int{7}
return fileDescriptor_d1e5ddb18987a258, []int{7}
}
func (m *Bucket) XXX_Unmarshal(b []byte) error {
@ -440,6 +554,13 @@ func (m *Bucket) GetCumulativeCount() uint64 {
return 0
}
func (m *Bucket) GetCumulativeCountFloat() float64 {
if m != nil && m.CumulativeCountFloat != nil {
return *m.CumulativeCountFloat
}
return 0
}
func (m *Bucket) GetUpperBound() float64 {
if m != nil && m.UpperBound != nil {
return *m.UpperBound
@ -454,6 +575,59 @@ func (m *Bucket) GetExemplar() *Exemplar {
return nil
}
// A BucketSpan defines a number of consecutive buckets in a native
// histogram with their offset. Logically, it would be more
// straightforward to include the bucket counts in the Span. However,
// the protobuf representation is more compact in the way the data is
// structured here (with all the buckets in a single array separate
// from the Spans).
type BucketSpan struct {
Offset *int32 `protobuf:"zigzag32,1,opt,name=offset" json:"offset,omitempty"`
Length *uint32 `protobuf:"varint,2,opt,name=length" json:"length,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *BucketSpan) Reset() { *m = BucketSpan{} }
func (m *BucketSpan) String() string { return proto.CompactTextString(m) }
func (*BucketSpan) ProtoMessage() {}
func (*BucketSpan) Descriptor() ([]byte, []int) {
return fileDescriptor_d1e5ddb18987a258, []int{8}
}
func (m *BucketSpan) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_BucketSpan.Unmarshal(m, b)
}
func (m *BucketSpan) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_BucketSpan.Marshal(b, m, deterministic)
}
func (m *BucketSpan) XXX_Merge(src proto.Message) {
xxx_messageInfo_BucketSpan.Merge(m, src)
}
func (m *BucketSpan) XXX_Size() int {
return xxx_messageInfo_BucketSpan.Size(m)
}
func (m *BucketSpan) XXX_DiscardUnknown() {
xxx_messageInfo_BucketSpan.DiscardUnknown(m)
}
var xxx_messageInfo_BucketSpan proto.InternalMessageInfo
func (m *BucketSpan) GetOffset() int32 {
if m != nil && m.Offset != nil {
return *m.Offset
}
return 0
}
func (m *BucketSpan) GetLength() uint32 {
if m != nil && m.Length != nil {
return *m.Length
}
return 0
}
type Exemplar struct {
Label []*LabelPair `protobuf:"bytes,1,rep,name=label" json:"label,omitempty"`
Value *float64 `protobuf:"fixed64,2,opt,name=value" json:"value,omitempty"`
@ -467,7 +641,7 @@ func (m *Exemplar) Reset() { *m = Exemplar{} }
func (m *Exemplar) String() string { return proto.CompactTextString(m) }
func (*Exemplar) ProtoMessage() {}
func (*Exemplar) Descriptor() ([]byte, []int) {
return fileDescriptor_6039342a2ba47b72, []int{8}
return fileDescriptor_d1e5ddb18987a258, []int{9}
}
func (m *Exemplar) XXX_Unmarshal(b []byte) error {
@ -526,7 +700,7 @@ func (m *Metric) Reset() { *m = Metric{} }
func (m *Metric) String() string { return proto.CompactTextString(m) }
func (*Metric) ProtoMessage() {}
func (*Metric) Descriptor() ([]byte, []int) {
return fileDescriptor_6039342a2ba47b72, []int{9}
return fileDescriptor_d1e5ddb18987a258, []int{10}
}
func (m *Metric) XXX_Unmarshal(b []byte) error {
@ -610,7 +784,7 @@ func (m *MetricFamily) Reset() { *m = MetricFamily{} }
func (m *MetricFamily) String() string { return proto.CompactTextString(m) }
func (*MetricFamily) ProtoMessage() {}
func (*MetricFamily) Descriptor() ([]byte, []int) {
return fileDescriptor_6039342a2ba47b72, []int{10}
return fileDescriptor_d1e5ddb18987a258, []int{11}
}
func (m *MetricFamily) XXX_Unmarshal(b []byte) error {
@ -669,55 +843,72 @@ func init() {
proto.RegisterType((*Untyped)(nil), "io.prometheus.client.Untyped")
proto.RegisterType((*Histogram)(nil), "io.prometheus.client.Histogram")
proto.RegisterType((*Bucket)(nil), "io.prometheus.client.Bucket")
proto.RegisterType((*BucketSpan)(nil), "io.prometheus.client.BucketSpan")
proto.RegisterType((*Exemplar)(nil), "io.prometheus.client.Exemplar")
proto.RegisterType((*Metric)(nil), "io.prometheus.client.Metric")
proto.RegisterType((*MetricFamily)(nil), "io.prometheus.client.MetricFamily")
}
func init() { proto.RegisterFile("metrics.proto", fileDescriptor_6039342a2ba47b72) }
var fileDescriptor_6039342a2ba47b72 = []byte{
// 665 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0xcd, 0x6e, 0xd3, 0x4c,
0x14, 0xfd, 0xdc, 0x38, 0x3f, 0xbe, 0x69, 0x3f, 0xa2, 0x51, 0x17, 0x56, 0xa1, 0x24, 0x78, 0x55,
0x58, 0x38, 0xa2, 0x6a, 0x05, 0x2a, 0xb0, 0x68, 0x4b, 0x48, 0x91, 0x48, 0x5b, 0x26, 0xc9, 0xa2,
0xb0, 0x88, 0x1c, 0x77, 0x70, 0x2c, 0x3c, 0xb1, 0xb1, 0x67, 0x2a, 0xb2, 0x66, 0xc1, 0x16, 0x5e,
0x81, 0x17, 0x05, 0xcd, 0x8f, 0x6d, 0x2a, 0xb9, 0x95, 0x40, 0xec, 0x66, 0xee, 0x3d, 0xe7, 0xfa,
0xcc, 0xf8, 0x9c, 0x81, 0x0d, 0x4a, 0x58, 0x1a, 0xfa, 0x99, 0x9b, 0xa4, 0x31, 0x8b, 0xd1, 0x66,
0x18, 0x8b, 0x15, 0x25, 0x6c, 0x41, 0x78, 0xe6, 0xfa, 0x51, 0x48, 0x96, 0x6c, 0xab, 0x1b, 0xc4,
0x71, 0x10, 0x91, 0xbe, 0xc4, 0xcc, 0xf9, 0x87, 0x3e, 0x0b, 0x29, 0xc9, 0x98, 0x47, 0x13, 0x45,
0x73, 0xf6, 0xc1, 0x7a, 0xe3, 0xcd, 0x49, 0x74, 0xee, 0x85, 0x29, 0x42, 0x60, 0x2e, 0x3d, 0x4a,
0x6c, 0xa3, 0x67, 0xec, 0x58, 0x58, 0xae, 0xd1, 0x26, 0xd4, 0xaf, 0xbc, 0x88, 0x13, 0x7b, 0x4d,
0x16, 0xd5, 0xc6, 0xd9, 0x86, 0xfa, 0xd0, 0xe3, 0xc1, 0x6f, 0x6d, 0xc1, 0x31, 0xf2, 0xf6, 0x7b,
0x68, 0x1e, 0xc7, 0x7c, 0xc9, 0x48, 0x5a, 0x0d, 0x40, 0x07, 0xd0, 0x22, 0x9f, 0x09, 0x4d, 0x22,
0x2f, 0x95, 0x83, 0xdb, 0xbb, 0xf7, 0xdd, 0xaa, 0x03, 0xb8, 0x03, 0x8d, 0xc2, 0x05, 0xde, 0x79,
0x0e, 0xad, 0xb7, 0xdc, 0x5b, 0xb2, 0x30, 0x22, 0x68, 0x0b, 0x5a, 0x9f, 0xf4, 0x5a, 0x7f, 0xa0,
0xd8, 0x5f, 0x57, 0x5e, 0x48, 0xfb, 0x6a, 0x40, 0x73, 0xcc, 0x29, 0xf5, 0xd2, 0x15, 0x7a, 0x00,
0xeb, 0x99, 0x47, 0x93, 0x88, 0xcc, 0x7c, 0xa1, 0x56, 0x4e, 0x30, 0x71, 0x5b, 0xd5, 0xe4, 0x01,
0xd0, 0x36, 0x80, 0x86, 0x64, 0x9c, 0xea, 0x49, 0x96, 0xaa, 0x8c, 0x39, 0x15, 0xe7, 0x28, 0xbe,
0x5f, 0xeb, 0xd5, 0x6e, 0x3e, 0x47, 0xae, 0xb8, 0xd4, 0xe7, 0x74, 0xa1, 0x39, 0x5d, 0xb2, 0x55,
0x42, 0x2e, 0x6f, 0xb8, 0xc5, 0x2f, 0x06, 0x58, 0x27, 0x61, 0xc6, 0xe2, 0x20, 0xf5, 0xe8, 0x3f,
0x10, 0xbb, 0x07, 0x8d, 0x39, 0xf7, 0x3f, 0x12, 0xa6, 0xa5, 0xde, 0xab, 0x96, 0x7a, 0x24, 0x31,
0x58, 0x63, 0x9d, 0x6f, 0x06, 0x34, 0x54, 0x09, 0x3d, 0x84, 0x8e, 0xcf, 0x29, 0x8f, 0x3c, 0x16,
0x5e, 0x5d, 0x97, 0x71, 0xa7, 0xac, 0x2b, 0x29, 0x5d, 0x68, 0xf3, 0x24, 0x21, 0xe9, 0x6c, 0x1e,
0xf3, 0xe5, 0xa5, 0xd6, 0x02, 0xb2, 0x74, 0x24, 0x2a, 0xd7, 0x1c, 0x50, 0xfb, 0x43, 0x07, 0x7c,
0x37, 0xa0, 0x95, 0x97, 0xd1, 0x3e, 0xd4, 0x23, 0xe1, 0x60, 0xdb, 0x90, 0x87, 0xea, 0x56, 0x4f,
0x29, 0x4c, 0x8e, 0x15, 0xba, 0xda, 0x1d, 0xe8, 0x29, 0x58, 0x45, 0x42, 0xb4, 0xac, 0x2d, 0x57,
0x65, 0xc8, 0xcd, 0x33, 0xe4, 0x4e, 0x72, 0x04, 0x2e, 0xc1, 0xce, 0xcf, 0x35, 0x68, 0x8c, 0x64,
0x22, 0xff, 0x56, 0xd1, 0x63, 0xa8, 0x07, 0x22, 0x53, 0x3a, 0x10, 0x77, 0xab, 0x69, 0x32, 0x76,
0x58, 0x21, 0xd1, 0x13, 0x68, 0xfa, 0x2a, 0x67, 0x5a, 0xec, 0x76, 0x35, 0x49, 0x87, 0x11, 0xe7,
0x68, 0x41, 0xcc, 0x54, 0x08, 0x6c, 0xf3, 0x36, 0xa2, 0x4e, 0x0a, 0xce, 0xd1, 0x82, 0xc8, 0x95,
0x69, 0xed, 0xfa, 0x6d, 0x44, 0xed, 0x6c, 0x9c, 0xa3, 0xd1, 0x0b, 0xb0, 0x16, 0xb9, 0x97, 0xed,
0xa6, 0xa4, 0xde, 0x70, 0x31, 0x85, 0xe5, 0x71, 0xc9, 0x10, 0xee, 0x2f, 0xee, 0x7a, 0x46, 0x33,
0xbb, 0xd1, 0x33, 0x76, 0x6a, 0xb8, 0x5d, 0xd4, 0x46, 0x99, 0xf3, 0xc3, 0x80, 0x75, 0xf5, 0x07,
0x5e, 0x79, 0x34, 0x8c, 0x56, 0x95, 0xcf, 0x19, 0x02, 0x73, 0x41, 0xa2, 0x44, 0xbf, 0x66, 0x72,
0x8d, 0xf6, 0xc0, 0x14, 0x1a, 0xe5, 0x15, 0xfe, 0xbf, 0xdb, 0xab, 0x56, 0xa5, 0x26, 0x4f, 0x56,
0x09, 0xc1, 0x12, 0x2d, 0xd2, 0xa4, 0x5e, 0x60, 0xdb, 0xbc, 0x2d, 0x4d, 0x8a, 0x87, 0x35, 0xf6,
0xd1, 0x08, 0xa0, 0x9c, 0x84, 0xda, 0xd0, 0x3c, 0x3e, 0x9b, 0x9e, 0x4e, 0x06, 0xb8, 0xf3, 0x1f,
0xb2, 0xa0, 0x3e, 0x3c, 0x9c, 0x0e, 0x07, 0x1d, 0x43, 0xd4, 0xc7, 0xd3, 0xd1, 0xe8, 0x10, 0x5f,
0x74, 0xd6, 0xc4, 0x66, 0x7a, 0x3a, 0xb9, 0x38, 0x1f, 0xbc, 0xec, 0xd4, 0xd0, 0x06, 0x58, 0x27,
0xaf, 0xc7, 0x93, 0xb3, 0x21, 0x3e, 0x1c, 0x75, 0xcc, 0x23, 0x0c, 0x95, 0xef, 0xfe, 0xbb, 0x83,
0x20, 0x64, 0x0b, 0x3e, 0x77, 0xfd, 0x98, 0xf6, 0xcb, 0x6e, 0x5f, 0x75, 0x67, 0x34, 0xbe, 0x24,
0x51, 0x3f, 0x88, 0x9f, 0x85, 0xf1, 0xac, 0xec, 0xce, 0x54, 0xf7, 0x57, 0x00, 0x00, 0x00, 0xff,
0xff, 0xd0, 0x84, 0x91, 0x73, 0x59, 0x06, 0x00, 0x00,
func init() {
proto.RegisterFile("io/prometheus/client/metrics.proto", fileDescriptor_d1e5ddb18987a258)
}
var fileDescriptor_d1e5ddb18987a258 = []byte{
// 896 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0xdd, 0x8e, 0xdb, 0x44,
0x18, 0xc5, 0x9b, 0x5f, 0x7f, 0xd9, 0x6c, 0xd3, 0x61, 0x55, 0x59, 0x0b, 0xcb, 0x06, 0x4b, 0x48,
0x0b, 0x42, 0x8e, 0x40, 0x5b, 0x81, 0x0a, 0x5c, 0xec, 0xb6, 0xe9, 0x16, 0x89, 0xb4, 0x65, 0x92,
0x5c, 0x14, 0x2e, 0xac, 0x49, 0x32, 0xeb, 0x58, 0x78, 0x3c, 0xc6, 0x1e, 0x57, 0x2c, 0x2f, 0xc0,
0x35, 0xaf, 0xc0, 0xc3, 0xf0, 0x22, 0x3c, 0x08, 0x68, 0xfe, 0xec, 0xdd, 0xe2, 0x94, 0xd2, 0x3b,
0x7f, 0x67, 0xce, 0xf7, 0xcd, 0x39, 0xe3, 0xc9, 0x71, 0xc0, 0x8f, 0xf9, 0x24, 0xcb, 0x39, 0xa3,
0x62, 0x4b, 0xcb, 0x62, 0xb2, 0x4e, 0x62, 0x9a, 0x8a, 0x09, 0xa3, 0x22, 0x8f, 0xd7, 0x45, 0x90,
0xe5, 0x5c, 0x70, 0x74, 0x18, 0xf3, 0xa0, 0xe6, 0x04, 0x9a, 0x73, 0x74, 0x12, 0x71, 0x1e, 0x25,
0x74, 0xa2, 0x38, 0xab, 0xf2, 0x6a, 0x22, 0x62, 0x46, 0x0b, 0x41, 0x58, 0xa6, 0xdb, 0xfc, 0xfb,
0xe0, 0x7e, 0x47, 0x56, 0x34, 0x79, 0x4e, 0xe2, 0x1c, 0x21, 0x68, 0xa7, 0x84, 0x51, 0xcf, 0x19,
0x3b, 0xa7, 0x2e, 0x56, 0xcf, 0xe8, 0x10, 0x3a, 0x2f, 0x49, 0x52, 0x52, 0x6f, 0x4f, 0x81, 0xba,
0xf0, 0x8f, 0xa1, 0x73, 0x49, 0xca, 0xe8, 0xc6, 0xb2, 0xec, 0x71, 0xec, 0xf2, 0x8f, 0xd0, 0x7b,
0xc8, 0xcb, 0x54, 0xd0, 0xbc, 0x99, 0x80, 0x1e, 0x40, 0x9f, 0xfe, 0x42, 0x59, 0x96, 0x90, 0x5c,
0x0d, 0x1e, 0x7c, 0xfe, 0x41, 0xd0, 0x64, 0x20, 0x98, 0x1a, 0x16, 0xae, 0xf8, 0xfe, 0xd7, 0xd0,
0xff, 0xbe, 0x24, 0xa9, 0x88, 0x13, 0x8a, 0x8e, 0xa0, 0xff, 0xb3, 0x79, 0x36, 0x1b, 0x54, 0xf5,
0x6d, 0xe5, 0x95, 0xb4, 0xdf, 0x1c, 0xe8, 0xcd, 0x4b, 0xc6, 0x48, 0x7e, 0x8d, 0x3e, 0x84, 0xfd,
0x82, 0xb0, 0x2c, 0xa1, 0xe1, 0x5a, 0xaa, 0x55, 0x13, 0xda, 0x78, 0xa0, 0x31, 0x65, 0x00, 0x1d,
0x03, 0x18, 0x4a, 0x51, 0x32, 0x33, 0xc9, 0xd5, 0xc8, 0xbc, 0x64, 0xd2, 0x47, 0xb5, 0x7f, 0x6b,
0xdc, 0xda, 0xed, 0xc3, 0x2a, 0xae, 0xf5, 0xf9, 0x27, 0xd0, 0x5b, 0xa6, 0xe2, 0x3a, 0xa3, 0x9b,
0x1d, 0xa7, 0xf8, 0x57, 0x1b, 0xdc, 0x27, 0x71, 0x21, 0x78, 0x94, 0x13, 0xf6, 0x26, 0x62, 0x3f,
0x05, 0x74, 0x93, 0x12, 0x5e, 0x25, 0x9c, 0x08, 0xaf, 0xad, 0x66, 0x8e, 0x6e, 0x10, 0x1f, 0x4b,
0xfc, 0xbf, 0xac, 0x9d, 0x41, 0x77, 0x55, 0xae, 0x7f, 0xa2, 0xc2, 0x18, 0x7b, 0xbf, 0xd9, 0xd8,
0x85, 0xe2, 0x60, 0xc3, 0x45, 0xf7, 0xa0, 0x5b, 0xac, 0xb7, 0x94, 0x11, 0xaf, 0x33, 0x76, 0x4e,
0xef, 0x62, 0x53, 0xa1, 0x8f, 0xe0, 0xe0, 0x57, 0x9a, 0xf3, 0x50, 0x6c, 0x73, 0x5a, 0x6c, 0x79,
0xb2, 0xf1, 0xba, 0x6a, 0xc3, 0xa1, 0x44, 0x17, 0x16, 0x94, 0x9a, 0x14, 0x4d, 0x5b, 0xec, 0x29,
0x8b, 0xae, 0x44, 0xb4, 0xc1, 0x53, 0x18, 0xd5, 0xcb, 0xc6, 0x5e, 0x5f, 0xcd, 0x39, 0xa8, 0x48,
0xda, 0xdc, 0x14, 0x86, 0x29, 0x8d, 0x88, 0x88, 0x5f, 0xd2, 0xb0, 0xc8, 0x48, 0xea, 0xb9, 0xca,
0xc4, 0xf8, 0x75, 0x26, 0xe6, 0x19, 0x49, 0xf1, 0xbe, 0x6d, 0x93, 0x95, 0x94, 0x5d, 0x8d, 0xd9,
0xd0, 0x44, 0x10, 0x0f, 0xc6, 0xad, 0x53, 0x84, 0xab, 0xe1, 0x8f, 0x24, 0x78, 0x8b, 0xa6, 0xa5,
0x0f, 0xc6, 0x2d, 0xe9, 0xce, 0xa2, 0x5a, 0xfe, 0x14, 0x86, 0x19, 0x2f, 0xe2, 0x5a, 0xd4, 0xfe,
0x9b, 0x8a, 0xb2, 0x6d, 0x56, 0x54, 0x35, 0x46, 0x8b, 0x1a, 0x6a, 0x51, 0x16, 0xad, 0x44, 0x55,
0x34, 0x2d, 0xea, 0x40, 0x8b, 0xb2, 0xa8, 0x12, 0xe5, 0xff, 0xe9, 0x40, 0x57, 0x6f, 0x85, 0x3e,
0x86, 0xd1, 0xba, 0x64, 0x65, 0x72, 0xd3, 0x88, 0xbe, 0x66, 0x77, 0x6a, 0x5c, 0x5b, 0x39, 0x83,
0x7b, 0xaf, 0x52, 0x6f, 0x5d, 0xb7, 0xc3, 0x57, 0x1a, 0xf4, 0x5b, 0x39, 0x81, 0x41, 0x99, 0x65,
0x34, 0x0f, 0x57, 0xbc, 0x4c, 0x37, 0xe6, 0xce, 0x81, 0x82, 0x2e, 0x24, 0x72, 0x2b, 0x17, 0x5a,
0xff, 0x3b, 0x17, 0xa0, 0x3e, 0x32, 0x79, 0x11, 0xf9, 0xd5, 0x55, 0x41, 0xb5, 0x83, 0xbb, 0xd8,
0x54, 0x12, 0x4f, 0x68, 0x1a, 0x89, 0xad, 0xda, 0x7d, 0x88, 0x4d, 0xe5, 0xff, 0xee, 0x40, 0xdf,
0x0e, 0x45, 0xf7, 0xa1, 0x93, 0xc8, 0x54, 0xf4, 0x1c, 0xf5, 0x82, 0x4e, 0x9a, 0x35, 0x54, 0xc1,
0x89, 0x35, 0xbb, 0x39, 0x71, 0xd0, 0x97, 0xe0, 0x56, 0xa9, 0x6b, 0x4c, 0x1d, 0x05, 0x3a, 0x97,
0x03, 0x9b, 0xcb, 0xc1, 0xc2, 0x32, 0x70, 0x4d, 0xf6, 0xff, 0xde, 0x83, 0xee, 0x4c, 0xa5, 0xfc,
0xdb, 0x2a, 0xfa, 0x0c, 0x3a, 0x91, 0xcc, 0x69, 0x13, 0xb2, 0xef, 0x35, 0xb7, 0xa9, 0x28, 0xc7,
0x9a, 0x89, 0xbe, 0x80, 0xde, 0x5a, 0x67, 0xb7, 0x11, 0x7b, 0xdc, 0xdc, 0x64, 0x02, 0x1e, 0x5b,
0xb6, 0x6c, 0x2c, 0x74, 0xb0, 0xaa, 0x3b, 0xb0, 0xb3, 0xd1, 0xa4, 0x2f, 0xb6, 0x6c, 0xd9, 0x58,
0xea, 0x20, 0x54, 0xa1, 0xb1, 0xb3, 0xd1, 0xa4, 0x25, 0xb6, 0x6c, 0xf4, 0x0d, 0xb8, 0x5b, 0x9b,
0x8f, 0x2a, 0x2c, 0x76, 0x1e, 0x4c, 0x15, 0xa3, 0xb8, 0xee, 0x90, 0x89, 0x5a, 0x9d, 0x75, 0xc8,
0x0a, 0x95, 0x48, 0x2d, 0x3c, 0xa8, 0xb0, 0x59, 0xe1, 0xff, 0xe1, 0xc0, 0xbe, 0x7e, 0x03, 0x8f,
0x09, 0x8b, 0x93, 0xeb, 0xc6, 0x4f, 0x24, 0x82, 0xf6, 0x96, 0x26, 0x99, 0xf9, 0x42, 0xaa, 0x67,
0x74, 0x06, 0x6d, 0xa9, 0x51, 0x1d, 0xe1, 0xc1, 0xae, 0x5f, 0xb8, 0x9e, 0xbc, 0xb8, 0xce, 0x28,
0x56, 0x6c, 0x99, 0xb9, 0xfa, 0xab, 0xee, 0xb5, 0x5f, 0x97, 0xb9, 0xba, 0x0f, 0x1b, 0xee, 0x27,
0x2b, 0x80, 0x7a, 0x12, 0x1a, 0x40, 0xef, 0xe1, 0xb3, 0xe5, 0xd3, 0xc5, 0x14, 0x8f, 0xde, 0x41,
0x2e, 0x74, 0x2e, 0xcf, 0x97, 0x97, 0xd3, 0x91, 0x23, 0xf1, 0xf9, 0x72, 0x36, 0x3b, 0xc7, 0x2f,
0x46, 0x7b, 0xb2, 0x58, 0x3e, 0x5d, 0xbc, 0x78, 0x3e, 0x7d, 0x34, 0x6a, 0xa1, 0x21, 0xb8, 0x4f,
0xbe, 0x9d, 0x2f, 0x9e, 0x5d, 0xe2, 0xf3, 0xd9, 0xa8, 0x8d, 0xde, 0x85, 0x3b, 0xaa, 0x27, 0xac,
0xc1, 0xce, 0x05, 0x86, 0xc6, 0x3f, 0x18, 0x3f, 0x3c, 0x88, 0x62, 0xb1, 0x2d, 0x57, 0xc1, 0x9a,
0xb3, 0x7f, 0xff, 0x45, 0x09, 0x19, 0xdf, 0xd0, 0x64, 0x12, 0xf1, 0xaf, 0x62, 0x1e, 0xd6, 0xab,
0xa1, 0x5e, 0xfd, 0x27, 0x00, 0x00, 0xff, 0xff, 0x16, 0x77, 0x81, 0x98, 0xd7, 0x08, 0x00, 0x00,
}

View File

@ -1,4 +1,4 @@
# Logrus <img src="http://i.imgur.com/hTeVwmJ.png" width="40" height="40" alt=":walrus:" class="emoji" title=":walrus:"/> [![Build Status](https://travis-ci.org/sirupsen/logrus.svg?branch=master)](https://travis-ci.org/sirupsen/logrus) [![GoDoc](https://godoc.org/github.com/sirupsen/logrus?status.svg)](https://godoc.org/github.com/sirupsen/logrus)
# Logrus <img src="http://i.imgur.com/hTeVwmJ.png" width="40" height="40" alt=":walrus:" class="emoji" title=":walrus:"/> [![Build Status](https://github.com/sirupsen/logrus/workflows/CI/badge.svg)](https://github.com/sirupsen/logrus/actions?query=workflow%3ACI) [![Build Status](https://travis-ci.org/sirupsen/logrus.svg?branch=master)](https://travis-ci.org/sirupsen/logrus) [![Go Reference](https://pkg.go.dev/badge/github.com/sirupsen/logrus.svg)](https://pkg.go.dev/github.com/sirupsen/logrus)
Logrus is a structured logger for Go (golang), completely API compatible with
the standard library logger.
@ -341,7 +341,7 @@ import (
log "github.com/sirupsen/logrus"
)
init() {
func init() {
// do something here to set environment depending on an environment variable
// or command-line flag
if Environment == "production" {

View File

@ -26,15 +26,6 @@ func (p *defaultPool) Get() *bytes.Buffer {
return p.pool.Get().(*bytes.Buffer)
}
func getBuffer() *bytes.Buffer {
return bufferPool.Get()
}
func putBuffer(buf *bytes.Buffer) {
buf.Reset()
bufferPool.Put(buf)
}
// SetBufferPool allows to replace the default logrus buffer pool
// to better meets the specific needs of an application.
func SetBufferPool(bp BufferPool) {

View File

@ -232,6 +232,7 @@ func (entry *Entry) log(level Level, msg string) {
newEntry.Logger.mu.Lock()
reportCaller := newEntry.Logger.ReportCaller
bufPool := newEntry.getBufferPool()
newEntry.Logger.mu.Unlock()
if reportCaller {
@ -239,11 +240,11 @@ func (entry *Entry) log(level Level, msg string) {
}
newEntry.fireHooks()
buffer = getBuffer()
buffer = bufPool.Get()
defer func() {
newEntry.Buffer = nil
putBuffer(buffer)
buffer.Reset()
bufPool.Put(buffer)
}()
buffer.Reset()
newEntry.Buffer = buffer
@ -260,6 +261,13 @@ func (entry *Entry) log(level Level, msg string) {
}
}
func (entry *Entry) getBufferPool() (pool BufferPool) {
if entry.Logger.BufferPool != nil {
return entry.Logger.BufferPool
}
return bufferPool
}
func (entry *Entry) fireHooks() {
var tmpHooks LevelHooks
entry.Logger.mu.Lock()
@ -276,18 +284,21 @@ func (entry *Entry) fireHooks() {
}
func (entry *Entry) write() {
entry.Logger.mu.Lock()
defer entry.Logger.mu.Unlock()
serialized, err := entry.Logger.Formatter.Format(entry)
if err != nil {
fmt.Fprintf(os.Stderr, "Failed to obtain reader, %v\n", err)
return
}
entry.Logger.mu.Lock()
defer entry.Logger.mu.Unlock()
if _, err := entry.Logger.Out.Write(serialized); err != nil {
fmt.Fprintf(os.Stderr, "Failed to write to log, %v\n", err)
}
}
// Log will log a message at the level given as parameter.
// Warning: using Log at Panic or Fatal level will not respectively Panic nor Exit.
// For this behaviour Entry.Panic or Entry.Fatal should be used instead.
func (entry *Entry) Log(level Level, args ...interface{}) {
if entry.Logger.IsLevelEnabled(level) {
entry.log(level, fmt.Sprint(args...))

View File

@ -44,6 +44,9 @@ type Logger struct {
entryPool sync.Pool
// Function to exit the application, defaults to `os.Exit()`
ExitFunc exitFunc
// The buffer pool used to format the log. If it is nil, the default global
// buffer pool will be used.
BufferPool BufferPool
}
type exitFunc func(int)
@ -192,6 +195,9 @@ func (logger *Logger) Panicf(format string, args ...interface{}) {
logger.Logf(PanicLevel, format, args...)
}
// Log will log a message at the level given as parameter.
// Warning: using Log at Panic or Fatal level will not respectively Panic nor Exit.
// For this behaviour Logger.Panic or Logger.Fatal should be used instead.
func (logger *Logger) Log(level Level, args ...interface{}) {
if logger.IsLevelEnabled(level) {
entry := logger.newEntry()
@ -402,3 +408,10 @@ func (logger *Logger) ReplaceHooks(hooks LevelHooks) LevelHooks {
logger.mu.Unlock()
return oldHooks
}
// SetBufferPool sets the logger buffer pool.
func (logger *Logger) SetBufferPool(pool BufferPool) {
logger.mu.Lock()
defer logger.mu.Unlock()
logger.BufferPool = pool
}

View File

@ -25,6 +25,6 @@ tasks:
- go test -race ./...
test-coverage:
desc: Runs go tests and calucates test coverage
desc: Runs go tests and calculates test coverage
cmds:
- go test -race -coverprofile=c.out ./...

View File

@ -8,9 +8,11 @@
package md4
var shift1 = []uint{3, 7, 11, 19}
var shift2 = []uint{3, 5, 9, 13}
var shift3 = []uint{3, 9, 11, 15}
import "math/bits"
var shift1 = []int{3, 7, 11, 19}
var shift2 = []int{3, 5, 9, 13}
var shift3 = []int{3, 9, 11, 15}
var xIndex2 = []uint{0, 4, 8, 12, 1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15}
var xIndex3 = []uint{0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15}
@ -48,7 +50,7 @@ func _Block(dig *digest, p []byte) int {
s := shift1[i%4]
f := ((c ^ d) & b) ^ d
a += f + X[x]
a = a<<s | a>>(32-s)
a = bits.RotateLeft32(a, s)
a, b, c, d = d, a, b, c
}
@ -58,7 +60,7 @@ func _Block(dig *digest, p []byte) int {
s := shift2[i%4]
g := (b & c) | (b & d) | (c & d)
a += g + X[x] + 0x5a827999
a = a<<s | a>>(32-s)
a = bits.RotateLeft32(a, s)
a, b, c, d = d, a, b, c
}
@ -68,7 +70,7 @@ func _Block(dig *digest, p []byte) int {
s := shift3[i%4]
h := b ^ c ^ d
a += h + X[x] + 0x6ed9eba1
a = a<<s | a>>(32-s)
a = bits.RotateLeft32(a, s)
a, b, c, d = d, a, b, c
}

View File

@ -14,6 +14,7 @@ package rc2
import (
"crypto/cipher"
"encoding/binary"
"math/bits"
)
// The rc2 block size in bytes
@ -80,10 +81,6 @@ func expandKey(key []byte, t1 int) [64]uint16 {
return k
}
func rotl16(x uint16, b uint) uint16 {
return (x >> (16 - b)) | (x << b)
}
func (c *rc2Cipher) Encrypt(dst, src []byte) {
r0 := binary.LittleEndian.Uint16(src[0:])
@ -96,22 +93,22 @@ func (c *rc2Cipher) Encrypt(dst, src []byte) {
for j <= 16 {
// mix r0
r0 = r0 + c.k[j] + (r3 & r2) + ((^r3) & r1)
r0 = rotl16(r0, 1)
r0 = bits.RotateLeft16(r0, 1)
j++
// mix r1
r1 = r1 + c.k[j] + (r0 & r3) + ((^r0) & r2)
r1 = rotl16(r1, 2)
r1 = bits.RotateLeft16(r1, 2)
j++
// mix r2
r2 = r2 + c.k[j] + (r1 & r0) + ((^r1) & r3)
r2 = rotl16(r2, 3)
r2 = bits.RotateLeft16(r2, 3)
j++
// mix r3
r3 = r3 + c.k[j] + (r2 & r1) + ((^r2) & r0)
r3 = rotl16(r3, 5)
r3 = bits.RotateLeft16(r3, 5)
j++
}
@ -124,22 +121,22 @@ func (c *rc2Cipher) Encrypt(dst, src []byte) {
for j <= 40 {
// mix r0
r0 = r0 + c.k[j] + (r3 & r2) + ((^r3) & r1)
r0 = rotl16(r0, 1)
r0 = bits.RotateLeft16(r0, 1)
j++
// mix r1
r1 = r1 + c.k[j] + (r0 & r3) + ((^r0) & r2)
r1 = rotl16(r1, 2)
r1 = bits.RotateLeft16(r1, 2)
j++
// mix r2
r2 = r2 + c.k[j] + (r1 & r0) + ((^r1) & r3)
r2 = rotl16(r2, 3)
r2 = bits.RotateLeft16(r2, 3)
j++
// mix r3
r3 = r3 + c.k[j] + (r2 & r1) + ((^r2) & r0)
r3 = rotl16(r3, 5)
r3 = bits.RotateLeft16(r3, 5)
j++
}
@ -152,22 +149,22 @@ func (c *rc2Cipher) Encrypt(dst, src []byte) {
for j <= 60 {
// mix r0
r0 = r0 + c.k[j] + (r3 & r2) + ((^r3) & r1)
r0 = rotl16(r0, 1)
r0 = bits.RotateLeft16(r0, 1)
j++
// mix r1
r1 = r1 + c.k[j] + (r0 & r3) + ((^r0) & r2)
r1 = rotl16(r1, 2)
r1 = bits.RotateLeft16(r1, 2)
j++
// mix r2
r2 = r2 + c.k[j] + (r1 & r0) + ((^r1) & r3)
r2 = rotl16(r2, 3)
r2 = bits.RotateLeft16(r2, 3)
j++
// mix r3
r3 = r3 + c.k[j] + (r2 & r1) + ((^r2) & r0)
r3 = rotl16(r3, 5)
r3 = bits.RotateLeft16(r3, 5)
j++
}
@ -188,22 +185,22 @@ func (c *rc2Cipher) Decrypt(dst, src []byte) {
for j >= 44 {
// unmix r3
r3 = rotl16(r3, 16-5)
r3 = bits.RotateLeft16(r3, 16-5)
r3 = r3 - c.k[j] - (r2 & r1) - ((^r2) & r0)
j--
// unmix r2
r2 = rotl16(r2, 16-3)
r2 = bits.RotateLeft16(r2, 16-3)
r2 = r2 - c.k[j] - (r1 & r0) - ((^r1) & r3)
j--
// unmix r1
r1 = rotl16(r1, 16-2)
r1 = bits.RotateLeft16(r1, 16-2)
r1 = r1 - c.k[j] - (r0 & r3) - ((^r0) & r2)
j--
// unmix r0
r0 = rotl16(r0, 16-1)
r0 = bits.RotateLeft16(r0, 16-1)
r0 = r0 - c.k[j] - (r3 & r2) - ((^r3) & r1)
j--
}
@ -215,22 +212,22 @@ func (c *rc2Cipher) Decrypt(dst, src []byte) {
for j >= 20 {
// unmix r3
r3 = rotl16(r3, 16-5)
r3 = bits.RotateLeft16(r3, 16-5)
r3 = r3 - c.k[j] - (r2 & r1) - ((^r2) & r0)
j--
// unmix r2
r2 = rotl16(r2, 16-3)
r2 = bits.RotateLeft16(r2, 16-3)
r2 = r2 - c.k[j] - (r1 & r0) - ((^r1) & r3)
j--
// unmix r1
r1 = rotl16(r1, 16-2)
r1 = bits.RotateLeft16(r1, 16-2)
r1 = r1 - c.k[j] - (r0 & r3) - ((^r0) & r2)
j--
// unmix r0
r0 = rotl16(r0, 16-1)
r0 = bits.RotateLeft16(r0, 16-1)
r0 = r0 - c.k[j] - (r3 & r2) - ((^r3) & r1)
j--
@ -243,22 +240,22 @@ func (c *rc2Cipher) Decrypt(dst, src []byte) {
for j >= 0 {
// unmix r3
r3 = rotl16(r3, 16-5)
r3 = bits.RotateLeft16(r3, 16-5)
r3 = r3 - c.k[j] - (r2 & r1) - ((^r2) & r0)
j--
// unmix r2
r2 = rotl16(r2, 16-3)
r2 = bits.RotateLeft16(r2, 16-3)
r2 = r2 - c.k[j] - (r1 & r0) - ((^r1) & r3)
j--
// unmix r1
r1 = rotl16(r1, 16-2)
r1 = bits.RotateLeft16(r1, 16-2)
r1 = r1 - c.k[j] - (r0 & r3) - ((^r0) & r2)
j--
// unmix r0
r0 = rotl16(r0, 16-1)
r0 = bits.RotateLeft16(r0, 16-1)
r0 = r0 - c.k[j] - (r3 & r2) - ((^r3) & r1)
j--

View File

@ -6,23 +6,91 @@
package http2
// flow is the flow control window's size.
type flow struct {
// inflowMinRefresh is the minimum number of bytes we'll send for a
// flow control window update.
const inflowMinRefresh = 4 << 10
// inflow accounts for an inbound flow control window.
// It tracks both the latest window sent to the peer (used for enforcement)
// and the accumulated unsent window.
type inflow struct {
avail int32
unsent int32
}
// init sets the initial window.
func (f *inflow) init(n int32) {
f.avail = n
}
// add adds n bytes to the window, with a maximum window size of max,
// indicating that the peer can now send us more data.
// For example, the user read from a {Request,Response} body and consumed
// some of the buffered data, so the peer can now send more.
// It returns the number of bytes to send in a WINDOW_UPDATE frame to the peer.
// Window updates are accumulated and sent when the unsent capacity
// is at least inflowMinRefresh or will at least double the peer's available window.
func (f *inflow) add(n int) (connAdd int32) {
if n < 0 {
panic("negative update")
}
unsent := int64(f.unsent) + int64(n)
// "A sender MUST NOT allow a flow-control window to exceed 2^31-1 octets."
// RFC 7540 Section 6.9.1.
const maxWindow = 1<<31 - 1
if unsent+int64(f.avail) > maxWindow {
panic("flow control update exceeds maximum window size")
}
f.unsent = int32(unsent)
if f.unsent < inflowMinRefresh && f.unsent < f.avail {
// If there aren't at least inflowMinRefresh bytes of window to send,
// and this update won't at least double the window, buffer the update for later.
return 0
}
f.avail += f.unsent
f.unsent = 0
return int32(unsent)
}
// take attempts to take n bytes from the peer's flow control window.
// It reports whether the window has available capacity.
func (f *inflow) take(n uint32) bool {
if n > uint32(f.avail) {
return false
}
f.avail -= int32(n)
return true
}
// takeInflows attempts to take n bytes from two inflows,
// typically connection-level and stream-level flows.
// It reports whether both windows have available capacity.
func takeInflows(f1, f2 *inflow, n uint32) bool {
if n > uint32(f1.avail) || n > uint32(f2.avail) {
return false
}
f1.avail -= int32(n)
f2.avail -= int32(n)
return true
}
// outflow is the outbound flow control window's size.
type outflow struct {
_ incomparable
// n is the number of DATA bytes we're allowed to send.
// A flow is kept both on a conn and a per-stream.
// An outflow is kept both on a conn and a per-stream.
n int32
// conn points to the shared connection-level flow that is
// shared by all streams on that conn. It is nil for the flow
// conn points to the shared connection-level outflow that is
// shared by all streams on that conn. It is nil for the outflow
// that's on the conn directly.
conn *flow
conn *outflow
}
func (f *flow) setConnFlow(cf *flow) { f.conn = cf }
func (f *outflow) setConnFlow(cf *outflow) { f.conn = cf }
func (f *flow) available() int32 {
func (f *outflow) available() int32 {
n := f.n
if f.conn != nil && f.conn.n < n {
n = f.conn.n
@ -30,7 +98,7 @@ func (f *flow) available() int32 {
return n
}
func (f *flow) take(n int32) {
func (f *outflow) take(n int32) {
if n > f.available() {
panic("internal error: took too much")
}
@ -42,7 +110,7 @@ func (f *flow) take(n int32) {
// add adds n bytes (positive or negative) to the flow control window.
// It returns false if the sum would exceed 2^31-1.
func (f *flow) add(n int32) bool {
func (f *outflow) add(n int32) bool {
sum := f.n + n
if (sum > n) == (f.n > 0) {
f.n = sum

View File

@ -662,6 +662,15 @@ func (f *Framer) WriteData(streamID uint32, endStream bool, data []byte) error {
// It is the caller's responsibility not to violate the maximum frame size
// and to not call other Write methods concurrently.
func (f *Framer) WriteDataPadded(streamID uint32, endStream bool, data, pad []byte) error {
if err := f.startWriteDataPadded(streamID, endStream, data, pad); err != nil {
return err
}
return f.endWrite()
}
// startWriteDataPadded is WriteDataPadded, but only writes the frame to the Framer's internal buffer.
// The caller should call endWrite to flush the frame to the underlying writer.
func (f *Framer) startWriteDataPadded(streamID uint32, endStream bool, data, pad []byte) error {
if !validStreamID(streamID) && !f.AllowIllegalWrites {
return errStreamID
}
@ -691,7 +700,7 @@ func (f *Framer) WriteDataPadded(streamID uint32, endStream bool, data, pad []by
}
f.wbuf = append(f.wbuf, data...)
f.wbuf = append(f.wbuf, pad...)
return f.endWrite()
return nil
}
// A SettingsFrame conveys configuration parameters that affect how

View File

@ -116,6 +116,11 @@ func (e *Encoder) SetMaxDynamicTableSize(v uint32) {
e.dynTab.setMaxSize(v)
}
// MaxDynamicTableSize returns the current dynamic header table size.
func (e *Encoder) MaxDynamicTableSize() (v uint32) {
return e.dynTab.maxSize
}
// SetMaxDynamicTableSizeLimit changes the maximum value that can be
// specified in SetMaxDynamicTableSize to v. By default, it is set to
// 4096, which is the same size of the default dynamic header table

View File

@ -211,7 +211,7 @@ func (d *Decoder) at(i uint64) (hf HeaderField, ok bool) {
return dt.ents[dt.len()-(int(i)-staticTable.len())], true
}
// Decode decodes an entire block.
// DecodeFull decodes an entire block.
//
// TODO: remove this method and make it incremental later? This is
// easier for debugging now.
@ -359,6 +359,7 @@ func (d *Decoder) parseFieldLiteral(n uint8, it indexType) error {
var hf HeaderField
wantStr := d.emitEnabled || it.indexed()
var undecodedName undecodedString
if nameIdx > 0 {
ihf, ok := d.at(nameIdx)
if !ok {
@ -366,15 +367,27 @@ func (d *Decoder) parseFieldLiteral(n uint8, it indexType) error {
}
hf.Name = ihf.Name
} else {
hf.Name, buf, err = d.readString(buf, wantStr)
undecodedName, buf, err = d.readString(buf)
if err != nil {
return err
}
}
hf.Value, buf, err = d.readString(buf, wantStr)
undecodedValue, buf, err := d.readString(buf)
if err != nil {
return err
}
if wantStr {
if nameIdx <= 0 {
hf.Name, err = d.decodeString(undecodedName)
if err != nil {
return err
}
}
hf.Value, err = d.decodeString(undecodedValue)
if err != nil {
return err
}
}
d.buf = buf
if it.indexed() {
d.dynTab.add(hf)
@ -459,46 +472,52 @@ func readVarInt(n byte, p []byte) (i uint64, remain []byte, err error) {
return 0, origP, errNeedMore
}
// readString decodes an hpack string from p.
// readString reads an hpack string from p.
//
// wantStr is whether s will be used. If false, decompression and
// []byte->string garbage are skipped if s will be ignored
// anyway. This does mean that huffman decoding errors for non-indexed
// strings past the MAX_HEADER_LIST_SIZE are ignored, but the server
// is returning an error anyway, and because they're not indexed, the error
// won't affect the decoding state.
func (d *Decoder) readString(p []byte, wantStr bool) (s string, remain []byte, err error) {
// It returns a reference to the encoded string data to permit deferring decode costs
// until after the caller verifies all data is present.
func (d *Decoder) readString(p []byte) (u undecodedString, remain []byte, err error) {
if len(p) == 0 {
return "", p, errNeedMore
return u, p, errNeedMore
}
isHuff := p[0]&128 != 0
strLen, p, err := readVarInt(7, p)
if err != nil {
return "", p, err
return u, p, err
}
if d.maxStrLen != 0 && strLen > uint64(d.maxStrLen) {
return "", nil, ErrStringLength
// Returning an error here means Huffman decoding errors
// for non-indexed strings past the maximum string length
// are ignored, but the server is returning an error anyway
// and because the string is not indexed the error will not
// affect the decoding state.
return u, nil, ErrStringLength
}
if uint64(len(p)) < strLen {
return "", p, errNeedMore
return u, p, errNeedMore
}
if !isHuff {
if wantStr {
s = string(p[:strLen])
}
return s, p[strLen:], nil
}
if wantStr {
buf := bufPool.Get().(*bytes.Buffer)
buf.Reset() // don't trust others
defer bufPool.Put(buf)
if err := huffmanDecode(buf, d.maxStrLen, p[:strLen]); err != nil {
buf.Reset()
return "", nil, err
}
s = buf.String()
buf.Reset() // be nice to GC
}
return s, p[strLen:], nil
u.isHuff = isHuff
u.b = p[:strLen]
return u, p[strLen:], nil
}
type undecodedString struct {
isHuff bool
b []byte
}
func (d *Decoder) decodeString(u undecodedString) (string, error) {
if !u.isHuff {
return string(u.b), nil
}
buf := bufPool.Get().(*bytes.Buffer)
buf.Reset() // don't trust others
var s string
err := huffmanDecode(buf, d.maxStrLen, u.b)
if err == nil {
s = buf.String()
}
buf.Reset() // be nice to GC
bufPool.Put(buf)
return s, err
}

View File

@ -98,6 +98,19 @@ type Server struct {
// the HTTP/2 spec's recommendations.
MaxConcurrentStreams uint32
// MaxDecoderHeaderTableSize optionally specifies the http2
// SETTINGS_HEADER_TABLE_SIZE to send in the initial settings frame. It
// informs the remote endpoint of the maximum size of the header compression
// table used to decode header blocks, in octets. If zero, the default value
// of 4096 is used.
MaxDecoderHeaderTableSize uint32
// MaxEncoderHeaderTableSize optionally specifies an upper limit for the
// header compression table used for encoding request headers. Received
// SETTINGS_HEADER_TABLE_SIZE settings are capped at this limit. If zero,
// the default value of 4096 is used.
MaxEncoderHeaderTableSize uint32
// MaxReadFrameSize optionally specifies the largest frame
// this server is willing to read. A valid value is between
// 16k and 16M, inclusive. If zero or otherwise invalid, a
@ -170,6 +183,20 @@ func (s *Server) maxConcurrentStreams() uint32 {
return defaultMaxStreams
}
func (s *Server) maxDecoderHeaderTableSize() uint32 {
if v := s.MaxDecoderHeaderTableSize; v > 0 {
return v
}
return initialHeaderTableSize
}
func (s *Server) maxEncoderHeaderTableSize() uint32 {
if v := s.MaxEncoderHeaderTableSize; v > 0 {
return v
}
return initialHeaderTableSize
}
// maxQueuedControlFrames is the maximum number of control frames like
// SETTINGS, PING and RST_STREAM that will be queued for writing before
// the connection is closed to prevent memory exhaustion attacks.
@ -394,7 +421,6 @@ func (s *Server) ServeConn(c net.Conn, opts *ServeConnOpts) {
advMaxStreams: s.maxConcurrentStreams(),
initialStreamSendWindowSize: initialWindowSize,
maxFrameSize: initialMaxFrameSize,
headerTableSize: initialHeaderTableSize,
serveG: newGoroutineLock(),
pushEnabled: true,
sawClientPreface: opts.SawClientPreface,
@ -422,14 +448,15 @@ func (s *Server) ServeConn(c net.Conn, opts *ServeConnOpts) {
// configured value for inflow, that will be updated when we send a
// WINDOW_UPDATE shortly after sending SETTINGS.
sc.flow.add(initialWindowSize)
sc.inflow.add(initialWindowSize)
sc.inflow.init(initialWindowSize)
sc.hpackEncoder = hpack.NewEncoder(&sc.headerWriteBuf)
sc.hpackEncoder.SetMaxDynamicTableSizeLimit(s.maxEncoderHeaderTableSize())
fr := NewFramer(sc.bw, c)
if s.CountError != nil {
fr.countError = s.CountError
}
fr.ReadMetaHeaders = hpack.NewDecoder(initialHeaderTableSize, nil)
fr.ReadMetaHeaders = hpack.NewDecoder(s.maxDecoderHeaderTableSize(), nil)
fr.MaxHeaderListSize = sc.maxHeaderListSize()
fr.SetMaxReadFrameSize(s.maxReadFrameSize())
sc.framer = fr
@ -536,8 +563,8 @@ type serverConn struct {
wroteFrameCh chan frameWriteResult // from writeFrameAsync -> serve, tickles more frame writes
bodyReadCh chan bodyReadMsg // from handlers -> serve
serveMsgCh chan interface{} // misc messages & code to send to / run on the serve loop
flow flow // conn-wide (not stream-specific) outbound flow control
inflow flow // conn-wide inbound flow control
flow outflow // conn-wide (not stream-specific) outbound flow control
inflow inflow // conn-wide inbound flow control
tlsState *tls.ConnectionState // shared by all handlers, like net/http
remoteAddrStr string
writeSched WriteScheduler
@ -559,9 +586,9 @@ type serverConn struct {
streams map[uint32]*stream
initialStreamSendWindowSize int32
maxFrameSize int32
headerTableSize uint32
peerMaxHeaderListSize uint32 // zero means unknown (default)
canonHeader map[string]string // http2-lower-case -> Go-Canonical-Case
canonHeaderKeysSize int // canonHeader keys size in bytes
writingFrame bool // started writing a frame (on serve goroutine or separate)
writingFrameAsync bool // started a frame on its own goroutine but haven't heard back on wroteFrameCh
needsFrameFlush bool // last frame write wasn't a flush
@ -614,10 +641,10 @@ type stream struct {
cancelCtx func()
// owned by serverConn's serve loop:
bodyBytes int64 // body bytes seen so far
declBodyBytes int64 // or -1 if undeclared
flow flow // limits writing from Handler to client
inflow flow // what the client is allowed to POST/etc to us
bodyBytes int64 // body bytes seen so far
declBodyBytes int64 // or -1 if undeclared
flow outflow // limits writing from Handler to client
inflow inflow // what the client is allowed to POST/etc to us
state streamState
resetQueued bool // RST_STREAM queued for write; set by sc.resetStream
gotTrailerHeader bool // HEADER frame for trailers was seen
@ -740,6 +767,13 @@ func (sc *serverConn) condlogf(err error, format string, args ...interface{}) {
}
}
// maxCachedCanonicalHeadersKeysSize is an arbitrarily-chosen limit on the size
// of the entries in the canonHeader cache.
// This should be larger than the size of unique, uncommon header keys likely to
// be sent by the peer, while not so high as to permit unreasonable memory usage
// if the peer sends an unbounded number of unique header keys.
const maxCachedCanonicalHeadersKeysSize = 2048
func (sc *serverConn) canonicalHeader(v string) string {
sc.serveG.check()
buildCommonHeaderMapsOnce()
@ -755,14 +789,10 @@ func (sc *serverConn) canonicalHeader(v string) string {
sc.canonHeader = make(map[string]string)
}
cv = http.CanonicalHeaderKey(v)
// maxCachedCanonicalHeaders is an arbitrarily-chosen limit on the number of
// entries in the canonHeader cache. This should be larger than the number
// of unique, uncommon header keys likely to be sent by the peer, while not
// so high as to permit unreasonable memory usage if the peer sends an unbounded
// number of unique header keys.
const maxCachedCanonicalHeaders = 32
if len(sc.canonHeader) < maxCachedCanonicalHeaders {
size := 100 + len(v)*2 // 100 bytes of map overhead + key + value
if sc.canonHeaderKeysSize+size <= maxCachedCanonicalHeadersKeysSize {
sc.canonHeader[v] = cv
sc.canonHeaderKeysSize += size
}
return cv
}
@ -813,8 +843,13 @@ type frameWriteResult struct {
// and then reports when it's done.
// At most one goroutine can be running writeFrameAsync at a time per
// serverConn.
func (sc *serverConn) writeFrameAsync(wr FrameWriteRequest) {
err := wr.write.writeFrame(sc)
func (sc *serverConn) writeFrameAsync(wr FrameWriteRequest, wd *writeData) {
var err error
if wd == nil {
err = wr.write.writeFrame(sc)
} else {
err = sc.framer.endWrite()
}
sc.wroteFrameCh <- frameWriteResult{wr: wr, err: err}
}
@ -864,6 +899,7 @@ func (sc *serverConn) serve() {
{SettingMaxFrameSize, sc.srv.maxReadFrameSize()},
{SettingMaxConcurrentStreams, sc.advMaxStreams},
{SettingMaxHeaderListSize, sc.maxHeaderListSize()},
{SettingHeaderTableSize, sc.srv.maxDecoderHeaderTableSize()},
{SettingInitialWindowSize, uint32(sc.srv.initialStreamRecvWindowSize())},
},
})
@ -1220,9 +1256,16 @@ func (sc *serverConn) startFrameWrite(wr FrameWriteRequest) {
sc.writingFrameAsync = false
err := wr.write.writeFrame(sc)
sc.wroteFrame(frameWriteResult{wr: wr, err: err})
} else if wd, ok := wr.write.(*writeData); ok {
// Encode the frame in the serve goroutine, to ensure we don't have
// any lingering asynchronous references to data passed to Write.
// See https://go.dev/issue/58446.
sc.framer.startWriteDataPadded(wd.streamID, wd.endStream, wd.p, nil)
sc.writingFrameAsync = true
go sc.writeFrameAsync(wr, wd)
} else {
sc.writingFrameAsync = true
go sc.writeFrameAsync(wr)
go sc.writeFrameAsync(wr, nil)
}
}
@ -1472,7 +1515,7 @@ func (sc *serverConn) processFrame(f Frame) error {
if sc.inGoAway && (sc.goAwayCode != ErrCodeNo || f.Header().StreamID > sc.maxClientStreamID) {
if f, ok := f.(*DataFrame); ok {
if sc.inflow.available() < int32(f.Length) {
if !sc.inflow.take(f.Length) {
return sc.countError("data_flow", streamError(f.Header().StreamID, ErrCodeFlowControl))
}
sc.sendWindowUpdate(nil, int(f.Length)) // conn-level
@ -1661,7 +1704,6 @@ func (sc *serverConn) processSetting(s Setting) error {
}
switch s.ID {
case SettingHeaderTableSize:
sc.headerTableSize = s.Val
sc.hpackEncoder.SetMaxDynamicTableSize(s.Val)
case SettingEnablePush:
sc.pushEnabled = s.Val != 0
@ -1745,14 +1787,9 @@ func (sc *serverConn) processData(f *DataFrame) error {
// But still enforce their connection-level flow control,
// and return any flow control bytes since we're not going
// to consume them.
if sc.inflow.available() < int32(f.Length) {
if !sc.inflow.take(f.Length) {
return sc.countError("data_flow", streamError(id, ErrCodeFlowControl))
}
// Deduct the flow control from inflow, since we're
// going to immediately add it back in
// sendWindowUpdate, which also schedules sending the
// frames.
sc.inflow.take(int32(f.Length))
sc.sendWindowUpdate(nil, int(f.Length)) // conn-level
if st != nil && st.resetQueued {
@ -1767,10 +1804,9 @@ func (sc *serverConn) processData(f *DataFrame) error {
// Sender sending more than they'd declared?
if st.declBodyBytes != -1 && st.bodyBytes+int64(len(data)) > st.declBodyBytes {
if sc.inflow.available() < int32(f.Length) {
if !sc.inflow.take(f.Length) {
return sc.countError("data_flow", streamError(id, ErrCodeFlowControl))
}
sc.inflow.take(int32(f.Length))
sc.sendWindowUpdate(nil, int(f.Length)) // conn-level
st.body.CloseWithError(fmt.Errorf("sender tried to send more than declared Content-Length of %d bytes", st.declBodyBytes))
@ -1781,10 +1817,9 @@ func (sc *serverConn) processData(f *DataFrame) error {
}
if f.Length > 0 {
// Check whether the client has flow control quota.
if st.inflow.available() < int32(f.Length) {
if !takeInflows(&sc.inflow, &st.inflow, f.Length) {
return sc.countError("flow_on_data_length", streamError(id, ErrCodeFlowControl))
}
st.inflow.take(int32(f.Length))
if len(data) > 0 {
wrote, err := st.body.Write(data)
@ -1800,10 +1835,12 @@ func (sc *serverConn) processData(f *DataFrame) error {
// Return any padded flow control now, since we won't
// refund it later on body reads.
if pad := int32(f.Length) - int32(len(data)); pad > 0 {
sc.sendWindowUpdate32(nil, pad)
sc.sendWindowUpdate32(st, pad)
}
// Call sendWindowUpdate even if there is no padding,
// to return buffered flow control credit if the sent
// window has shrunk.
pad := int32(f.Length) - int32(len(data))
sc.sendWindowUpdate32(nil, pad)
sc.sendWindowUpdate32(st, pad)
}
if f.StreamEnded() {
st.endStream()
@ -2075,8 +2112,7 @@ func (sc *serverConn) newStream(id, pusherID uint32, state streamState) *stream
st.cw.Init()
st.flow.conn = &sc.flow // link to conn-level counter
st.flow.add(sc.initialStreamSendWindowSize)
st.inflow.conn = &sc.inflow // link to conn-level counter
st.inflow.add(sc.srv.initialStreamRecvWindowSize())
st.inflow.init(sc.srv.initialStreamRecvWindowSize())
if sc.hs.WriteTimeout != 0 {
st.writeDeadline = time.AfterFunc(sc.hs.WriteTimeout, st.onWriteTimeout)
}
@ -2168,7 +2204,7 @@ func (sc *serverConn) newWriterAndRequestNoBody(st *stream, rp requestParam) (*r
tlsState = sc.tlsState
}
needsContinue := rp.header.Get("Expect") == "100-continue"
needsContinue := httpguts.HeaderValuesContainsToken(rp.header["Expect"], "100-continue")
if needsContinue {
rp.header.Del("Expect")
}
@ -2358,47 +2394,28 @@ func (sc *serverConn) noteBodyRead(st *stream, n int) {
}
// st may be nil for conn-level
func (sc *serverConn) sendWindowUpdate(st *stream, n int) {
sc.serveG.check()
// "The legal range for the increment to the flow control
// window is 1 to 2^31-1 (2,147,483,647) octets."
// A Go Read call on 64-bit machines could in theory read
// a larger Read than this. Very unlikely, but we handle it here
// rather than elsewhere for now.
const maxUint31 = 1<<31 - 1
for n > maxUint31 {
sc.sendWindowUpdate32(st, maxUint31)
n -= maxUint31
}
sc.sendWindowUpdate32(st, int32(n))
func (sc *serverConn) sendWindowUpdate32(st *stream, n int32) {
sc.sendWindowUpdate(st, int(n))
}
// st may be nil for conn-level
func (sc *serverConn) sendWindowUpdate32(st *stream, n int32) {
func (sc *serverConn) sendWindowUpdate(st *stream, n int) {
sc.serveG.check()
if n == 0 {
var streamID uint32
var send int32
if st == nil {
send = sc.inflow.add(n)
} else {
streamID = st.id
send = st.inflow.add(n)
}
if send == 0 {
return
}
if n < 0 {
panic("negative update")
}
var streamID uint32
if st != nil {
streamID = st.id
}
sc.writeFrame(FrameWriteRequest{
write: writeWindowUpdate{streamID: streamID, n: uint32(n)},
write: writeWindowUpdate{streamID: streamID, n: uint32(send)},
stream: st,
})
var ok bool
if st == nil {
ok = sc.inflow.add(n)
} else {
ok = st.inflow.add(n)
}
if !ok {
panic("internal error; sent too many window updates without decrements?")
}
}
// requestBody is the Handler's Request.Body type.

View File

@ -47,10 +47,6 @@ const (
// we buffer per stream.
transportDefaultStreamFlow = 4 << 20
// transportDefaultStreamMinRefresh is the minimum number of bytes we'll send
// a stream-level WINDOW_UPDATE for at a time.
transportDefaultStreamMinRefresh = 4 << 10
defaultUserAgent = "Go-http-client/2.0"
// initialMaxConcurrentStreams is a connections maxConcurrentStreams until
@ -118,6 +114,28 @@ type Transport struct {
// to mean no limit.
MaxHeaderListSize uint32
// MaxReadFrameSize is the http2 SETTINGS_MAX_FRAME_SIZE to send in the
// initial settings frame. It is the size in bytes of the largest frame
// payload that the sender is willing to receive. If 0, no setting is
// sent, and the value is provided by the peer, which should be 16384
// according to the spec:
// https://datatracker.ietf.org/doc/html/rfc7540#section-6.5.2.
// Values are bounded in the range 16k to 16M.
MaxReadFrameSize uint32
// MaxDecoderHeaderTableSize optionally specifies the http2
// SETTINGS_HEADER_TABLE_SIZE to send in the initial settings frame. It
// informs the remote endpoint of the maximum size of the header compression
// table used to decode header blocks, in octets. If zero, the default value
// of 4096 is used.
MaxDecoderHeaderTableSize uint32
// MaxEncoderHeaderTableSize optionally specifies an upper limit for the
// header compression table used for encoding request headers. Received
// SETTINGS_HEADER_TABLE_SIZE settings are capped at this limit. If zero,
// the default value of 4096 is used.
MaxEncoderHeaderTableSize uint32
// StrictMaxConcurrentStreams controls whether the server's
// SETTINGS_MAX_CONCURRENT_STREAMS should be respected
// globally. If false, new TCP connections are created to the
@ -171,6 +189,19 @@ func (t *Transport) maxHeaderListSize() uint32 {
return t.MaxHeaderListSize
}
func (t *Transport) maxFrameReadSize() uint32 {
if t.MaxReadFrameSize == 0 {
return 0 // use the default provided by the peer
}
if t.MaxReadFrameSize < minMaxFrameSize {
return minMaxFrameSize
}
if t.MaxReadFrameSize > maxFrameSize {
return maxFrameSize
}
return t.MaxReadFrameSize
}
func (t *Transport) disableCompression() bool {
return t.DisableCompression || (t.t1 != nil && t.t1.DisableCompression)
}
@ -275,8 +306,8 @@ type ClientConn struct {
mu sync.Mutex // guards following
cond *sync.Cond // hold mu; broadcast on flow/closed changes
flow flow // our conn-level flow control quota (cs.flow is per stream)
inflow flow // peer's conn-level flow control
flow outflow // our conn-level flow control quota (cs.outflow is per stream)
inflow inflow // peer's conn-level flow control
doNotReuse bool // whether conn is marked to not be reused for any future requests
closing bool
closed bool
@ -293,10 +324,11 @@ type ClientConn struct {
lastActive time.Time
lastIdle time.Time // time last idle
// Settings from peer: (also guarded by wmu)
maxFrameSize uint32
maxConcurrentStreams uint32
peerMaxHeaderListSize uint64
initialWindowSize uint32
maxFrameSize uint32
maxConcurrentStreams uint32
peerMaxHeaderListSize uint64
peerMaxHeaderTableSize uint32
initialWindowSize uint32
// reqHeaderMu is a 1-element semaphore channel controlling access to sending new requests.
// Write to reqHeaderMu to lock it, read from it to unlock.
@ -340,10 +372,10 @@ type clientStream struct {
respHeaderRecv chan struct{} // closed when headers are received
res *http.Response // set if respHeaderRecv is closed
flow flow // guarded by cc.mu
inflow flow // guarded by cc.mu
bytesRemain int64 // -1 means unknown; owned by transportResponseBody.Read
readErr error // sticky read error; owned by transportResponseBody.Read
flow outflow // guarded by cc.mu
inflow inflow // guarded by cc.mu
bytesRemain int64 // -1 means unknown; owned by transportResponseBody.Read
readErr error // sticky read error; owned by transportResponseBody.Read
reqBody io.ReadCloser
reqBodyContentLength int64 // -1 means unknown
@ -681,6 +713,20 @@ func (t *Transport) expectContinueTimeout() time.Duration {
return t.t1.ExpectContinueTimeout
}
func (t *Transport) maxDecoderHeaderTableSize() uint32 {
if v := t.MaxDecoderHeaderTableSize; v > 0 {
return v
}
return initialHeaderTableSize
}
func (t *Transport) maxEncoderHeaderTableSize() uint32 {
if v := t.MaxEncoderHeaderTableSize; v > 0 {
return v
}
return initialHeaderTableSize
}
func (t *Transport) NewClientConn(c net.Conn) (*ClientConn, error) {
return t.newClientConn(c, t.disableKeepAlives())
}
@ -721,15 +767,19 @@ func (t *Transport) newClientConn(c net.Conn, singleUse bool) (*ClientConn, erro
})
cc.br = bufio.NewReader(c)
cc.fr = NewFramer(cc.bw, cc.br)
if t.maxFrameReadSize() != 0 {
cc.fr.SetMaxReadFrameSize(t.maxFrameReadSize())
}
if t.CountError != nil {
cc.fr.countError = t.CountError
}
cc.fr.ReadMetaHeaders = hpack.NewDecoder(initialHeaderTableSize, nil)
maxHeaderTableSize := t.maxDecoderHeaderTableSize()
cc.fr.ReadMetaHeaders = hpack.NewDecoder(maxHeaderTableSize, nil)
cc.fr.MaxHeaderListSize = t.maxHeaderListSize()
// TODO: SetMaxDynamicTableSize, SetMaxDynamicTableSizeLimit on
// henc in response to SETTINGS frames?
cc.henc = hpack.NewEncoder(&cc.hbuf)
cc.henc.SetMaxDynamicTableSizeLimit(t.maxEncoderHeaderTableSize())
cc.peerMaxHeaderTableSize = initialHeaderTableSize
if t.AllowHTTP {
cc.nextStreamID = 3
@ -744,14 +794,20 @@ func (t *Transport) newClientConn(c net.Conn, singleUse bool) (*ClientConn, erro
{ID: SettingEnablePush, Val: 0},
{ID: SettingInitialWindowSize, Val: transportDefaultStreamFlow},
}
if max := t.maxFrameReadSize(); max != 0 {
initialSettings = append(initialSettings, Setting{ID: SettingMaxFrameSize, Val: max})
}
if max := t.maxHeaderListSize(); max != 0 {
initialSettings = append(initialSettings, Setting{ID: SettingMaxHeaderListSize, Val: max})
}
if maxHeaderTableSize != initialHeaderTableSize {
initialSettings = append(initialSettings, Setting{ID: SettingHeaderTableSize, Val: maxHeaderTableSize})
}
cc.bw.Write(clientPreface)
cc.fr.WriteSettings(initialSettings...)
cc.fr.WriteWindowUpdate(0, transportDefaultConnFlow)
cc.inflow.add(transportDefaultConnFlow + initialWindowSize)
cc.inflow.init(transportDefaultConnFlow + initialWindowSize)
cc.bw.Flush()
if cc.werr != nil {
cc.Close()
@ -1513,7 +1569,7 @@ func (cs *clientStream) cleanupWriteRequest(err error) {
close(cs.donec)
}
// awaitOpenSlotForStream waits until len(streams) < maxConcurrentStreams.
// awaitOpenSlotForStreamLocked waits until len(streams) < maxConcurrentStreams.
// Must hold cc.mu.
func (cc *ClientConn) awaitOpenSlotForStreamLocked(cs *clientStream) error {
for {
@ -2013,8 +2069,7 @@ type resAndError struct {
func (cc *ClientConn) addStreamLocked(cs *clientStream) {
cs.flow.add(int32(cc.initialWindowSize))
cs.flow.setConnFlow(&cc.flow)
cs.inflow.add(transportDefaultStreamFlow)
cs.inflow.setConnFlow(&cc.inflow)
cs.inflow.init(transportDefaultStreamFlow)
cs.ID = cc.nextStreamID
cc.nextStreamID += 2
cc.streams[cs.ID] = cs
@ -2473,21 +2528,10 @@ func (b transportResponseBody) Read(p []byte) (n int, err error) {
}
cc.mu.Lock()
var connAdd, streamAdd int32
// Check the conn-level first, before the stream-level.
if v := cc.inflow.available(); v < transportDefaultConnFlow/2 {
connAdd = transportDefaultConnFlow - v
cc.inflow.add(connAdd)
}
connAdd := cc.inflow.add(n)
var streamAdd int32
if err == nil { // No need to refresh if the stream is over or failed.
// Consider any buffered body data (read from the conn but not
// consumed by the client) when computing flow control for this
// stream.
v := int(cs.inflow.available()) + cs.bufPipe.Len()
if v < transportDefaultStreamFlow-transportDefaultStreamMinRefresh {
streamAdd = int32(transportDefaultStreamFlow - v)
cs.inflow.add(streamAdd)
}
streamAdd = cs.inflow.add(n)
}
cc.mu.Unlock()
@ -2515,17 +2559,15 @@ func (b transportResponseBody) Close() error {
if unread > 0 {
cc.mu.Lock()
// Return connection-level flow control.
if unread > 0 {
cc.inflow.add(int32(unread))
}
connAdd := cc.inflow.add(unread)
cc.mu.Unlock()
// TODO(dneil): Acquiring this mutex can block indefinitely.
// Move flow control return to a goroutine?
cc.wmu.Lock()
// Return connection-level flow control.
if unread > 0 {
cc.fr.WriteWindowUpdate(0, uint32(unread))
if connAdd > 0 {
cc.fr.WriteWindowUpdate(0, uint32(connAdd))
}
cc.bw.Flush()
cc.wmu.Unlock()
@ -2568,13 +2610,18 @@ func (rl *clientConnReadLoop) processData(f *DataFrame) error {
// But at least return their flow control:
if f.Length > 0 {
cc.mu.Lock()
cc.inflow.add(int32(f.Length))
ok := cc.inflow.take(f.Length)
connAdd := cc.inflow.add(int(f.Length))
cc.mu.Unlock()
cc.wmu.Lock()
cc.fr.WriteWindowUpdate(0, uint32(f.Length))
cc.bw.Flush()
cc.wmu.Unlock()
if !ok {
return ConnectionError(ErrCodeFlowControl)
}
if connAdd > 0 {
cc.wmu.Lock()
cc.fr.WriteWindowUpdate(0, uint32(connAdd))
cc.bw.Flush()
cc.wmu.Unlock()
}
}
return nil
}
@ -2605,9 +2652,7 @@ func (rl *clientConnReadLoop) processData(f *DataFrame) error {
}
// Check connection-level flow control.
cc.mu.Lock()
if cs.inflow.available() >= int32(f.Length) {
cs.inflow.take(int32(f.Length))
} else {
if !takeInflows(&cc.inflow, &cs.inflow, f.Length) {
cc.mu.Unlock()
return ConnectionError(ErrCodeFlowControl)
}
@ -2629,19 +2674,20 @@ func (rl *clientConnReadLoop) processData(f *DataFrame) error {
}
}
if refund > 0 {
cc.inflow.add(int32(refund))
if !didReset {
cs.inflow.add(int32(refund))
}
sendConn := cc.inflow.add(refund)
var sendStream int32
if !didReset {
sendStream = cs.inflow.add(refund)
}
cc.mu.Unlock()
if refund > 0 {
if sendConn > 0 || sendStream > 0 {
cc.wmu.Lock()
cc.fr.WriteWindowUpdate(0, uint32(refund))
if !didReset {
cc.fr.WriteWindowUpdate(cs.ID, uint32(refund))
if sendConn > 0 {
cc.fr.WriteWindowUpdate(0, uint32(sendConn))
}
if sendStream > 0 {
cc.fr.WriteWindowUpdate(cs.ID, uint32(sendStream))
}
cc.bw.Flush()
cc.wmu.Unlock()
@ -2773,8 +2819,10 @@ func (rl *clientConnReadLoop) processSettingsNoWrite(f *SettingsFrame) error {
cc.cond.Broadcast()
cc.initialWindowSize = s.Val
case SettingHeaderTableSize:
cc.henc.SetMaxDynamicTableSize(s.Val)
cc.peerMaxHeaderTableSize = s.Val
default:
// TODO(bradfitz): handle more settings? SETTINGS_HEADER_TABLE_SIZE probably.
cc.vlogf("Unhandled Setting: %v", s)
}
return nil

View File

@ -32,7 +32,7 @@ type histogram struct {
valueCount int64 // number of values recorded for single value
}
// AddMeasurement records a value measurement observation to the histogram.
// addMeasurement records a value measurement observation to the histogram.
func (h *histogram) addMeasurement(value int64) {
// TODO: assert invariant
h.sum += value

View File

@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build gccgo && !aix
// +build gccgo,!aix
//go:build gccgo && !aix && !hurd
// +build gccgo,!aix,!hurd
package unix

View File

@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build gccgo
// +build !aix
//go:build gccgo && !aix && !hurd
// +build gccgo,!aix,!hurd
#include <errno.h>
#include <stdint.h>

View File

@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
//go:build aix || darwin || dragonfly || freebsd || hurd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd hurd linux netbsd openbsd solaris
package unix

View File

@ -174,10 +174,10 @@ openbsd_arm64)
mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
;;
openbsd_mips64)
mkasm="go run mkasm.go"
mkerrors="$mkerrors -m64"
mksyscall="go run mksyscall.go -openbsd"
mksyscall="go run mksyscall.go -openbsd -libc"
mksysctl="go run mksysctl_openbsd.go"
mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'"
# Let the type of C char be signed for making the bare syscall
# API consistent across platforms.
mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"

View File

@ -230,6 +230,7 @@ func direntNamlen(buf []byte) (uint64, bool) {
func PtraceAttach(pid int) (err error) { return ptrace(PT_ATTACH, pid, 0, 0) }
func PtraceDetach(pid int) (err error) { return ptrace(PT_DETACH, pid, 0, 0) }
func PtraceDenyAttach() (err error) { return ptrace(PT_DENY_ATTACH, 0, 0, 0) }
//sysnb pipe(p *[2]int32) (err error)

View File

@ -255,6 +255,7 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
//sys Chmod(path string, mode uint32) (err error)
//sys Chown(path string, uid int, gid int) (err error)
//sys Chroot(path string) (err error)
//sys ClockGettime(clockid int32, time *Timespec) (err error)
//sys Close(fd int) (err error)
//sys Dup(fd int) (nfd int, err error)
//sys Dup2(from int, to int) (err error)

View File

@ -319,6 +319,7 @@ func PtraceSingleStep(pid int) (err error) {
//sys Chmod(path string, mode uint32) (err error)
//sys Chown(path string, uid int, gid int) (err error)
//sys Chroot(path string) (err error)
//sys ClockGettime(clockid int32, time *Timespec) (err error)
//sys Close(fd int) (err error)
//sys Dup(fd int) (nfd int, err error)
//sys Dup2(from int, to int) (err error)

View File

@ -60,8 +60,13 @@ func PtraceGetFsBase(pid int, fsbase *int64) (err error) {
return ptrace(PT_GETFSBASE, pid, uintptr(unsafe.Pointer(fsbase)), 0)
}
func PtraceIO(req int, pid int, addr uintptr, out []byte, countin int) (count int, err error) {
ioDesc := PtraceIoDesc{Op: int32(req), Offs: uintptr(unsafe.Pointer(addr)), Addr: uintptr(unsafe.Pointer(&out[0])), Len: uint32(countin)}
func PtraceIO(req int, pid int, offs uintptr, out []byte, countin int) (count int, err error) {
ioDesc := PtraceIoDesc{
Op: int32(req),
Offs: offs,
Addr: uintptr(unsafe.Pointer(&out[0])), // TODO(#58351): this is not safe.
Len: uint32(countin),
}
err = ptrace(PT_IO, pid, uintptr(unsafe.Pointer(&ioDesc)), 0)
return int(ioDesc.Len), err
}

View File

@ -60,8 +60,13 @@ func PtraceGetFsBase(pid int, fsbase *int64) (err error) {
return ptrace(PT_GETFSBASE, pid, uintptr(unsafe.Pointer(fsbase)), 0)
}
func PtraceIO(req int, pid int, addr uintptr, out []byte, countin int) (count int, err error) {
ioDesc := PtraceIoDesc{Op: int32(req), Offs: uintptr(unsafe.Pointer(addr)), Addr: uintptr(unsafe.Pointer(&out[0])), Len: uint64(countin)}
func PtraceIO(req int, pid int, offs uintptr, out []byte, countin int) (count int, err error) {
ioDesc := PtraceIoDesc{
Op: int32(req),
Offs: offs,
Addr: uintptr(unsafe.Pointer(&out[0])), // TODO(#58351): this is not safe.
Len: uint64(countin),
}
err = ptrace(PT_IO, pid, uintptr(unsafe.Pointer(&ioDesc)), 0)
return int(ioDesc.Len), err
}

View File

@ -56,8 +56,13 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
func PtraceIO(req int, pid int, addr uintptr, out []byte, countin int) (count int, err error) {
ioDesc := PtraceIoDesc{Op: int32(req), Offs: uintptr(unsafe.Pointer(addr)), Addr: uintptr(unsafe.Pointer(&out[0])), Len: uint32(countin)}
func PtraceIO(req int, pid int, offs uintptr, out []byte, countin int) (count int, err error) {
ioDesc := PtraceIoDesc{
Op: int32(req),
Offs: offs,
Addr: uintptr(unsafe.Pointer(&out[0])), // TODO(#58351): this is not safe.
Len: uint32(countin),
}
err = ptrace(PT_IO, pid, uintptr(unsafe.Pointer(&ioDesc)), 0)
return int(ioDesc.Len), err
}

View File

@ -56,8 +56,13 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
func PtraceIO(req int, pid int, addr uintptr, out []byte, countin int) (count int, err error) {
ioDesc := PtraceIoDesc{Op: int32(req), Offs: uintptr(unsafe.Pointer(addr)), Addr: uintptr(unsafe.Pointer(&out[0])), Len: uint64(countin)}
func PtraceIO(req int, pid int, offs uintptr, out []byte, countin int) (count int, err error) {
ioDesc := PtraceIoDesc{
Op: int32(req),
Offs: offs,
Addr: uintptr(unsafe.Pointer(&out[0])), // TODO(#58351): this is not safe.
Len: uint64(countin),
}
err = ptrace(PT_IO, pid, uintptr(unsafe.Pointer(&ioDesc)), 0)
return int(ioDesc.Len), err
}

View File

@ -56,8 +56,13 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
func PtraceIO(req int, pid int, addr uintptr, out []byte, countin int) (count int, err error) {
ioDesc := PtraceIoDesc{Op: int32(req), Offs: uintptr(unsafe.Pointer(addr)), Addr: uintptr(unsafe.Pointer(&out[0])), Len: uint64(countin)}
func PtraceIO(req int, pid int, offs uintptr, out []byte, countin int) (count int, err error) {
ioDesc := PtraceIoDesc{
Op: int32(req),
Offs: offs,
Addr: uintptr(unsafe.Pointer(&out[0])), // TODO(#58351): this is not safe.
Len: uint64(countin),
}
err = ptrace(PT_IO, pid, uintptr(unsafe.Pointer(&ioDesc)), 0)
return int(ioDesc.Len), err
}

22
src/vendor/golang.org/x/sys/unix/syscall_hurd.go generated vendored Normal file
View File

@ -0,0 +1,22 @@
// Copyright 2022 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build hurd
// +build hurd
package unix
/*
#include <stdint.h>
int ioctl(int, unsigned long int, uintptr_t);
*/
import "C"
func ioctl(fd int, req uint, arg uintptr) (err error) {
r0, er := C.ioctl(C.int(fd), C.ulong(req), C.uintptr_t(arg))
if r0 == -1 && er != nil {
err = er
}
return
}

29
src/vendor/golang.org/x/sys/unix/syscall_hurd_386.go generated vendored Normal file
View File

@ -0,0 +1,29 @@
// Copyright 2022 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build 386 && hurd
// +build 386,hurd
package unix
const (
TIOCGETA = 0x62251713
)
type Winsize struct {
Row uint16
Col uint16
Xpixel uint16
Ypixel uint16
}
type Termios struct {
Iflag uint32
Oflag uint32
Cflag uint32
Lflag uint32
Cc [20]uint8
Ispeed int32
Ospeed int32
}

View File

@ -1800,6 +1800,7 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
//sysnb Capset(hdr *CapUserHeader, data *CapUserData) (err error)
//sys Chdir(path string) (err error)
//sys Chroot(path string) (err error)
//sys ClockAdjtime(clockid int32, buf *Timex) (state int, err error)
//sys ClockGetres(clockid int32, res *Timespec) (err error)
//sys ClockGettime(clockid int32, time *Timespec) (err error)
//sys ClockNanosleep(clockid int32, flags int, request *Timespec, remain *Timespec) (err error)
@ -1973,36 +1974,46 @@ func Signalfd(fd int, sigmask *Sigset_t, flags int) (newfd int, err error) {
//sys preadv2(fd int, iovs []Iovec, offs_l uintptr, offs_h uintptr, flags int) (n int, err error) = SYS_PREADV2
//sys pwritev2(fd int, iovs []Iovec, offs_l uintptr, offs_h uintptr, flags int) (n int, err error) = SYS_PWRITEV2
func bytes2iovec(bs [][]byte) []Iovec {
iovecs := make([]Iovec, len(bs))
for i, b := range bs {
iovecs[i].SetLen(len(b))
// minIovec is the size of the small initial allocation used by
// Readv, Writev, etc.
//
// This small allocation gets stack allocated, which lets the
// common use case of len(iovs) <= minIovs avoid more expensive
// heap allocations.
const minIovec = 8
// appendBytes converts bs to Iovecs and appends them to vecs.
func appendBytes(vecs []Iovec, bs [][]byte) []Iovec {
for _, b := range bs {
var v Iovec
v.SetLen(len(b))
if len(b) > 0 {
iovecs[i].Base = &b[0]
v.Base = &b[0]
} else {
iovecs[i].Base = (*byte)(unsafe.Pointer(&_zero))
v.Base = (*byte)(unsafe.Pointer(&_zero))
}
vecs = append(vecs, v)
}
return iovecs
return vecs
}
// offs2lohi splits offs into its lower and upper unsigned long. On 64-bit
// systems, hi will always be 0. On 32-bit systems, offs will be split in half.
// preadv/pwritev chose this calling convention so they don't need to add a
// padding-register for alignment on ARM.
// offs2lohi splits offs into its low and high order bits.
func offs2lohi(offs int64) (lo, hi uintptr) {
return uintptr(offs), uintptr(uint64(offs) >> SizeofLong)
const longBits = SizeofLong * 8
return uintptr(offs), uintptr(uint64(offs) >> (longBits - 1) >> 1) // two shifts to avoid false positive in vet
}
func Readv(fd int, iovs [][]byte) (n int, err error) {
iovecs := bytes2iovec(iovs)
iovecs := make([]Iovec, 0, minIovec)
iovecs = appendBytes(iovecs, iovs)
n, err = readv(fd, iovecs)
readvRacedetect(iovecs, n, err)
return n, err
}
func Preadv(fd int, iovs [][]byte, offset int64) (n int, err error) {
iovecs := bytes2iovec(iovs)
iovecs := make([]Iovec, 0, minIovec)
iovecs = appendBytes(iovecs, iovs)
lo, hi := offs2lohi(offset)
n, err = preadv(fd, iovecs, lo, hi)
readvRacedetect(iovecs, n, err)
@ -2010,7 +2021,8 @@ func Preadv(fd int, iovs [][]byte, offset int64) (n int, err error) {
}
func Preadv2(fd int, iovs [][]byte, offset int64, flags int) (n int, err error) {
iovecs := bytes2iovec(iovs)
iovecs := make([]Iovec, 0, minIovec)
iovecs = appendBytes(iovecs, iovs)
lo, hi := offs2lohi(offset)
n, err = preadv2(fd, iovecs, lo, hi, flags)
readvRacedetect(iovecs, n, err)
@ -2037,7 +2049,8 @@ func readvRacedetect(iovecs []Iovec, n int, err error) {
}
func Writev(fd int, iovs [][]byte) (n int, err error) {
iovecs := bytes2iovec(iovs)
iovecs := make([]Iovec, 0, minIovec)
iovecs = appendBytes(iovecs, iovs)
if raceenabled {
raceReleaseMerge(unsafe.Pointer(&ioSync))
}
@ -2047,7 +2060,8 @@ func Writev(fd int, iovs [][]byte) (n int, err error) {
}
func Pwritev(fd int, iovs [][]byte, offset int64) (n int, err error) {
iovecs := bytes2iovec(iovs)
iovecs := make([]Iovec, 0, minIovec)
iovecs = appendBytes(iovecs, iovs)
if raceenabled {
raceReleaseMerge(unsafe.Pointer(&ioSync))
}
@ -2058,7 +2072,8 @@ func Pwritev(fd int, iovs [][]byte, offset int64) (n int, err error) {
}
func Pwritev2(fd int, iovs [][]byte, offset int64, flags int) (n int, err error) {
iovecs := bytes2iovec(iovs)
iovecs := make([]Iovec, 0, minIovec)
iovecs = appendBytes(iovecs, iovs)
if raceenabled {
raceReleaseMerge(unsafe.Pointer(&ioSync))
}

View File

@ -110,6 +110,20 @@ func direntNamlen(buf []byte) (uint64, bool) {
return readInt(buf, unsafe.Offsetof(Dirent{}.Namlen), unsafe.Sizeof(Dirent{}.Namlen))
}
func SysctlUvmexp(name string) (*Uvmexp, error) {
mib, err := sysctlmib(name)
if err != nil {
return nil, err
}
n := uintptr(SizeofUvmexp)
var u Uvmexp
if err := sysctl(mib, (*byte)(unsafe.Pointer(&u)), &n, nil, 0); err != nil {
return nil, err
}
return &u, nil
}
func Pipe(p []int) (err error) {
return Pipe2(p, 0)
}
@ -245,6 +259,7 @@ func Statvfs(path string, buf *Statvfs_t) (err error) {
//sys Chmod(path string, mode uint32) (err error)
//sys Chown(path string, uid int, gid int) (err error)
//sys Chroot(path string) (err error)
//sys ClockGettime(clockid int32, time *Timespec) (err error)
//sys Close(fd int) (err error)
//sys Dup(fd int) (nfd int, err error)
//sys Dup2(from int, to int) (err error)

View File

@ -220,6 +220,7 @@ func Uname(uname *Utsname) error {
//sys Chmod(path string, mode uint32) (err error)
//sys Chown(path string, uid int, gid int) (err error)
//sys Chroot(path string) (err error)
//sys ClockGettime(clockid int32, time *Timespec) (err error)
//sys Close(fd int) (err error)
//sys Dup(fd int) (nfd int, err error)
//sys Dup2(from int, to int) (err error)

View File

@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build openbsd && !mips64
// +build openbsd,!mips64
//go:build openbsd
// +build openbsd
package unix

View File

@ -590,6 +590,7 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
//sys Chmod(path string, mode uint32) (err error)
//sys Chown(path string, uid int, gid int) (err error)
//sys Chroot(path string) (err error)
//sys ClockGettime(clockid int32, time *Timespec) (err error)
//sys Close(fd int) (err error)
//sys Creat(path string, mode uint32) (fd int, err error)
//sys Dup(fd int) (nfd int, err error)

View File

@ -331,6 +331,19 @@ func Recvfrom(fd int, p []byte, flags int) (n int, from Sockaddr, err error) {
return
}
// Recvmsg receives a message from a socket using the recvmsg system call. The
// received non-control data will be written to p, and any "out of band"
// control data will be written to oob. The flags are passed to recvmsg.
//
// The results are:
// - n is the number of non-control data bytes read into p
// - oobn is the number of control data bytes read into oob; this may be interpreted using [ParseSocketControlMessage]
// - recvflags is flags returned by recvmsg
// - from is the address of the sender
//
// If the underlying socket type is not SOCK_DGRAM, a received message
// containing oob data and a single '\0' of non-control data is treated as if
// the message contained only control data, i.e. n will be zero on return.
func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from Sockaddr, err error) {
var iov [1]Iovec
if len(p) > 0 {
@ -346,13 +359,9 @@ func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from
return
}
// RecvmsgBuffers receives a message from a socket using the recvmsg
// system call. The flags are passed to recvmsg. Any non-control data
// read is scattered into the buffers slices. The results are:
// - n is the number of non-control data read into bufs
// - oobn is the number of control data read into oob; this may be interpreted using [ParseSocketControlMessage]
// - recvflags is flags returned by recvmsg
// - from is the address of the sender
// RecvmsgBuffers receives a message from a socket using the recvmsg system
// call. This function is equivalent to Recvmsg, but non-control data read is
// scattered into the buffers slices.
func RecvmsgBuffers(fd int, buffers [][]byte, oob []byte, flags int) (n, oobn int, recvflags int, from Sockaddr, err error) {
iov := make([]Iovec, len(buffers))
for i := range buffers {
@ -371,11 +380,38 @@ func RecvmsgBuffers(fd int, buffers [][]byte, oob []byte, flags int) (n, oobn in
return
}
// Sendmsg sends a message on a socket to an address using the sendmsg system
// call. This function is equivalent to SendmsgN, but does not return the
// number of bytes actually sent.
func Sendmsg(fd int, p, oob []byte, to Sockaddr, flags int) (err error) {
_, err = SendmsgN(fd, p, oob, to, flags)
return
}
// SendmsgN sends a message on a socket to an address using the sendmsg system
// call. p contains the non-control data to send, and oob contains the "out of
// band" control data. The flags are passed to sendmsg. The number of
// non-control bytes actually written to the socket is returned.
//
// Some socket types do not support sending control data without accompanying
// non-control data. If p is empty, and oob contains control data, and the
// underlying socket type is not SOCK_DGRAM, p will be treated as containing a
// single '\0' and the return value will indicate zero bytes sent.
//
// The Go function Recvmsg, if called with an empty p and a non-empty oob,
// will read and ignore this additional '\0'. If the message is received by
// code that does not use Recvmsg, or that does not use Go at all, that code
// will need to be written to expect and ignore the additional '\0'.
//
// If you need to send non-empty oob with p actually empty, and if the
// underlying socket type supports it, you can do so via a raw system call as
// follows:
//
// msg := &unix.Msghdr{
// Control: &oob[0],
// }
// msg.SetControllen(len(oob))
// n, _, errno := unix.Syscall(unix.SYS_SENDMSG, uintptr(fd), uintptr(unsafe.Pointer(msg)), flags)
func SendmsgN(fd int, p, oob []byte, to Sockaddr, flags int) (n int, err error) {
var iov [1]Iovec
if len(p) > 0 {
@ -394,9 +430,8 @@ func SendmsgN(fd int, p, oob []byte, to Sockaddr, flags int) (n int, err error)
}
// SendmsgBuffers sends a message on a socket to an address using the sendmsg
// system call. The flags are passed to sendmsg. Any non-control data written
// is gathered from buffers. The function returns the number of bytes written
// to the socket.
// system call. This function is equivalent to SendmsgN, but the non-control
// data is gathered from buffers.
func SendmsgBuffers(fd int, buffers [][]byte, oob []byte, to Sockaddr, flags int) (n int, err error) {
iov := make([]Iovec, len(buffers))
for i := range buffers {
@ -543,7 +578,7 @@ func Lutimes(path string, tv []Timeval) error {
return UtimesNanoAt(AT_FDCWD, path, ts, AT_SYMLINK_NOFOLLOW)
}
// emptyIovec reports whether there are no bytes in the slice of Iovec.
// emptyIovecs reports whether there are no bytes in the slice of Iovec.
func emptyIovecs(iov []Iovec) bool {
for i := range iov {
if iov[i].Len > 0 {

View File

@ -9,7 +9,7 @@ package unix
import "time"
// TimespecToNSec returns the time stored in ts as nanoseconds.
// TimespecToNsec returns the time stored in ts as nanoseconds.
func TimespecToNsec(ts Timespec) int64 { return ts.Nano() }
// NsecToTimespec converts a number of nanoseconds into a Timespec.

View File

@ -36,9 +36,14 @@ func xattrnamespace(fullattr string) (ns int, attr string, err error) {
func initxattrdest(dest []byte, idx int) (d unsafe.Pointer) {
if len(dest) > idx {
return unsafe.Pointer(&dest[idx])
} else {
return unsafe.Pointer(_zero)
}
if dest != nil {
// extattr_get_file and extattr_list_file treat NULL differently from
// a non-NULL pointer of length zero. Preserve the property of nilness,
// even if we can't use dest directly.
return unsafe.Pointer(&_zero)
}
return nil
}
// FreeBSD and NetBSD implement their own syscalls to handle extended attributes

View File

@ -457,7 +457,6 @@ const (
B600 = 0x8
B75 = 0x2
B9600 = 0xd
BALLOON_KVM_MAGIC = 0x13661366
BDEVFS_MAGIC = 0x62646576
BINDERFS_SUPER_MAGIC = 0x6c6f6f70
BINFMTFS_MAGIC = 0x42494e4d
@ -563,6 +562,7 @@ const (
BUS_USB = 0x3
BUS_VIRTUAL = 0x6
CAN_BCM = 0x2
CAN_BUS_OFF_THRESHOLD = 0x100
CAN_CTRLMODE_3_SAMPLES = 0x4
CAN_CTRLMODE_BERR_REPORTING = 0x10
CAN_CTRLMODE_CC_LEN8_DLC = 0x100
@ -577,9 +577,12 @@ const (
CAN_EFF_FLAG = 0x80000000
CAN_EFF_ID_BITS = 0x1d
CAN_EFF_MASK = 0x1fffffff
CAN_ERROR_PASSIVE_THRESHOLD = 0x80
CAN_ERROR_WARNING_THRESHOLD = 0x60
CAN_ERR_ACK = 0x20
CAN_ERR_BUSERROR = 0x80
CAN_ERR_BUSOFF = 0x40
CAN_ERR_CNT = 0x200
CAN_ERR_CRTL = 0x4
CAN_ERR_CRTL_ACTIVE = 0x40
CAN_ERR_CRTL_RX_OVERFLOW = 0x1
@ -820,9 +823,9 @@ const (
DM_UUID_FLAG = 0x4000
DM_UUID_LEN = 0x81
DM_VERSION = 0xc138fd00
DM_VERSION_EXTRA = "-ioctl (2022-02-22)"
DM_VERSION_EXTRA = "-ioctl (2022-07-28)"
DM_VERSION_MAJOR = 0x4
DM_VERSION_MINOR = 0x2e
DM_VERSION_MINOR = 0x2f
DM_VERSION_PATCHLEVEL = 0x0
DT_BLK = 0x6
DT_CHR = 0x2
@ -1049,6 +1052,7 @@ const (
ETH_P_CAIF = 0xf7
ETH_P_CAN = 0xc
ETH_P_CANFD = 0xd
ETH_P_CANXL = 0xe
ETH_P_CFM = 0x8902
ETH_P_CONTROL = 0x16
ETH_P_CUST = 0x6006
@ -1060,6 +1064,7 @@ const (
ETH_P_DNA_RT = 0x6003
ETH_P_DSA = 0x1b
ETH_P_DSA_8021Q = 0xdadb
ETH_P_DSA_A5PSW = 0xe001
ETH_P_ECONET = 0x18
ETH_P_EDSA = 0xdada
ETH_P_ERSPAN = 0x88be
@ -1194,8 +1199,10 @@ const (
FAN_MARK_EVICTABLE = 0x200
FAN_MARK_FILESYSTEM = 0x100
FAN_MARK_FLUSH = 0x80
FAN_MARK_IGNORE = 0x400
FAN_MARK_IGNORED_MASK = 0x20
FAN_MARK_IGNORED_SURV_MODIFY = 0x40
FAN_MARK_IGNORE_SURV = 0x440
FAN_MARK_INODE = 0x0
FAN_MARK_MOUNT = 0x10
FAN_MARK_ONLYDIR = 0x8
@ -1253,6 +1260,7 @@ const (
FSCRYPT_MODE_AES_128_CBC = 0x5
FSCRYPT_MODE_AES_128_CTS = 0x6
FSCRYPT_MODE_AES_256_CTS = 0x4
FSCRYPT_MODE_AES_256_HCTR2 = 0xa
FSCRYPT_MODE_AES_256_XTS = 0x1
FSCRYPT_POLICY_FLAGS_PAD_16 = 0x2
FSCRYPT_POLICY_FLAGS_PAD_32 = 0x3
@ -1430,6 +1438,7 @@ const (
IFF_NOARP = 0x80
IFF_NOFILTER = 0x1000
IFF_NOTRAILERS = 0x20
IFF_NO_CARRIER = 0x40
IFF_NO_PI = 0x1000
IFF_ONE_QUEUE = 0x2000
IFF_PERSIST = 0x800
@ -1805,6 +1814,7 @@ const (
MADV_DONTDUMP = 0x10
MADV_DONTFORK = 0xa
MADV_DONTNEED = 0x4
MADV_DONTNEED_LOCKED = 0x18
MADV_FREE = 0x8
MADV_HUGEPAGE = 0xe
MADV_HWPOISON = 0x64
@ -1846,7 +1856,7 @@ const (
MFD_ALLOW_SEALING = 0x2
MFD_CLOEXEC = 0x1
MFD_HUGETLB = 0x4
MFD_HUGE_16GB = -0x78000000
MFD_HUGE_16GB = 0x88000000
MFD_HUGE_16MB = 0x60000000
MFD_HUGE_1GB = 0x78000000
MFD_HUGE_1MB = 0x50000000
@ -2212,6 +2222,11 @@ const (
PERF_AUX_FLAG_PARTIAL = 0x4
PERF_AUX_FLAG_PMU_FORMAT_TYPE_MASK = 0xff00
PERF_AUX_FLAG_TRUNCATED = 0x1
PERF_BR_ARM64_DEBUG_DATA = 0x7
PERF_BR_ARM64_DEBUG_EXIT = 0x5
PERF_BR_ARM64_DEBUG_HALT = 0x4
PERF_BR_ARM64_DEBUG_INST = 0x6
PERF_BR_ARM64_FIQ = 0x3
PERF_FLAG_FD_CLOEXEC = 0x8
PERF_FLAG_FD_NO_GROUP = 0x1
PERF_FLAG_FD_OUTPUT = 0x2
@ -2232,6 +2247,8 @@ const (
PERF_MEM_LOCK_NA = 0x1
PERF_MEM_LOCK_SHIFT = 0x18
PERF_MEM_LVLNUM_ANY_CACHE = 0xb
PERF_MEM_LVLNUM_CXL = 0x9
PERF_MEM_LVLNUM_IO = 0xa
PERF_MEM_LVLNUM_L1 = 0x1
PERF_MEM_LVLNUM_L2 = 0x2
PERF_MEM_LVLNUM_L3 = 0x3
@ -2265,6 +2282,7 @@ const (
PERF_MEM_REMOTE_REMOTE = 0x1
PERF_MEM_REMOTE_SHIFT = 0x25
PERF_MEM_SNOOPX_FWD = 0x1
PERF_MEM_SNOOPX_PEER = 0x2
PERF_MEM_SNOOPX_SHIFT = 0x26
PERF_MEM_SNOOP_HIT = 0x4
PERF_MEM_SNOOP_HITM = 0x10
@ -2301,7 +2319,6 @@ const (
PERF_SAMPLE_BRANCH_PLM_ALL = 0x7
PERF_SAMPLE_WEIGHT_TYPE = 0x1004000
PIPEFS_MAGIC = 0x50495045
PPC_CMM_MAGIC = 0xc7571590
PPPIOCGNPMODE = 0xc008744c
PPPIOCNEWUNIT = 0xc004743e
PRIO_PGRP = 0x1
@ -2999,6 +3016,7 @@ const (
STATX_BLOCKS = 0x400
STATX_BTIME = 0x800
STATX_CTIME = 0x80
STATX_DIOALIGN = 0x2000
STATX_GID = 0x10
STATX_INO = 0x100
STATX_MNT_ID = 0x1000
@ -3392,9 +3410,7 @@ const (
XDP_ZEROCOPY = 0x4
XENFS_SUPER_MAGIC = 0xabba1974
XFS_SUPER_MAGIC = 0x58465342
Z3FOLD_MAGIC = 0x33
ZONEFS_MAGIC = 0x5a4f4653
ZSMALLOC_MAGIC = 0x58295829
_HIDIOCGRAWNAME_LEN = 0x80
_HIDIOCGRAWPHYS_LEN = 0x40
_HIDIOCGRAWUNIQ_LEN = 0x40

View File

@ -133,6 +133,7 @@ const (
MEMGETREGIONCOUNT = 0x80044d07
MEMISLOCKED = 0x80084d17
MEMLOCK = 0x40084d05
MEMREAD = 0xc03c4d1a
MEMREADOOB = 0xc00c4d04
MEMSETBADBLOCK = 0x40084d0c
MEMUNLOCK = 0x40084d06

View File

@ -133,6 +133,7 @@ const (
MEMGETREGIONCOUNT = 0x80044d07
MEMISLOCKED = 0x80084d17
MEMLOCK = 0x40084d05
MEMREAD = 0xc0404d1a
MEMREADOOB = 0xc0104d04
MEMSETBADBLOCK = 0x40084d0c
MEMUNLOCK = 0x40084d06

View File

@ -131,6 +131,7 @@ const (
MEMGETREGIONCOUNT = 0x80044d07
MEMISLOCKED = 0x80084d17
MEMLOCK = 0x40084d05
MEMREAD = 0xc0404d1a
MEMREADOOB = 0xc00c4d04
MEMSETBADBLOCK = 0x40084d0c
MEMUNLOCK = 0x40084d06

View File

@ -134,6 +134,7 @@ const (
MEMGETREGIONCOUNT = 0x80044d07
MEMISLOCKED = 0x80084d17
MEMLOCK = 0x40084d05
MEMREAD = 0xc0404d1a
MEMREADOOB = 0xc0104d04
MEMSETBADBLOCK = 0x40084d0c
MEMUNLOCK = 0x40084d06

View File

@ -132,6 +132,7 @@ const (
MEMGETREGIONCOUNT = 0x80044d07
MEMISLOCKED = 0x80084d17
MEMLOCK = 0x40084d05
MEMREAD = 0xc0404d1a
MEMREADOOB = 0xc0104d04
MEMSETBADBLOCK = 0x40084d0c
MEMUNLOCK = 0x40084d06

View File

@ -131,6 +131,7 @@ const (
MEMGETREGIONCOUNT = 0x40044d07
MEMISLOCKED = 0x40084d17
MEMLOCK = 0x80084d05
MEMREAD = 0xc0404d1a
MEMREADOOB = 0xc00c4d04
MEMSETBADBLOCK = 0x80084d0c
MEMUNLOCK = 0x80084d06

View File

@ -131,6 +131,7 @@ const (
MEMGETREGIONCOUNT = 0x40044d07
MEMISLOCKED = 0x40084d17
MEMLOCK = 0x80084d05
MEMREAD = 0xc0404d1a
MEMREADOOB = 0xc0104d04
MEMSETBADBLOCK = 0x80084d0c
MEMUNLOCK = 0x80084d06

View File

@ -131,6 +131,7 @@ const (
MEMGETREGIONCOUNT = 0x40044d07
MEMISLOCKED = 0x40084d17
MEMLOCK = 0x80084d05
MEMREAD = 0xc0404d1a
MEMREADOOB = 0xc0104d04
MEMSETBADBLOCK = 0x80084d0c
MEMUNLOCK = 0x80084d06

View File

@ -131,6 +131,7 @@ const (
MEMGETREGIONCOUNT = 0x40044d07
MEMISLOCKED = 0x40084d17
MEMLOCK = 0x80084d05
MEMREAD = 0xc0404d1a
MEMREADOOB = 0xc00c4d04
MEMSETBADBLOCK = 0x80084d0c
MEMUNLOCK = 0x80084d06

View File

@ -131,6 +131,7 @@ const (
MEMGETREGIONCOUNT = 0x40044d07
MEMISLOCKED = 0x40084d17
MEMLOCK = 0x80084d05
MEMREAD = 0xc0404d1a
MEMREADOOB = 0xc00c4d04
MEMSETBADBLOCK = 0x80084d0c
MEMUNLOCK = 0x80084d06

View File

@ -131,6 +131,7 @@ const (
MEMGETREGIONCOUNT = 0x40044d07
MEMISLOCKED = 0x40084d17
MEMLOCK = 0x80084d05
MEMREAD = 0xc0404d1a
MEMREADOOB = 0xc0104d04
MEMSETBADBLOCK = 0x80084d0c
MEMUNLOCK = 0x80084d06

View File

@ -131,6 +131,7 @@ const (
MEMGETREGIONCOUNT = 0x40044d07
MEMISLOCKED = 0x40084d17
MEMLOCK = 0x80084d05
MEMREAD = 0xc0404d1a
MEMREADOOB = 0xc0104d04
MEMSETBADBLOCK = 0x80084d0c
MEMUNLOCK = 0x80084d06

View File

@ -131,6 +131,7 @@ const (
MEMGETREGIONCOUNT = 0x80044d07
MEMISLOCKED = 0x80084d17
MEMLOCK = 0x40084d05
MEMREAD = 0xc0404d1a
MEMREADOOB = 0xc0104d04
MEMSETBADBLOCK = 0x40084d0c
MEMUNLOCK = 0x40084d06

View File

@ -131,6 +131,7 @@ const (
MEMGETREGIONCOUNT = 0x80044d07
MEMISLOCKED = 0x80084d17
MEMLOCK = 0x40084d05
MEMREAD = 0xc0404d1a
MEMREADOOB = 0xc0104d04
MEMSETBADBLOCK = 0x40084d0c
MEMUNLOCK = 0x40084d06

View File

@ -136,6 +136,7 @@ const (
MEMGETREGIONCOUNT = 0x40044d07
MEMISLOCKED = 0x40084d17
MEMLOCK = 0x80084d05
MEMREAD = 0xc0404d1a
MEMREADOOB = 0xc0104d04
MEMSETBADBLOCK = 0x80084d0c
MEMUNLOCK = 0x80084d06

View File

@ -46,6 +46,7 @@ const (
AF_SNA = 0xb
AF_UNIX = 0x1
AF_UNSPEC = 0x0
ALTWERASE = 0x200
ARPHRD_ETHER = 0x1
ARPHRD_FRELAY = 0xf
ARPHRD_IEEE1394 = 0x18
@ -108,6 +109,15 @@ const (
BPF_DIRECTION_IN = 0x1
BPF_DIRECTION_OUT = 0x2
BPF_DIV = 0x30
BPF_FILDROP_CAPTURE = 0x1
BPF_FILDROP_DROP = 0x2
BPF_FILDROP_PASS = 0x0
BPF_F_DIR_IN = 0x10
BPF_F_DIR_MASK = 0x30
BPF_F_DIR_OUT = 0x20
BPF_F_DIR_SHIFT = 0x4
BPF_F_FLOWID = 0x8
BPF_F_PRI_MASK = 0x7
BPF_H = 0x8
BPF_IMM = 0x0
BPF_IND = 0x40
@ -136,6 +146,7 @@ const (
BPF_OR = 0x40
BPF_RELEASE = 0x30bb6
BPF_RET = 0x6
BPF_RND = 0xc0
BPF_RSH = 0x70
BPF_ST = 0x2
BPF_STX = 0x3
@ -147,6 +158,12 @@ const (
BRKINT = 0x2
CFLUSH = 0xf
CLOCAL = 0x8000
CLOCK_BOOTTIME = 0x6
CLOCK_MONOTONIC = 0x3
CLOCK_PROCESS_CPUTIME_ID = 0x2
CLOCK_REALTIME = 0x0
CLOCK_THREAD_CPUTIME_ID = 0x4
CLOCK_UPTIME = 0x5
CPUSTATES = 0x6
CP_IDLE = 0x5
CP_INTR = 0x4
@ -170,7 +187,65 @@ const (
CTL_KERN = 0x1
CTL_MAXNAME = 0xc
CTL_NET = 0x4
DIOCADDQUEUE = 0xc100445d
DIOCADDRULE = 0xccc84404
DIOCADDSTATE = 0xc1084425
DIOCCHANGERULE = 0xccc8441a
DIOCCLRIFFLAG = 0xc024445a
DIOCCLRSRCNODES = 0x20004455
DIOCCLRSTATES = 0xc0d04412
DIOCCLRSTATUS = 0xc0244416
DIOCGETLIMIT = 0xc0084427
DIOCGETQSTATS = 0xc1084460
DIOCGETQUEUE = 0xc100445f
DIOCGETQUEUES = 0xc100445e
DIOCGETRULE = 0xccc84407
DIOCGETRULES = 0xccc84406
DIOCGETRULESET = 0xc444443b
DIOCGETRULESETS = 0xc444443a
DIOCGETSRCNODES = 0xc0084454
DIOCGETSTATE = 0xc1084413
DIOCGETSTATES = 0xc0084419
DIOCGETSTATUS = 0xc1e84415
DIOCGETSYNFLWATS = 0xc0084463
DIOCGETTIMEOUT = 0xc008441e
DIOCIGETIFACES = 0xc0244457
DIOCKILLSRCNODES = 0xc068445b
DIOCKILLSTATES = 0xc0d04429
DIOCNATLOOK = 0xc0504417
DIOCOSFPADD = 0xc084444f
DIOCOSFPFLUSH = 0x2000444e
DIOCOSFPGET = 0xc0844450
DIOCRADDADDRS = 0xc44c4443
DIOCRADDTABLES = 0xc44c443d
DIOCRCLRADDRS = 0xc44c4442
DIOCRCLRASTATS = 0xc44c4448
DIOCRCLRTABLES = 0xc44c443c
DIOCRCLRTSTATS = 0xc44c4441
DIOCRDELADDRS = 0xc44c4444
DIOCRDELTABLES = 0xc44c443e
DIOCRGETADDRS = 0xc44c4446
DIOCRGETASTATS = 0xc44c4447
DIOCRGETTABLES = 0xc44c443f
DIOCRGETTSTATS = 0xc44c4440
DIOCRINADEFINE = 0xc44c444d
DIOCRSETADDRS = 0xc44c4445
DIOCRSETTFLAGS = 0xc44c444a
DIOCRTSTADDRS = 0xc44c4449
DIOCSETDEBUG = 0xc0044418
DIOCSETHOSTID = 0xc0044456
DIOCSETIFFLAG = 0xc0244459
DIOCSETLIMIT = 0xc0084428
DIOCSETREASS = 0xc004445c
DIOCSETSTATUSIF = 0xc0244414
DIOCSETSYNCOOKIES = 0xc0014462
DIOCSETSYNFLWATS = 0xc0084461
DIOCSETTIMEOUT = 0xc008441d
DIOCSTART = 0x20004401
DIOCSTOP = 0x20004402
DIOCXBEGIN = 0xc00c4451
DIOCXCOMMIT = 0xc00c4452
DIOCXROLLBACK = 0xc00c4453
DLT_ARCNET = 0x7
DLT_ATM_RFC1483 = 0xb
DLT_AX25 = 0x3
@ -186,6 +261,7 @@ const (
DLT_LOOP = 0xc
DLT_MPLS = 0xdb
DLT_NULL = 0x0
DLT_OPENFLOW = 0x10b
DLT_PFLOG = 0x75
DLT_PFSYNC = 0x12
DLT_PPP = 0x9
@ -196,6 +272,23 @@ const (
DLT_RAW = 0xe
DLT_SLIP = 0x8
DLT_SLIP_BSDOS = 0xf
DLT_USBPCAP = 0xf9
DLT_USER0 = 0x93
DLT_USER1 = 0x94
DLT_USER10 = 0x9d
DLT_USER11 = 0x9e
DLT_USER12 = 0x9f
DLT_USER13 = 0xa0
DLT_USER14 = 0xa1
DLT_USER15 = 0xa2
DLT_USER2 = 0x95
DLT_USER3 = 0x96
DLT_USER4 = 0x97
DLT_USER5 = 0x98
DLT_USER6 = 0x99
DLT_USER7 = 0x9a
DLT_USER8 = 0x9b
DLT_USER9 = 0x9c
DT_BLK = 0x6
DT_CHR = 0x2
DT_DIR = 0x4
@ -215,6 +308,8 @@ const (
EMUL_ENABLED = 0x1
EMUL_NATIVE = 0x2
ENDRUNDISC = 0x9
ETH64_8021_RSVD_MASK = 0xfffffffffff0
ETH64_8021_RSVD_PREFIX = 0x180c2000000
ETHERMIN = 0x2e
ETHERMTU = 0x5dc
ETHERTYPE_8023 = 0x4
@ -267,6 +362,7 @@ const (
ETHERTYPE_DN = 0x6003
ETHERTYPE_DOGFIGHT = 0x1989
ETHERTYPE_DSMD = 0x8039
ETHERTYPE_EAPOL = 0x888e
ETHERTYPE_ECMA = 0x803
ETHERTYPE_ENCRYPT = 0x803d
ETHERTYPE_ES = 0x805d
@ -298,6 +394,7 @@ const (
ETHERTYPE_LLDP = 0x88cc
ETHERTYPE_LOGICRAFT = 0x8148
ETHERTYPE_LOOPBACK = 0x9000
ETHERTYPE_MACSEC = 0x88e5
ETHERTYPE_MATRA = 0x807a
ETHERTYPE_MAX = 0xffff
ETHERTYPE_MERIT = 0x807c
@ -326,15 +423,17 @@ const (
ETHERTYPE_NCD = 0x8149
ETHERTYPE_NESTAR = 0x8006
ETHERTYPE_NETBEUI = 0x8191
ETHERTYPE_NHRP = 0x2001
ETHERTYPE_NOVELL = 0x8138
ETHERTYPE_NS = 0x600
ETHERTYPE_NSAT = 0x601
ETHERTYPE_NSCOMPAT = 0x807
ETHERTYPE_NSH = 0x984f
ETHERTYPE_NTRAILER = 0x10
ETHERTYPE_OS9 = 0x7007
ETHERTYPE_OS9NET = 0x7009
ETHERTYPE_PACER = 0x80c6
ETHERTYPE_PAE = 0x888e
ETHERTYPE_PBB = 0x88e7
ETHERTYPE_PCS = 0x4242
ETHERTYPE_PLANNING = 0x8044
ETHERTYPE_PPP = 0x880b
@ -409,28 +508,40 @@ const (
ETHER_CRC_POLY_LE = 0xedb88320
ETHER_HDR_LEN = 0xe
ETHER_MAX_DIX_LEN = 0x600
ETHER_MAX_HARDMTU_LEN = 0xff9b
ETHER_MAX_LEN = 0x5ee
ETHER_MIN_LEN = 0x40
ETHER_TYPE_LEN = 0x2
ETHER_VLAN_ENCAP_LEN = 0x4
EVFILT_AIO = -0x3
EVFILT_DEVICE = -0x8
EVFILT_EXCEPT = -0x9
EVFILT_PROC = -0x5
EVFILT_READ = -0x1
EVFILT_SIGNAL = -0x6
EVFILT_SYSCOUNT = 0x7
EVFILT_SYSCOUNT = 0x9
EVFILT_TIMER = -0x7
EVFILT_VNODE = -0x4
EVFILT_WRITE = -0x2
EVL_ENCAPLEN = 0x4
EVL_PRIO_BITS = 0xd
EVL_PRIO_MAX = 0x7
EVL_VLID_MASK = 0xfff
EVL_VLID_MAX = 0xffe
EVL_VLID_MIN = 0x1
EVL_VLID_NULL = 0x0
EV_ADD = 0x1
EV_CLEAR = 0x20
EV_DELETE = 0x2
EV_DISABLE = 0x8
EV_DISPATCH = 0x80
EV_ENABLE = 0x4
EV_EOF = 0x8000
EV_ERROR = 0x4000
EV_FLAG1 = 0x2000
EV_ONESHOT = 0x10
EV_SYSFLAGS = 0xf000
EV_RECEIPT = 0x40
EV_SYSFLAGS = 0xf800
EXTA = 0x4b00
EXTB = 0x9600
EXTPROC = 0x800
@ -443,6 +554,7 @@ const (
F_GETFL = 0x3
F_GETLK = 0x7
F_GETOWN = 0x5
F_ISATTY = 0xb
F_OK = 0x0
F_RDLCK = 0x1
F_SETFD = 0x2
@ -460,7 +572,6 @@ const (
IEXTEN = 0x400
IFAN_ARRIVAL = 0x0
IFAN_DEPARTURE = 0x1
IFA_ROUTE = 0x1
IFF_ALLMULTI = 0x200
IFF_BROADCAST = 0x2
IFF_CANTCHANGE = 0x8e52
@ -471,12 +582,12 @@ const (
IFF_LOOPBACK = 0x8
IFF_MULTICAST = 0x8000
IFF_NOARP = 0x80
IFF_NOTRAILERS = 0x20
IFF_OACTIVE = 0x400
IFF_POINTOPOINT = 0x10
IFF_PROMISC = 0x100
IFF_RUNNING = 0x40
IFF_SIMPLEX = 0x800
IFF_STATICARP = 0x20
IFF_UP = 0x1
IFNAMSIZ = 0x10
IFT_1822 = 0x2
@ -605,6 +716,7 @@ const (
IFT_LINEGROUP = 0xd2
IFT_LOCALTALK = 0x2a
IFT_LOOP = 0x18
IFT_MBIM = 0xfa
IFT_MEDIAMAILOVERIP = 0x8b
IFT_MFSIGLINK = 0xa7
IFT_MIOX25 = 0x26
@ -695,6 +807,7 @@ const (
IFT_VOICEOVERCABLE = 0xc6
IFT_VOICEOVERFRAMERELAY = 0x99
IFT_VOICEOVERIP = 0x68
IFT_WIREGUARD = 0xfb
IFT_X213 = 0x5d
IFT_X25 = 0x5
IFT_X25DDN = 0x4
@ -729,8 +842,6 @@ const (
IPPROTO_AH = 0x33
IPPROTO_CARP = 0x70
IPPROTO_DIVERT = 0x102
IPPROTO_DIVERT_INIT = 0x2
IPPROTO_DIVERT_RESP = 0x1
IPPROTO_DONE = 0x101
IPPROTO_DSTOPTS = 0x3c
IPPROTO_EGP = 0x8
@ -762,9 +873,11 @@ const (
IPPROTO_RAW = 0xff
IPPROTO_ROUTING = 0x2b
IPPROTO_RSVP = 0x2e
IPPROTO_SCTP = 0x84
IPPROTO_TCP = 0x6
IPPROTO_TP = 0x1d
IPPROTO_UDP = 0x11
IPPROTO_UDPLITE = 0x88
IPV6_AUTH_LEVEL = 0x35
IPV6_AUTOFLOWLABEL = 0x3b
IPV6_CHECKSUM = 0x1a
@ -787,6 +900,7 @@ const (
IPV6_LEAVE_GROUP = 0xd
IPV6_MAXHLIM = 0xff
IPV6_MAXPACKET = 0xffff
IPV6_MINHOPCOUNT = 0x41
IPV6_MMTU = 0x500
IPV6_MULTICAST_HOPS = 0xa
IPV6_MULTICAST_IF = 0x9
@ -826,12 +940,12 @@ const (
IP_DEFAULT_MULTICAST_LOOP = 0x1
IP_DEFAULT_MULTICAST_TTL = 0x1
IP_DF = 0x4000
IP_DIVERTFL = 0x1022
IP_DROP_MEMBERSHIP = 0xd
IP_ESP_NETWORK_LEVEL = 0x16
IP_ESP_TRANS_LEVEL = 0x15
IP_HDRINCL = 0x2
IP_IPCOMP_LEVEL = 0x1d
IP_IPDEFTTL = 0x25
IP_IPSECFLOWINFO = 0x24
IP_IPSEC_LOCAL_AUTH = 0x1b
IP_IPSEC_LOCAL_CRED = 0x19
@ -865,10 +979,15 @@ const (
IP_RETOPTS = 0x8
IP_RF = 0x8000
IP_RTABLE = 0x1021
IP_SENDSRCADDR = 0x7
IP_TOS = 0x3
IP_TTL = 0x4
ISIG = 0x80
ISTRIP = 0x20
ITIMER_PROF = 0x2
ITIMER_REAL = 0x0
ITIMER_VIRTUAL = 0x1
IUCLC = 0x1000
IXANY = 0x800
IXOFF = 0x400
IXON = 0x200
@ -900,10 +1019,11 @@ const (
MAP_INHERIT_COPY = 0x1
MAP_INHERIT_NONE = 0x2
MAP_INHERIT_SHARE = 0x0
MAP_NOEXTEND = 0x100
MAP_NORESERVE = 0x40
MAP_INHERIT_ZERO = 0x3
MAP_NOEXTEND = 0x0
MAP_NORESERVE = 0x0
MAP_PRIVATE = 0x2
MAP_RENAME = 0x20
MAP_RENAME = 0x0
MAP_SHARED = 0x1
MAP_STACK = 0x4000
MAP_TRYFIXED = 0x0
@ -922,6 +1042,7 @@ const (
MNT_NOATIME = 0x8000
MNT_NODEV = 0x10
MNT_NOEXEC = 0x4
MNT_NOPERM = 0x20
MNT_NOSUID = 0x8
MNT_NOWAIT = 0x2
MNT_QUOTA = 0x2000
@ -929,13 +1050,29 @@ const (
MNT_RELOAD = 0x40000
MNT_ROOTFS = 0x4000
MNT_SOFTDEP = 0x4000000
MNT_STALLED = 0x100000
MNT_SWAPPABLE = 0x200000
MNT_SYNCHRONOUS = 0x2
MNT_UPDATE = 0x10000
MNT_VISFLAGMASK = 0x400ffff
MNT_WAIT = 0x1
MNT_WANTRDWR = 0x2000000
MNT_WXALLOWED = 0x800
MOUNT_AFS = "afs"
MOUNT_CD9660 = "cd9660"
MOUNT_EXT2FS = "ext2fs"
MOUNT_FFS = "ffs"
MOUNT_FUSEFS = "fuse"
MOUNT_MFS = "mfs"
MOUNT_MSDOS = "msdos"
MOUNT_NCPFS = "ncpfs"
MOUNT_NFS = "nfs"
MOUNT_NTFS = "ntfs"
MOUNT_TMPFS = "tmpfs"
MOUNT_UDF = "udf"
MOUNT_UFS = "ffs"
MSG_BCAST = 0x100
MSG_CMSG_CLOEXEC = 0x800
MSG_CTRUNC = 0x20
MSG_DONTROUTE = 0x4
MSG_DONTWAIT = 0x80
@ -946,6 +1083,7 @@ const (
MSG_PEEK = 0x2
MSG_TRUNC = 0x10
MSG_WAITALL = 0x40
MSG_WAITFORONE = 0x1000
MS_ASYNC = 0x1
MS_INVALIDATE = 0x4
MS_SYNC = 0x2
@ -953,12 +1091,16 @@ const (
NET_RT_DUMP = 0x1
NET_RT_FLAGS = 0x2
NET_RT_IFLIST = 0x3
NET_RT_MAXID = 0x6
NET_RT_IFNAMES = 0x6
NET_RT_MAXID = 0x8
NET_RT_SOURCE = 0x7
NET_RT_STATS = 0x4
NET_RT_TABLE = 0x5
NFDBITS = 0x20
NOFLSH = 0x80000000
NOKERNINFO = 0x2000000
NOTE_ATTRIB = 0x8
NOTE_CHANGE = 0x1
NOTE_CHILD = 0x4
NOTE_DELETE = 0x1
NOTE_EOF = 0x2
@ -968,6 +1110,7 @@ const (
NOTE_FORK = 0x40000000
NOTE_LINK = 0x10
NOTE_LOWAT = 0x1
NOTE_OOB = 0x4
NOTE_PCTRLMASK = 0xf0000000
NOTE_PDATAMASK = 0xfffff
NOTE_RENAME = 0x20
@ -977,11 +1120,13 @@ const (
NOTE_TRUNCATE = 0x80
NOTE_WRITE = 0x2
OCRNL = 0x10
OLCUC = 0x20
ONLCR = 0x2
ONLRET = 0x80
ONOCR = 0x40
ONOEOT = 0x8
OPOST = 0x1
OXTABS = 0x4
O_ACCMODE = 0x3
O_APPEND = 0x8
O_ASYNC = 0x40
@ -1015,7 +1160,6 @@ const (
PROT_NONE = 0x0
PROT_READ = 0x1
PROT_WRITE = 0x2
PT_MASK = 0x3ff000
RLIMIT_CORE = 0x4
RLIMIT_CPU = 0x0
RLIMIT_DATA = 0x2
@ -1027,19 +1171,25 @@ const (
RLIMIT_STACK = 0x3
RLIM_INFINITY = 0x7fffffffffffffff
RTAX_AUTHOR = 0x6
RTAX_BFD = 0xb
RTAX_BRD = 0x7
RTAX_DNS = 0xc
RTAX_DST = 0x0
RTAX_GATEWAY = 0x1
RTAX_GENMASK = 0x3
RTAX_IFA = 0x5
RTAX_IFP = 0x4
RTAX_LABEL = 0xa
RTAX_MAX = 0xb
RTAX_MAX = 0xf
RTAX_NETMASK = 0x2
RTAX_SEARCH = 0xe
RTAX_SRC = 0x8
RTAX_SRCMASK = 0x9
RTAX_STATIC = 0xd
RTA_AUTHOR = 0x40
RTA_BFD = 0x800
RTA_BRD = 0x80
RTA_DNS = 0x1000
RTA_DST = 0x1
RTA_GATEWAY = 0x2
RTA_GENMASK = 0x8
@ -1047,49 +1197,57 @@ const (
RTA_IFP = 0x10
RTA_LABEL = 0x400
RTA_NETMASK = 0x4
RTA_SEARCH = 0x4000
RTA_SRC = 0x100
RTA_SRCMASK = 0x200
RTA_STATIC = 0x2000
RTF_ANNOUNCE = 0x4000
RTF_BFD = 0x1000000
RTF_BLACKHOLE = 0x1000
RTF_BROADCAST = 0x400000
RTF_CACHED = 0x20000
RTF_CLONED = 0x10000
RTF_CLONING = 0x100
RTF_CONNECTED = 0x800000
RTF_DONE = 0x40
RTF_DYNAMIC = 0x10
RTF_FMASK = 0x10f808
RTF_FMASK = 0x110fc08
RTF_GATEWAY = 0x2
RTF_HOST = 0x4
RTF_LLINFO = 0x400
RTF_MASK = 0x80
RTF_LOCAL = 0x200000
RTF_MODIFIED = 0x20
RTF_MPATH = 0x40000
RTF_MPLS = 0x100000
RTF_MULTICAST = 0x200
RTF_PERMANENT_ARP = 0x2000
RTF_PROTO1 = 0x8000
RTF_PROTO2 = 0x4000
RTF_PROTO3 = 0x2000
RTF_REJECT = 0x8
RTF_SOURCE = 0x20000
RTF_STATIC = 0x800
RTF_TUNNEL = 0x100000
RTF_UP = 0x1
RTF_USETRAILERS = 0x8000
RTF_XRESOLVE = 0x200
RTM_80211INFO = 0x15
RTM_ADD = 0x1
RTM_BFD = 0x12
RTM_CHANGE = 0x3
RTM_CHGADDRATTR = 0x14
RTM_DELADDR = 0xd
RTM_DELETE = 0x2
RTM_DESYNC = 0x10
RTM_GET = 0x4
RTM_IFANNOUNCE = 0xf
RTM_IFINFO = 0xe
RTM_LOCK = 0x8
RTM_INVALIDATE = 0x11
RTM_LOSING = 0x5
RTM_MAXSIZE = 0x800
RTM_MISS = 0x7
RTM_NEWADDR = 0xc
RTM_PROPOSAL = 0x13
RTM_REDIRECT = 0x6
RTM_RESOLVE = 0xb
RTM_RTTUNIT = 0xf4240
RTM_SOURCE = 0x16
RTM_VERSION = 0x5
RTV_EXPIRE = 0x4
RTV_HOPCOUNT = 0x2
@ -1099,67 +1257,74 @@ const (
RTV_RTTVAR = 0x80
RTV_SPIPE = 0x10
RTV_SSTHRESH = 0x20
RT_TABLEID_BITS = 0x8
RT_TABLEID_MASK = 0xff
RT_TABLEID_MAX = 0xff
RUSAGE_CHILDREN = -0x1
RUSAGE_SELF = 0x0
RUSAGE_THREAD = 0x1
SCM_RIGHTS = 0x1
SCM_TIMESTAMP = 0x4
SEEK_CUR = 0x1
SEEK_END = 0x2
SEEK_SET = 0x0
SHUT_RD = 0x0
SHUT_RDWR = 0x2
SHUT_WR = 0x1
SIOCADDMULTI = 0x80206931
SIOCAIFADDR = 0x8040691a
SIOCAIFGROUP = 0x80246987
SIOCALIFADDR = 0x8218691c
SIOCATMARK = 0x40047307
SIOCBRDGADD = 0x8054693c
SIOCBRDGADDS = 0x80546941
SIOCBRDGARL = 0x806e694d
SIOCBRDGADD = 0x805c693c
SIOCBRDGADDL = 0x805c6949
SIOCBRDGADDS = 0x805c6941
SIOCBRDGARL = 0x808c694d
SIOCBRDGDADDR = 0x81286947
SIOCBRDGDEL = 0x8054693d
SIOCBRDGDELS = 0x80546942
SIOCBRDGFLUSH = 0x80546948
SIOCBRDGFRL = 0x806e694e
SIOCBRDGDEL = 0x805c693d
SIOCBRDGDELS = 0x805c6942
SIOCBRDGFLUSH = 0x805c6948
SIOCBRDGFRL = 0x808c694e
SIOCBRDGGCACHE = 0xc0146941
SIOCBRDGGFD = 0xc0146952
SIOCBRDGGHT = 0xc0146951
SIOCBRDGGIFFLGS = 0xc054693e
SIOCBRDGGIFFLGS = 0xc05c693e
SIOCBRDGGMA = 0xc0146953
SIOCBRDGGPARAM = 0xc03c6958
SIOCBRDGGPRI = 0xc0146950
SIOCBRDGGRL = 0xc028694f
SIOCBRDGGSIFS = 0xc054693c
SIOCBRDGGTO = 0xc0146946
SIOCBRDGIFS = 0xc0546942
SIOCBRDGIFS = 0xc05c6942
SIOCBRDGRTS = 0xc0186943
SIOCBRDGSADDR = 0xc1286944
SIOCBRDGSCACHE = 0x80146940
SIOCBRDGSFD = 0x80146952
SIOCBRDGSHT = 0x80146951
SIOCBRDGSIFCOST = 0x80546955
SIOCBRDGSIFFLGS = 0x8054693f
SIOCBRDGSIFPRIO = 0x80546954
SIOCBRDGSIFCOST = 0x805c6955
SIOCBRDGSIFFLGS = 0x805c693f
SIOCBRDGSIFPRIO = 0x805c6954
SIOCBRDGSIFPROT = 0x805c694a
SIOCBRDGSMA = 0x80146953
SIOCBRDGSPRI = 0x80146950
SIOCBRDGSPROTO = 0x8014695a
SIOCBRDGSTO = 0x80146945
SIOCBRDGSTXHC = 0x80146959
SIOCDELLABEL = 0x80206997
SIOCDELMULTI = 0x80206932
SIOCDIFADDR = 0x80206919
SIOCDIFGROUP = 0x80246989
SIOCDIFPARENT = 0x802069b4
SIOCDIFPHYADDR = 0x80206949
SIOCDLIFADDR = 0x8218691e
SIOCDPWE3NEIGHBOR = 0x802069de
SIOCDVNETID = 0x802069af
SIOCGETKALIVE = 0xc01869a4
SIOCGETLABEL = 0x8020699a
SIOCGETMPWCFG = 0xc02069ae
SIOCGETPFLOW = 0xc02069fe
SIOCGETPFSYNC = 0xc02069f8
SIOCGETSGCNT = 0xc0147534
SIOCGETVIFCNT = 0xc0147533
SIOCGETVLAN = 0xc0206990
SIOCGHIWAT = 0x40047301
SIOCGIFADDR = 0xc0206921
SIOCGIFASYNCMAP = 0xc020697c
SIOCGIFBRDADDR = 0xc0206923
SIOCGIFCONF = 0xc0086924
SIOCGIFDATA = 0xc020691b
@ -1168,40 +1333,53 @@ const (
SIOCGIFFLAGS = 0xc0206911
SIOCGIFGATTR = 0xc024698b
SIOCGIFGENERIC = 0xc020693a
SIOCGIFGLIST = 0xc024698d
SIOCGIFGMEMB = 0xc024698a
SIOCGIFGROUP = 0xc0246988
SIOCGIFHARDMTU = 0xc02069a5
SIOCGIFMEDIA = 0xc0286936
SIOCGIFLLPRIO = 0xc02069b6
SIOCGIFMEDIA = 0xc0386938
SIOCGIFMETRIC = 0xc0206917
SIOCGIFMTU = 0xc020697e
SIOCGIFNETMASK = 0xc0206925
SIOCGIFPDSTADDR = 0xc0206948
SIOCGIFPAIR = 0xc02069b1
SIOCGIFPARENT = 0xc02069b3
SIOCGIFPRIORITY = 0xc020699c
SIOCGIFPSRCADDR = 0xc0206947
SIOCGIFRDOMAIN = 0xc02069a0
SIOCGIFRTLABEL = 0xc0206983
SIOCGIFTIMESLOT = 0xc0206986
SIOCGIFRXR = 0x802069aa
SIOCGIFSFFPAGE = 0xc1126939
SIOCGIFXFLAGS = 0xc020699e
SIOCGLIFADDR = 0xc218691d
SIOCGLIFPHYADDR = 0xc218694b
SIOCGLIFPHYDF = 0xc02069c2
SIOCGLIFPHYECN = 0xc02069c8
SIOCGLIFPHYRTABLE = 0xc02069a2
SIOCGLIFPHYTTL = 0xc02069a9
SIOCGLOWAT = 0x40047303
SIOCGPGRP = 0x40047309
SIOCGPWE3 = 0xc0206998
SIOCGPWE3CTRLWORD = 0xc02069dc
SIOCGPWE3FAT = 0xc02069dd
SIOCGPWE3NEIGHBOR = 0xc21869de
SIOCGRXHPRIO = 0xc02069db
SIOCGSPPPPARAMS = 0xc0206994
SIOCGTXHPRIO = 0xc02069c6
SIOCGUMBINFO = 0xc02069be
SIOCGUMBPARAM = 0xc02069c0
SIOCGVH = 0xc02069f6
SIOCGVNETFLOWID = 0xc02069c4
SIOCGVNETID = 0xc02069a7
SIOCIFAFATTACH = 0x801169ab
SIOCIFAFDETACH = 0x801169ac
SIOCIFCREATE = 0x8020697a
SIOCIFDESTROY = 0x80206979
SIOCIFGCLONERS = 0xc00c6978
SIOCSETKALIVE = 0x801869a3
SIOCSETLABEL = 0x80206999
SIOCSETMPWCFG = 0x802069ad
SIOCSETPFLOW = 0x802069fd
SIOCSETPFSYNC = 0x802069f7
SIOCSETVLAN = 0x8020698f
SIOCSHIWAT = 0x80047300
SIOCSIFADDR = 0x8020690c
SIOCSIFASYNCMAP = 0x8020697d
SIOCSIFBRDADDR = 0x80206913
SIOCSIFDESCR = 0x80206980
SIOCSIFDSTADDR = 0x8020690e
@ -1209,25 +1387,37 @@ const (
SIOCSIFGATTR = 0x8024698c
SIOCSIFGENERIC = 0x80206939
SIOCSIFLLADDR = 0x8020691f
SIOCSIFMEDIA = 0xc0206935
SIOCSIFLLPRIO = 0x802069b5
SIOCSIFMEDIA = 0xc0206937
SIOCSIFMETRIC = 0x80206918
SIOCSIFMTU = 0x8020697f
SIOCSIFNETMASK = 0x80206916
SIOCSIFPHYADDR = 0x80406946
SIOCSIFPAIR = 0x802069b0
SIOCSIFPARENT = 0x802069b2
SIOCSIFPRIORITY = 0x8020699b
SIOCSIFRDOMAIN = 0x8020699f
SIOCSIFRTLABEL = 0x80206982
SIOCSIFTIMESLOT = 0x80206985
SIOCSIFXFLAGS = 0x8020699d
SIOCSLIFPHYADDR = 0x8218694a
SIOCSLIFPHYDF = 0x802069c1
SIOCSLIFPHYECN = 0x802069c7
SIOCSLIFPHYRTABLE = 0x802069a1
SIOCSLIFPHYTTL = 0x802069a8
SIOCSLOWAT = 0x80047302
SIOCSPGRP = 0x80047308
SIOCSPWE3CTRLWORD = 0x802069dc
SIOCSPWE3FAT = 0x802069dd
SIOCSPWE3NEIGHBOR = 0x821869de
SIOCSRXHPRIO = 0x802069db
SIOCSSPPPPARAMS = 0x80206993
SIOCSTXHPRIO = 0x802069c5
SIOCSUMBPARAM = 0x802069bf
SIOCSVH = 0xc02069f5
SIOCSVNETFLOWID = 0x802069c3
SIOCSVNETID = 0x802069a6
SOCK_CLOEXEC = 0x8000
SOCK_DGRAM = 0x2
SOCK_DNS = 0x1000
SOCK_NONBLOCK = 0x4000
SOCK_RAW = 0x3
SOCK_RDM = 0x4
SOCK_SEQPACKET = 0x5
@ -1238,6 +1428,7 @@ const (
SO_BINDANY = 0x1000
SO_BROADCAST = 0x20
SO_DEBUG = 0x1
SO_DOMAIN = 0x1024
SO_DONTROUTE = 0x10
SO_ERROR = 0x1007
SO_KEEPALIVE = 0x8
@ -1245,6 +1436,7 @@ const (
SO_NETPROC = 0x1020
SO_OOBINLINE = 0x100
SO_PEERCRED = 0x1022
SO_PROTOCOL = 0x1025
SO_RCVBUF = 0x1002
SO_RCVLOWAT = 0x1004
SO_RCVTIMEO = 0x1006
@ -1258,6 +1450,7 @@ const (
SO_TIMESTAMP = 0x800
SO_TYPE = 0x1008
SO_USELOOPBACK = 0x40
SO_ZEROIZE = 0x2000
S_BLKSIZE = 0x200
S_IEXEC = 0x40
S_IFBLK = 0x6000
@ -1287,9 +1480,24 @@ const (
S_IXOTH = 0x1
S_IXUSR = 0x40
TCIFLUSH = 0x1
TCIOFF = 0x3
TCIOFLUSH = 0x3
TCION = 0x4
TCOFLUSH = 0x2
TCP_MAXBURST = 0x4
TCOOFF = 0x1
TCOON = 0x2
TCPOPT_EOL = 0x0
TCPOPT_MAXSEG = 0x2
TCPOPT_NOP = 0x1
TCPOPT_SACK = 0x5
TCPOPT_SACK_HDR = 0x1010500
TCPOPT_SACK_PERMITTED = 0x4
TCPOPT_SACK_PERMIT_HDR = 0x1010402
TCPOPT_SIGNATURE = 0x13
TCPOPT_TIMESTAMP = 0x8
TCPOPT_TSTAMP_HDR = 0x101080a
TCPOPT_WINDOW = 0x3
TCP_INFO = 0x9
TCP_MAXSEG = 0x2
TCP_MAXWIN = 0xffff
TCP_MAX_SACK = 0x3
@ -1298,11 +1506,15 @@ const (
TCP_MSS = 0x200
TCP_NODELAY = 0x1
TCP_NOPUSH = 0x10
TCP_NSTATES = 0xb
TCP_SACKHOLE_LIMIT = 0x80
TCP_SACK_ENABLE = 0x8
TCSAFLUSH = 0x2
TIMER_ABSTIME = 0x1
TIMER_RELTIME = 0x0
TIOCCBRK = 0x2000747a
TIOCCDTR = 0x20007478
TIOCCHKVERAUTH = 0x2000741e
TIOCCLRVERAUTH = 0x2000741d
TIOCCONS = 0x80047462
TIOCDRAIN = 0x2000745e
TIOCEXCL = 0x2000740d
@ -1357,17 +1569,21 @@ const (
TIOCSETAF = 0x802c7416
TIOCSETAW = 0x802c7415
TIOCSETD = 0x8004741b
TIOCSETVERAUTH = 0x8004741c
TIOCSFLAGS = 0x8004745c
TIOCSIG = 0x8004745f
TIOCSPGRP = 0x80047476
TIOCSTART = 0x2000746e
TIOCSTAT = 0x80047465
TIOCSTI = 0x80017472
TIOCSTAT = 0x20007465
TIOCSTOP = 0x2000746f
TIOCSTSTAMP = 0x8008745a
TIOCSWINSZ = 0x80087467
TIOCUCNTL = 0x80047466
TIOCUCNTL_CBRK = 0x7a
TIOCUCNTL_SBRK = 0x7b
TOSTOP = 0x400000
UTIME_NOW = -0x2
UTIME_OMIT = -0x1
VDISCARD = 0xf
VDSUSP = 0xb
VEOF = 0x0
@ -1378,6 +1594,19 @@ const (
VKILL = 0x5
VLNEXT = 0xe
VMIN = 0x10
VM_ANONMIN = 0x7
VM_LOADAVG = 0x2
VM_MALLOC_CONF = 0xc
VM_MAXID = 0xd
VM_MAXSLP = 0xa
VM_METER = 0x1
VM_NKMEMPAGES = 0x6
VM_PSSTRINGS = 0x3
VM_SWAPENCRYPT = 0x5
VM_USPACE = 0xb
VM_UVMEXP = 0x4
VM_VNODEMIN = 0x9
VM_VTEXTMIN = 0x8
VQUIT = 0x9
VREPRINT = 0x6
VSTART = 0xc
@ -1390,8 +1619,8 @@ const (
WCONTINUED = 0x8
WCOREFLAG = 0x80
WNOHANG = 0x1
WSTOPPED = 0x7f
WUNTRACED = 0x2
XCASE = 0x1000000
)
// Errors
@ -1405,6 +1634,7 @@ const (
EALREADY = syscall.Errno(0x25)
EAUTH = syscall.Errno(0x50)
EBADF = syscall.Errno(0x9)
EBADMSG = syscall.Errno(0x5c)
EBADRPC = syscall.Errno(0x48)
EBUSY = syscall.Errno(0x10)
ECANCELED = syscall.Errno(0x58)
@ -1431,7 +1661,7 @@ const (
EIPSEC = syscall.Errno(0x52)
EISCONN = syscall.Errno(0x38)
EISDIR = syscall.Errno(0x15)
ELAST = syscall.Errno(0x5b)
ELAST = syscall.Errno(0x5f)
ELOOP = syscall.Errno(0x3e)
EMEDIUMTYPE = syscall.Errno(0x56)
EMFILE = syscall.Errno(0x18)
@ -1459,12 +1689,14 @@ const (
ENOTCONN = syscall.Errno(0x39)
ENOTDIR = syscall.Errno(0x14)
ENOTEMPTY = syscall.Errno(0x42)
ENOTRECOVERABLE = syscall.Errno(0x5d)
ENOTSOCK = syscall.Errno(0x26)
ENOTSUP = syscall.Errno(0x5b)
ENOTTY = syscall.Errno(0x19)
ENXIO = syscall.Errno(0x6)
EOPNOTSUPP = syscall.Errno(0x2d)
EOVERFLOW = syscall.Errno(0x57)
EOWNERDEAD = syscall.Errno(0x5e)
EPERM = syscall.Errno(0x1)
EPFNOSUPPORT = syscall.Errno(0x2e)
EPIPE = syscall.Errno(0x20)
@ -1472,6 +1704,7 @@ const (
EPROCUNAVAIL = syscall.Errno(0x4c)
EPROGMISMATCH = syscall.Errno(0x4b)
EPROGUNAVAIL = syscall.Errno(0x4a)
EPROTO = syscall.Errno(0x5f)
EPROTONOSUPPORT = syscall.Errno(0x2b)
EPROTOTYPE = syscall.Errno(0x29)
ERANGE = syscall.Errno(0x22)
@ -1568,7 +1801,7 @@ var errorList = [...]struct {
{32, "EPIPE", "broken pipe"},
{33, "EDOM", "numerical argument out of domain"},
{34, "ERANGE", "result too large"},
{35, "EWOULDBLOCK", "resource temporarily unavailable"},
{35, "EAGAIN", "resource temporarily unavailable"},
{36, "EINPROGRESS", "operation now in progress"},
{37, "EALREADY", "operation already in progress"},
{38, "ENOTSOCK", "socket operation on non-socket"},
@ -1624,7 +1857,11 @@ var errorList = [...]struct {
{88, "ECANCELED", "operation canceled"},
{89, "EIDRM", "identifier removed"},
{90, "ENOMSG", "no message of desired type"},
{91, "ELAST", "not supported"},
{91, "ENOTSUP", "not supported"},
{92, "EBADMSG", "bad message"},
{93, "ENOTRECOVERABLE", "state not recoverable"},
{94, "EOWNERDEAD", "previous owner died"},
{95, "ELAST", "protocol error"},
}
// Signal table
@ -1638,7 +1875,7 @@ var signalList = [...]struct {
{3, "SIGQUIT", "quit"},
{4, "SIGILL", "illegal instruction"},
{5, "SIGTRAP", "trace/BPT trap"},
{6, "SIGABRT", "abort trap"},
{6, "SIGIOT", "abort trap"},
{7, "SIGEMT", "EMT trap"},
{8, "SIGFPE", "floating point exception"},
{9, "SIGKILL", "killed"},
@ -1665,4 +1902,5 @@ var signalList = [...]struct {
{30, "SIGUSR1", "user defined signal 1"},
{31, "SIGUSR2", "user defined signal 2"},
{32, "SIGTHR", "thread AST"},
{28672, "SIGSTKSZ", "unknown signal"},
}

View File

@ -109,6 +109,15 @@ const (
BPF_DIRECTION_IN = 0x1
BPF_DIRECTION_OUT = 0x2
BPF_DIV = 0x30
BPF_FILDROP_CAPTURE = 0x1
BPF_FILDROP_DROP = 0x2
BPF_FILDROP_PASS = 0x0
BPF_F_DIR_IN = 0x10
BPF_F_DIR_MASK = 0x30
BPF_F_DIR_OUT = 0x20
BPF_F_DIR_SHIFT = 0x4
BPF_F_FLOWID = 0x8
BPF_F_PRI_MASK = 0x7
BPF_H = 0x8
BPF_IMM = 0x0
BPF_IND = 0x40
@ -137,6 +146,7 @@ const (
BPF_OR = 0x40
BPF_RELEASE = 0x30bb6
BPF_RET = 0x6
BPF_RND = 0xc0
BPF_RSH = 0x70
BPF_ST = 0x2
BPF_STX = 0x3
@ -177,7 +187,65 @@ const (
CTL_KERN = 0x1
CTL_MAXNAME = 0xc
CTL_NET = 0x4
DIOCADDQUEUE = 0xc110445d
DIOCADDRULE = 0xcd604404
DIOCADDSTATE = 0xc1084425
DIOCCHANGERULE = 0xcd60441a
DIOCCLRIFFLAG = 0xc028445a
DIOCCLRSRCNODES = 0x20004455
DIOCCLRSTATES = 0xc0e04412
DIOCCLRSTATUS = 0xc0284416
DIOCGETLIMIT = 0xc0084427
DIOCGETQSTATS = 0xc1204460
DIOCGETQUEUE = 0xc110445f
DIOCGETQUEUES = 0xc110445e
DIOCGETRULE = 0xcd604407
DIOCGETRULES = 0xcd604406
DIOCGETRULESET = 0xc444443b
DIOCGETRULESETS = 0xc444443a
DIOCGETSRCNODES = 0xc0104454
DIOCGETSTATE = 0xc1084413
DIOCGETSTATES = 0xc0104419
DIOCGETSTATUS = 0xc1e84415
DIOCGETSYNFLWATS = 0xc0084463
DIOCGETTIMEOUT = 0xc008441e
DIOCIGETIFACES = 0xc0284457
DIOCKILLSRCNODES = 0xc080445b
DIOCKILLSTATES = 0xc0e04429
DIOCNATLOOK = 0xc0504417
DIOCOSFPADD = 0xc088444f
DIOCOSFPFLUSH = 0x2000444e
DIOCOSFPGET = 0xc0884450
DIOCRADDADDRS = 0xc4504443
DIOCRADDTABLES = 0xc450443d
DIOCRCLRADDRS = 0xc4504442
DIOCRCLRASTATS = 0xc4504448
DIOCRCLRTABLES = 0xc450443c
DIOCRCLRTSTATS = 0xc4504441
DIOCRDELADDRS = 0xc4504444
DIOCRDELTABLES = 0xc450443e
DIOCRGETADDRS = 0xc4504446
DIOCRGETASTATS = 0xc4504447
DIOCRGETTABLES = 0xc450443f
DIOCRGETTSTATS = 0xc4504440
DIOCRINADEFINE = 0xc450444d
DIOCRSETADDRS = 0xc4504445
DIOCRSETTFLAGS = 0xc450444a
DIOCRTSTADDRS = 0xc4504449
DIOCSETDEBUG = 0xc0044418
DIOCSETHOSTID = 0xc0044456
DIOCSETIFFLAG = 0xc0284459
DIOCSETLIMIT = 0xc0084428
DIOCSETREASS = 0xc004445c
DIOCSETSTATUSIF = 0xc0284414
DIOCSETSYNCOOKIES = 0xc0014462
DIOCSETSYNFLWATS = 0xc0084461
DIOCSETTIMEOUT = 0xc008441d
DIOCSTART = 0x20004401
DIOCSTOP = 0x20004402
DIOCXBEGIN = 0xc0104451
DIOCXCOMMIT = 0xc0104452
DIOCXROLLBACK = 0xc0104453
DLT_ARCNET = 0x7
DLT_ATM_RFC1483 = 0xb
DLT_AX25 = 0x3
@ -240,6 +308,8 @@ const (
EMUL_ENABLED = 0x1
EMUL_NATIVE = 0x2
ENDRUNDISC = 0x9
ETH64_8021_RSVD_MASK = 0xfffffffffff0
ETH64_8021_RSVD_PREFIX = 0x180c2000000
ETHERMIN = 0x2e
ETHERMTU = 0x5dc
ETHERTYPE_8023 = 0x4
@ -292,6 +362,7 @@ const (
ETHERTYPE_DN = 0x6003
ETHERTYPE_DOGFIGHT = 0x1989
ETHERTYPE_DSMD = 0x8039
ETHERTYPE_EAPOL = 0x888e
ETHERTYPE_ECMA = 0x803
ETHERTYPE_ENCRYPT = 0x803d
ETHERTYPE_ES = 0x805d
@ -323,6 +394,7 @@ const (
ETHERTYPE_LLDP = 0x88cc
ETHERTYPE_LOGICRAFT = 0x8148
ETHERTYPE_LOOPBACK = 0x9000
ETHERTYPE_MACSEC = 0x88e5
ETHERTYPE_MATRA = 0x807a
ETHERTYPE_MAX = 0xffff
ETHERTYPE_MERIT = 0x807c
@ -351,15 +423,17 @@ const (
ETHERTYPE_NCD = 0x8149
ETHERTYPE_NESTAR = 0x8006
ETHERTYPE_NETBEUI = 0x8191
ETHERTYPE_NHRP = 0x2001
ETHERTYPE_NOVELL = 0x8138
ETHERTYPE_NS = 0x600
ETHERTYPE_NSAT = 0x601
ETHERTYPE_NSCOMPAT = 0x807
ETHERTYPE_NSH = 0x984f
ETHERTYPE_NTRAILER = 0x10
ETHERTYPE_OS9 = 0x7007
ETHERTYPE_OS9NET = 0x7009
ETHERTYPE_PACER = 0x80c6
ETHERTYPE_PAE = 0x888e
ETHERTYPE_PBB = 0x88e7
ETHERTYPE_PCS = 0x4242
ETHERTYPE_PLANNING = 0x8044
ETHERTYPE_PPP = 0x880b
@ -441,10 +515,11 @@ const (
ETHER_VLAN_ENCAP_LEN = 0x4
EVFILT_AIO = -0x3
EVFILT_DEVICE = -0x8
EVFILT_EXCEPT = -0x9
EVFILT_PROC = -0x5
EVFILT_READ = -0x1
EVFILT_SIGNAL = -0x6
EVFILT_SYSCOUNT = 0x8
EVFILT_SYSCOUNT = 0x9
EVFILT_TIMER = -0x7
EVFILT_VNODE = -0x4
EVFILT_WRITE = -0x2
@ -466,7 +541,7 @@ const (
EV_FLAG1 = 0x2000
EV_ONESHOT = 0x10
EV_RECEIPT = 0x40
EV_SYSFLAGS = 0xf000
EV_SYSFLAGS = 0xf800
EXTA = 0x4b00
EXTB = 0x9600
EXTPROC = 0x800
@ -732,6 +807,7 @@ const (
IFT_VOICEOVERCABLE = 0xc6
IFT_VOICEOVERFRAMERELAY = 0x99
IFT_VOICEOVERIP = 0x68
IFT_WIREGUARD = 0xfb
IFT_X213 = 0x5d
IFT_X25 = 0x5
IFT_X25DDN = 0x4
@ -797,9 +873,11 @@ const (
IPPROTO_RAW = 0xff
IPPROTO_ROUTING = 0x2b
IPPROTO_RSVP = 0x2e
IPPROTO_SCTP = 0x84
IPPROTO_TCP = 0x6
IPPROTO_TP = 0x1d
IPPROTO_UDP = 0x11
IPPROTO_UDPLITE = 0x88
IPV6_AUTH_LEVEL = 0x35
IPV6_AUTOFLOWLABEL = 0x3b
IPV6_CHECKSUM = 0x1a
@ -906,6 +984,9 @@ const (
IP_TTL = 0x4
ISIG = 0x80
ISTRIP = 0x20
ITIMER_PROF = 0x2
ITIMER_REAL = 0x0
ITIMER_VIRTUAL = 0x1
IUCLC = 0x1000
IXANY = 0x800
IXOFF = 0x400
@ -970,12 +1051,26 @@ const (
MNT_ROOTFS = 0x4000
MNT_SOFTDEP = 0x4000000
MNT_STALLED = 0x100000
MNT_SWAPPABLE = 0x200000
MNT_SYNCHRONOUS = 0x2
MNT_UPDATE = 0x10000
MNT_VISFLAGMASK = 0x400ffff
MNT_WAIT = 0x1
MNT_WANTRDWR = 0x2000000
MNT_WXALLOWED = 0x800
MOUNT_AFS = "afs"
MOUNT_CD9660 = "cd9660"
MOUNT_EXT2FS = "ext2fs"
MOUNT_FFS = "ffs"
MOUNT_FUSEFS = "fuse"
MOUNT_MFS = "mfs"
MOUNT_MSDOS = "msdos"
MOUNT_NCPFS = "ncpfs"
MOUNT_NFS = "nfs"
MOUNT_NTFS = "ntfs"
MOUNT_TMPFS = "tmpfs"
MOUNT_UDF = "udf"
MOUNT_UFS = "ffs"
MSG_BCAST = 0x100
MSG_CMSG_CLOEXEC = 0x800
MSG_CTRUNC = 0x20
@ -988,6 +1083,7 @@ const (
MSG_PEEK = 0x2
MSG_TRUNC = 0x10
MSG_WAITALL = 0x40
MSG_WAITFORONE = 0x1000
MS_ASYNC = 0x1
MS_INVALIDATE = 0x4
MS_SYNC = 0x2
@ -996,7 +1092,8 @@ const (
NET_RT_FLAGS = 0x2
NET_RT_IFLIST = 0x3
NET_RT_IFNAMES = 0x6
NET_RT_MAXID = 0x7
NET_RT_MAXID = 0x8
NET_RT_SOURCE = 0x7
NET_RT_STATS = 0x4
NET_RT_TABLE = 0x5
NFDBITS = 0x20
@ -1013,6 +1110,7 @@ const (
NOTE_FORK = 0x40000000
NOTE_LINK = 0x10
NOTE_LOWAT = 0x1
NOTE_OOB = 0x4
NOTE_PCTRLMASK = 0xf0000000
NOTE_PDATAMASK = 0xfffff
NOTE_RENAME = 0x20
@ -1130,9 +1228,11 @@ const (
RTF_STATIC = 0x800
RTF_UP = 0x1
RTF_USETRAILERS = 0x8000
RTM_80211INFO = 0x15
RTM_ADD = 0x1
RTM_BFD = 0x12
RTM_CHANGE = 0x3
RTM_CHGADDRATTR = 0x14
RTM_DELADDR = 0xd
RTM_DELETE = 0x2
RTM_DESYNC = 0x10
@ -1140,7 +1240,6 @@ const (
RTM_IFANNOUNCE = 0xf
RTM_IFINFO = 0xe
RTM_INVALIDATE = 0x11
RTM_LOCK = 0x8
RTM_LOSING = 0x5
RTM_MAXSIZE = 0x800
RTM_MISS = 0x7
@ -1148,7 +1247,7 @@ const (
RTM_PROPOSAL = 0x13
RTM_REDIRECT = 0x6
RTM_RESOLVE = 0xb
RTM_RTTUNIT = 0xf4240
RTM_SOURCE = 0x16
RTM_VERSION = 0x5
RTV_EXPIRE = 0x4
RTV_HOPCOUNT = 0x2
@ -1166,6 +1265,9 @@ const (
RUSAGE_THREAD = 0x1
SCM_RIGHTS = 0x1
SCM_TIMESTAMP = 0x4
SEEK_CUR = 0x1
SEEK_END = 0x2
SEEK_SET = 0x0
SHUT_RD = 0x0
SHUT_RDWR = 0x2
SHUT_WR = 0x1
@ -1182,35 +1284,37 @@ const (
SIOCBRDGDELS = 0x80606942
SIOCBRDGFLUSH = 0x80606948
SIOCBRDGFRL = 0x808c694e
SIOCBRDGGCACHE = 0xc0186941
SIOCBRDGGFD = 0xc0186952
SIOCBRDGGHT = 0xc0186951
SIOCBRDGGCACHE = 0xc0146941
SIOCBRDGGFD = 0xc0146952
SIOCBRDGGHT = 0xc0146951
SIOCBRDGGIFFLGS = 0xc060693e
SIOCBRDGGMA = 0xc0186953
SIOCBRDGGMA = 0xc0146953
SIOCBRDGGPARAM = 0xc0406958
SIOCBRDGGPRI = 0xc0186950
SIOCBRDGGPRI = 0xc0146950
SIOCBRDGGRL = 0xc030694f
SIOCBRDGGTO = 0xc0186946
SIOCBRDGGTO = 0xc0146946
SIOCBRDGIFS = 0xc0606942
SIOCBRDGRTS = 0xc0206943
SIOCBRDGSADDR = 0xc1286944
SIOCBRDGSCACHE = 0x80186940
SIOCBRDGSFD = 0x80186952
SIOCBRDGSHT = 0x80186951
SIOCBRDGSCACHE = 0x80146940
SIOCBRDGSFD = 0x80146952
SIOCBRDGSHT = 0x80146951
SIOCBRDGSIFCOST = 0x80606955
SIOCBRDGSIFFLGS = 0x8060693f
SIOCBRDGSIFPRIO = 0x80606954
SIOCBRDGSIFPROT = 0x8060694a
SIOCBRDGSMA = 0x80186953
SIOCBRDGSPRI = 0x80186950
SIOCBRDGSPROTO = 0x8018695a
SIOCBRDGSTO = 0x80186945
SIOCBRDGSTXHC = 0x80186959
SIOCBRDGSMA = 0x80146953
SIOCBRDGSPRI = 0x80146950
SIOCBRDGSPROTO = 0x8014695a
SIOCBRDGSTO = 0x80146945
SIOCBRDGSTXHC = 0x80146959
SIOCDELLABEL = 0x80206997
SIOCDELMULTI = 0x80206932
SIOCDIFADDR = 0x80206919
SIOCDIFGROUP = 0x80286989
SIOCDIFPARENT = 0x802069b4
SIOCDIFPHYADDR = 0x80206949
SIOCDPWE3NEIGHBOR = 0x802069de
SIOCDVNETID = 0x802069af
SIOCGETKALIVE = 0xc01869a4
SIOCGETLABEL = 0x8020699a
@ -1229,6 +1333,7 @@ const (
SIOCGIFFLAGS = 0xc0206911
SIOCGIFGATTR = 0xc028698b
SIOCGIFGENERIC = 0xc020693a
SIOCGIFGLIST = 0xc028698d
SIOCGIFGMEMB = 0xc028698a
SIOCGIFGROUP = 0xc0286988
SIOCGIFHARDMTU = 0xc02069a5
@ -1243,13 +1348,21 @@ const (
SIOCGIFRDOMAIN = 0xc02069a0
SIOCGIFRTLABEL = 0xc0206983
SIOCGIFRXR = 0x802069aa
SIOCGIFSFFPAGE = 0xc1126939
SIOCGIFXFLAGS = 0xc020699e
SIOCGLIFPHYADDR = 0xc218694b
SIOCGLIFPHYDF = 0xc02069c2
SIOCGLIFPHYECN = 0xc02069c8
SIOCGLIFPHYRTABLE = 0xc02069a2
SIOCGLIFPHYTTL = 0xc02069a9
SIOCGPGRP = 0x40047309
SIOCGPWE3 = 0xc0206998
SIOCGPWE3CTRLWORD = 0xc02069dc
SIOCGPWE3FAT = 0xc02069dd
SIOCGPWE3NEIGHBOR = 0xc21869de
SIOCGRXHPRIO = 0xc02069db
SIOCGSPPPPARAMS = 0xc0206994
SIOCGTXHPRIO = 0xc02069c6
SIOCGUMBINFO = 0xc02069be
SIOCGUMBPARAM = 0xc02069c0
SIOCGVH = 0xc02069f6
@ -1287,19 +1400,20 @@ const (
SIOCSIFXFLAGS = 0x8020699d
SIOCSLIFPHYADDR = 0x8218694a
SIOCSLIFPHYDF = 0x802069c1
SIOCSLIFPHYECN = 0x802069c7
SIOCSLIFPHYRTABLE = 0x802069a1
SIOCSLIFPHYTTL = 0x802069a8
SIOCSPGRP = 0x80047308
SIOCSPWE3CTRLWORD = 0x802069dc
SIOCSPWE3FAT = 0x802069dd
SIOCSPWE3NEIGHBOR = 0x821869de
SIOCSRXHPRIO = 0x802069db
SIOCSSPPPPARAMS = 0x80206993
SIOCSTXHPRIO = 0x802069c5
SIOCSUMBPARAM = 0x802069bf
SIOCSVH = 0xc02069f5
SIOCSVNETFLOWID = 0x802069c3
SIOCSVNETID = 0x802069a6
SIOCSWGDPID = 0xc018695b
SIOCSWGMAXFLOW = 0xc0186960
SIOCSWGMAXGROUP = 0xc018695d
SIOCSWSDPID = 0x8018695c
SIOCSWSPORTNO = 0xc060695f
SOCK_CLOEXEC = 0x8000
SOCK_DGRAM = 0x2
SOCK_DNS = 0x1000
@ -1314,6 +1428,7 @@ const (
SO_BINDANY = 0x1000
SO_BROADCAST = 0x20
SO_DEBUG = 0x1
SO_DOMAIN = 0x1024
SO_DONTROUTE = 0x10
SO_ERROR = 0x1007
SO_KEEPALIVE = 0x8
@ -1321,6 +1436,7 @@ const (
SO_NETPROC = 0x1020
SO_OOBINLINE = 0x100
SO_PEERCRED = 0x1022
SO_PROTOCOL = 0x1025
SO_RCVBUF = 0x1002
SO_RCVLOWAT = 0x1004
SO_RCVTIMEO = 0x1006
@ -1370,7 +1486,18 @@ const (
TCOFLUSH = 0x2
TCOOFF = 0x1
TCOON = 0x2
TCP_MAXBURST = 0x4
TCPOPT_EOL = 0x0
TCPOPT_MAXSEG = 0x2
TCPOPT_NOP = 0x1
TCPOPT_SACK = 0x5
TCPOPT_SACK_HDR = 0x1010500
TCPOPT_SACK_PERMITTED = 0x4
TCPOPT_SACK_PERMIT_HDR = 0x1010402
TCPOPT_SIGNATURE = 0x13
TCPOPT_TIMESTAMP = 0x8
TCPOPT_TSTAMP_HDR = 0x101080a
TCPOPT_WINDOW = 0x3
TCP_INFO = 0x9
TCP_MAXSEG = 0x2
TCP_MAXWIN = 0xffff
TCP_MAX_SACK = 0x3
@ -1379,8 +1506,11 @@ const (
TCP_MSS = 0x200
TCP_NODELAY = 0x1
TCP_NOPUSH = 0x10
TCP_SACKHOLE_LIMIT = 0x80
TCP_SACK_ENABLE = 0x8
TCSAFLUSH = 0x2
TIMER_ABSTIME = 0x1
TIMER_RELTIME = 0x0
TIOCCBRK = 0x2000747a
TIOCCDTR = 0x20007478
TIOCCHKVERAUTH = 0x2000741e
@ -1445,7 +1575,6 @@ const (
TIOCSPGRP = 0x80047476
TIOCSTART = 0x2000746e
TIOCSTAT = 0x20007465
TIOCSTI = 0x80017472
TIOCSTOP = 0x2000746f
TIOCSTSTAMP = 0x8008745a
TIOCSWINSZ = 0x80087467
@ -1467,7 +1596,8 @@ const (
VMIN = 0x10
VM_ANONMIN = 0x7
VM_LOADAVG = 0x2
VM_MAXID = 0xc
VM_MALLOC_CONF = 0xc
VM_MAXID = 0xd
VM_MAXSLP = 0xa
VM_METER = 0x1
VM_NKMEMPAGES = 0x6
@ -1745,7 +1875,7 @@ var signalList = [...]struct {
{3, "SIGQUIT", "quit"},
{4, "SIGILL", "illegal instruction"},
{5, "SIGTRAP", "trace/BPT trap"},
{6, "SIGABRT", "abort trap"},
{6, "SIGIOT", "abort trap"},
{7, "SIGEMT", "EMT trap"},
{8, "SIGFPE", "floating point exception"},
{9, "SIGKILL", "killed"},
@ -1772,4 +1902,5 @@ var signalList = [...]struct {
{30, "SIGUSR1", "user defined signal 1"},
{31, "SIGUSR2", "user defined signal 2"},
{32, "SIGTHR", "thread AST"},
{28672, "SIGSTKSZ", "unknown signal"},
}

View File

@ -46,6 +46,7 @@ const (
AF_SNA = 0xb
AF_UNIX = 0x1
AF_UNSPEC = 0x0
ALTWERASE = 0x200
ARPHRD_ETHER = 0x1
ARPHRD_FRELAY = 0xf
ARPHRD_IEEE1394 = 0x18
@ -82,7 +83,7 @@ const (
BIOCGFILDROP = 0x40044278
BIOCGHDRCMPLT = 0x40044274
BIOCGRSIG = 0x40044273
BIOCGRTIMEOUT = 0x400c426e
BIOCGRTIMEOUT = 0x4010426e
BIOCGSTATS = 0x4008426f
BIOCIMMEDIATE = 0x80044270
BIOCLOCK = 0x20004276
@ -96,7 +97,7 @@ const (
BIOCSFILDROP = 0x80044279
BIOCSHDRCMPLT = 0x80044275
BIOCSRSIG = 0x80044272
BIOCSRTIMEOUT = 0x800c426d
BIOCSRTIMEOUT = 0x8010426d
BIOCVERSION = 0x40044271
BPF_A = 0x10
BPF_ABS = 0x20
@ -108,6 +109,15 @@ const (
BPF_DIRECTION_IN = 0x1
BPF_DIRECTION_OUT = 0x2
BPF_DIV = 0x30
BPF_FILDROP_CAPTURE = 0x1
BPF_FILDROP_DROP = 0x2
BPF_FILDROP_PASS = 0x0
BPF_F_DIR_IN = 0x10
BPF_F_DIR_MASK = 0x30
BPF_F_DIR_OUT = 0x20
BPF_F_DIR_SHIFT = 0x4
BPF_F_FLOWID = 0x8
BPF_F_PRI_MASK = 0x7
BPF_H = 0x8
BPF_IMM = 0x0
BPF_IND = 0x40
@ -136,6 +146,7 @@ const (
BPF_OR = 0x40
BPF_RELEASE = 0x30bb6
BPF_RET = 0x6
BPF_RND = 0xc0
BPF_RSH = 0x70
BPF_ST = 0x2
BPF_STX = 0x3
@ -147,6 +158,12 @@ const (
BRKINT = 0x2
CFLUSH = 0xf
CLOCAL = 0x8000
CLOCK_BOOTTIME = 0x6
CLOCK_MONOTONIC = 0x3
CLOCK_PROCESS_CPUTIME_ID = 0x2
CLOCK_REALTIME = 0x0
CLOCK_THREAD_CPUTIME_ID = 0x4
CLOCK_UPTIME = 0x5
CPUSTATES = 0x6
CP_IDLE = 0x5
CP_INTR = 0x4
@ -170,7 +187,65 @@ const (
CTL_KERN = 0x1
CTL_MAXNAME = 0xc
CTL_NET = 0x4
DIOCADDQUEUE = 0xc100445d
DIOCADDRULE = 0xcce04404
DIOCADDSTATE = 0xc1084425
DIOCCHANGERULE = 0xcce0441a
DIOCCLRIFFLAG = 0xc024445a
DIOCCLRSRCNODES = 0x20004455
DIOCCLRSTATES = 0xc0d04412
DIOCCLRSTATUS = 0xc0244416
DIOCGETLIMIT = 0xc0084427
DIOCGETQSTATS = 0xc1084460
DIOCGETQUEUE = 0xc100445f
DIOCGETQUEUES = 0xc100445e
DIOCGETRULE = 0xcce04407
DIOCGETRULES = 0xcce04406
DIOCGETRULESET = 0xc444443b
DIOCGETRULESETS = 0xc444443a
DIOCGETSRCNODES = 0xc0084454
DIOCGETSTATE = 0xc1084413
DIOCGETSTATES = 0xc0084419
DIOCGETSTATUS = 0xc1e84415
DIOCGETSYNFLWATS = 0xc0084463
DIOCGETTIMEOUT = 0xc008441e
DIOCIGETIFACES = 0xc0244457
DIOCKILLSRCNODES = 0xc068445b
DIOCKILLSTATES = 0xc0d04429
DIOCNATLOOK = 0xc0504417
DIOCOSFPADD = 0xc088444f
DIOCOSFPFLUSH = 0x2000444e
DIOCOSFPGET = 0xc0884450
DIOCRADDADDRS = 0xc44c4443
DIOCRADDTABLES = 0xc44c443d
DIOCRCLRADDRS = 0xc44c4442
DIOCRCLRASTATS = 0xc44c4448
DIOCRCLRTABLES = 0xc44c443c
DIOCRCLRTSTATS = 0xc44c4441
DIOCRDELADDRS = 0xc44c4444
DIOCRDELTABLES = 0xc44c443e
DIOCRGETADDRS = 0xc44c4446
DIOCRGETASTATS = 0xc44c4447
DIOCRGETTABLES = 0xc44c443f
DIOCRGETTSTATS = 0xc44c4440
DIOCRINADEFINE = 0xc44c444d
DIOCRSETADDRS = 0xc44c4445
DIOCRSETTFLAGS = 0xc44c444a
DIOCRTSTADDRS = 0xc44c4449
DIOCSETDEBUG = 0xc0044418
DIOCSETHOSTID = 0xc0044456
DIOCSETIFFLAG = 0xc0244459
DIOCSETLIMIT = 0xc0084428
DIOCSETREASS = 0xc004445c
DIOCSETSTATUSIF = 0xc0244414
DIOCSETSYNCOOKIES = 0xc0014462
DIOCSETSYNFLWATS = 0xc0084461
DIOCSETTIMEOUT = 0xc008441d
DIOCSTART = 0x20004401
DIOCSTOP = 0x20004402
DIOCXBEGIN = 0xc00c4451
DIOCXCOMMIT = 0xc00c4452
DIOCXROLLBACK = 0xc00c4453
DLT_ARCNET = 0x7
DLT_ATM_RFC1483 = 0xb
DLT_AX25 = 0x3
@ -186,6 +261,7 @@ const (
DLT_LOOP = 0xc
DLT_MPLS = 0xdb
DLT_NULL = 0x0
DLT_OPENFLOW = 0x10b
DLT_PFLOG = 0x75
DLT_PFSYNC = 0x12
DLT_PPP = 0x9
@ -196,6 +272,23 @@ const (
DLT_RAW = 0xe
DLT_SLIP = 0x8
DLT_SLIP_BSDOS = 0xf
DLT_USBPCAP = 0xf9
DLT_USER0 = 0x93
DLT_USER1 = 0x94
DLT_USER10 = 0x9d
DLT_USER11 = 0x9e
DLT_USER12 = 0x9f
DLT_USER13 = 0xa0
DLT_USER14 = 0xa1
DLT_USER15 = 0xa2
DLT_USER2 = 0x95
DLT_USER3 = 0x96
DLT_USER4 = 0x97
DLT_USER5 = 0x98
DLT_USER6 = 0x99
DLT_USER7 = 0x9a
DLT_USER8 = 0x9b
DLT_USER9 = 0x9c
DT_BLK = 0x6
DT_CHR = 0x2
DT_DIR = 0x4
@ -215,6 +308,8 @@ const (
EMUL_ENABLED = 0x1
EMUL_NATIVE = 0x2
ENDRUNDISC = 0x9
ETH64_8021_RSVD_MASK = 0xfffffffffff0
ETH64_8021_RSVD_PREFIX = 0x180c2000000
ETHERMIN = 0x2e
ETHERMTU = 0x5dc
ETHERTYPE_8023 = 0x4
@ -267,6 +362,7 @@ const (
ETHERTYPE_DN = 0x6003
ETHERTYPE_DOGFIGHT = 0x1989
ETHERTYPE_DSMD = 0x8039
ETHERTYPE_EAPOL = 0x888e
ETHERTYPE_ECMA = 0x803
ETHERTYPE_ENCRYPT = 0x803d
ETHERTYPE_ES = 0x805d
@ -298,6 +394,7 @@ const (
ETHERTYPE_LLDP = 0x88cc
ETHERTYPE_LOGICRAFT = 0x8148
ETHERTYPE_LOOPBACK = 0x9000
ETHERTYPE_MACSEC = 0x88e5
ETHERTYPE_MATRA = 0x807a
ETHERTYPE_MAX = 0xffff
ETHERTYPE_MERIT = 0x807c
@ -326,15 +423,17 @@ const (
ETHERTYPE_NCD = 0x8149
ETHERTYPE_NESTAR = 0x8006
ETHERTYPE_NETBEUI = 0x8191
ETHERTYPE_NHRP = 0x2001
ETHERTYPE_NOVELL = 0x8138
ETHERTYPE_NS = 0x600
ETHERTYPE_NSAT = 0x601
ETHERTYPE_NSCOMPAT = 0x807
ETHERTYPE_NSH = 0x984f
ETHERTYPE_NTRAILER = 0x10
ETHERTYPE_OS9 = 0x7007
ETHERTYPE_OS9NET = 0x7009
ETHERTYPE_PACER = 0x80c6
ETHERTYPE_PAE = 0x888e
ETHERTYPE_PBB = 0x88e7
ETHERTYPE_PCS = 0x4242
ETHERTYPE_PLANNING = 0x8044
ETHERTYPE_PPP = 0x880b
@ -409,28 +508,40 @@ const (
ETHER_CRC_POLY_LE = 0xedb88320
ETHER_HDR_LEN = 0xe
ETHER_MAX_DIX_LEN = 0x600
ETHER_MAX_HARDMTU_LEN = 0xff9b
ETHER_MAX_LEN = 0x5ee
ETHER_MIN_LEN = 0x40
ETHER_TYPE_LEN = 0x2
ETHER_VLAN_ENCAP_LEN = 0x4
EVFILT_AIO = -0x3
EVFILT_DEVICE = -0x8
EVFILT_EXCEPT = -0x9
EVFILT_PROC = -0x5
EVFILT_READ = -0x1
EVFILT_SIGNAL = -0x6
EVFILT_SYSCOUNT = 0x7
EVFILT_SYSCOUNT = 0x9
EVFILT_TIMER = -0x7
EVFILT_VNODE = -0x4
EVFILT_WRITE = -0x2
EVL_ENCAPLEN = 0x4
EVL_PRIO_BITS = 0xd
EVL_PRIO_MAX = 0x7
EVL_VLID_MASK = 0xfff
EVL_VLID_MAX = 0xffe
EVL_VLID_MIN = 0x1
EVL_VLID_NULL = 0x0
EV_ADD = 0x1
EV_CLEAR = 0x20
EV_DELETE = 0x2
EV_DISABLE = 0x8
EV_DISPATCH = 0x80
EV_ENABLE = 0x4
EV_EOF = 0x8000
EV_ERROR = 0x4000
EV_FLAG1 = 0x2000
EV_ONESHOT = 0x10
EV_SYSFLAGS = 0xf000
EV_RECEIPT = 0x40
EV_SYSFLAGS = 0xf800
EXTA = 0x4b00
EXTB = 0x9600
EXTPROC = 0x800
@ -443,6 +554,8 @@ const (
F_GETFL = 0x3
F_GETLK = 0x7
F_GETOWN = 0x5
F_ISATTY = 0xb
F_OK = 0x0
F_RDLCK = 0x1
F_SETFD = 0x2
F_SETFL = 0x4
@ -459,7 +572,6 @@ const (
IEXTEN = 0x400
IFAN_ARRIVAL = 0x0
IFAN_DEPARTURE = 0x1
IFA_ROUTE = 0x1
IFF_ALLMULTI = 0x200
IFF_BROADCAST = 0x2
IFF_CANTCHANGE = 0x8e52
@ -470,12 +582,12 @@ const (
IFF_LOOPBACK = 0x8
IFF_MULTICAST = 0x8000
IFF_NOARP = 0x80
IFF_NOTRAILERS = 0x20
IFF_OACTIVE = 0x400
IFF_POINTOPOINT = 0x10
IFF_PROMISC = 0x100
IFF_RUNNING = 0x40
IFF_SIMPLEX = 0x800
IFF_STATICARP = 0x20
IFF_UP = 0x1
IFNAMSIZ = 0x10
IFT_1822 = 0x2
@ -604,6 +716,7 @@ const (
IFT_LINEGROUP = 0xd2
IFT_LOCALTALK = 0x2a
IFT_LOOP = 0x18
IFT_MBIM = 0xfa
IFT_MEDIAMAILOVERIP = 0x8b
IFT_MFSIGLINK = 0xa7
IFT_MIOX25 = 0x26
@ -694,6 +807,7 @@ const (
IFT_VOICEOVERCABLE = 0xc6
IFT_VOICEOVERFRAMERELAY = 0x99
IFT_VOICEOVERIP = 0x68
IFT_WIREGUARD = 0xfb
IFT_X213 = 0x5d
IFT_X25 = 0x5
IFT_X25DDN = 0x4
@ -728,8 +842,6 @@ const (
IPPROTO_AH = 0x33
IPPROTO_CARP = 0x70
IPPROTO_DIVERT = 0x102
IPPROTO_DIVERT_INIT = 0x2
IPPROTO_DIVERT_RESP = 0x1
IPPROTO_DONE = 0x101
IPPROTO_DSTOPTS = 0x3c
IPPROTO_EGP = 0x8
@ -761,9 +873,11 @@ const (
IPPROTO_RAW = 0xff
IPPROTO_ROUTING = 0x2b
IPPROTO_RSVP = 0x2e
IPPROTO_SCTP = 0x84
IPPROTO_TCP = 0x6
IPPROTO_TP = 0x1d
IPPROTO_UDP = 0x11
IPPROTO_UDPLITE = 0x88
IPV6_AUTH_LEVEL = 0x35
IPV6_AUTOFLOWLABEL = 0x3b
IPV6_CHECKSUM = 0x1a
@ -786,6 +900,7 @@ const (
IPV6_LEAVE_GROUP = 0xd
IPV6_MAXHLIM = 0xff
IPV6_MAXPACKET = 0xffff
IPV6_MINHOPCOUNT = 0x41
IPV6_MMTU = 0x500
IPV6_MULTICAST_HOPS = 0xa
IPV6_MULTICAST_IF = 0x9
@ -825,12 +940,12 @@ const (
IP_DEFAULT_MULTICAST_LOOP = 0x1
IP_DEFAULT_MULTICAST_TTL = 0x1
IP_DF = 0x4000
IP_DIVERTFL = 0x1022
IP_DROP_MEMBERSHIP = 0xd
IP_ESP_NETWORK_LEVEL = 0x16
IP_ESP_TRANS_LEVEL = 0x15
IP_HDRINCL = 0x2
IP_IPCOMP_LEVEL = 0x1d
IP_IPDEFTTL = 0x25
IP_IPSECFLOWINFO = 0x24
IP_IPSEC_LOCAL_AUTH = 0x1b
IP_IPSEC_LOCAL_CRED = 0x19
@ -864,10 +979,15 @@ const (
IP_RETOPTS = 0x8
IP_RF = 0x8000
IP_RTABLE = 0x1021
IP_SENDSRCADDR = 0x7
IP_TOS = 0x3
IP_TTL = 0x4
ISIG = 0x80
ISTRIP = 0x20
ITIMER_PROF = 0x2
ITIMER_REAL = 0x0
ITIMER_VIRTUAL = 0x1
IUCLC = 0x1000
IXANY = 0x800
IXOFF = 0x400
IXON = 0x200
@ -922,6 +1042,7 @@ const (
MNT_NOATIME = 0x8000
MNT_NODEV = 0x10
MNT_NOEXEC = 0x4
MNT_NOPERM = 0x20
MNT_NOSUID = 0x8
MNT_NOWAIT = 0x2
MNT_QUOTA = 0x2000
@ -929,12 +1050,27 @@ const (
MNT_RELOAD = 0x40000
MNT_ROOTFS = 0x4000
MNT_SOFTDEP = 0x4000000
MNT_STALLED = 0x100000
MNT_SWAPPABLE = 0x200000
MNT_SYNCHRONOUS = 0x2
MNT_UPDATE = 0x10000
MNT_VISFLAGMASK = 0x400ffff
MNT_WAIT = 0x1
MNT_WANTRDWR = 0x2000000
MNT_WXALLOWED = 0x800
MOUNT_AFS = "afs"
MOUNT_CD9660 = "cd9660"
MOUNT_EXT2FS = "ext2fs"
MOUNT_FFS = "ffs"
MOUNT_FUSEFS = "fuse"
MOUNT_MFS = "mfs"
MOUNT_MSDOS = "msdos"
MOUNT_NCPFS = "ncpfs"
MOUNT_NFS = "nfs"
MOUNT_NTFS = "ntfs"
MOUNT_TMPFS = "tmpfs"
MOUNT_UDF = "udf"
MOUNT_UFS = "ffs"
MSG_BCAST = 0x100
MSG_CMSG_CLOEXEC = 0x800
MSG_CTRUNC = 0x20
@ -947,6 +1083,7 @@ const (
MSG_PEEK = 0x2
MSG_TRUNC = 0x10
MSG_WAITALL = 0x40
MSG_WAITFORONE = 0x1000
MS_ASYNC = 0x1
MS_INVALIDATE = 0x4
MS_SYNC = 0x2
@ -954,12 +1091,16 @@ const (
NET_RT_DUMP = 0x1
NET_RT_FLAGS = 0x2
NET_RT_IFLIST = 0x3
NET_RT_MAXID = 0x6
NET_RT_IFNAMES = 0x6
NET_RT_MAXID = 0x8
NET_RT_SOURCE = 0x7
NET_RT_STATS = 0x4
NET_RT_TABLE = 0x5
NFDBITS = 0x20
NOFLSH = 0x80000000
NOKERNINFO = 0x2000000
NOTE_ATTRIB = 0x8
NOTE_CHANGE = 0x1
NOTE_CHILD = 0x4
NOTE_DELETE = 0x1
NOTE_EOF = 0x2
@ -969,6 +1110,7 @@ const (
NOTE_FORK = 0x40000000
NOTE_LINK = 0x10
NOTE_LOWAT = 0x1
NOTE_OOB = 0x4
NOTE_PCTRLMASK = 0xf0000000
NOTE_PDATAMASK = 0xfffff
NOTE_RENAME = 0x20
@ -978,11 +1120,13 @@ const (
NOTE_TRUNCATE = 0x80
NOTE_WRITE = 0x2
OCRNL = 0x10
OLCUC = 0x20
ONLCR = 0x2
ONLRET = 0x80
ONOCR = 0x40
ONOEOT = 0x8
OPOST = 0x1
OXTABS = 0x4
O_ACCMODE = 0x3
O_APPEND = 0x8
O_ASYNC = 0x40
@ -1027,19 +1171,25 @@ const (
RLIMIT_STACK = 0x3
RLIM_INFINITY = 0x7fffffffffffffff
RTAX_AUTHOR = 0x6
RTAX_BFD = 0xb
RTAX_BRD = 0x7
RTAX_DNS = 0xc
RTAX_DST = 0x0
RTAX_GATEWAY = 0x1
RTAX_GENMASK = 0x3
RTAX_IFA = 0x5
RTAX_IFP = 0x4
RTAX_LABEL = 0xa
RTAX_MAX = 0xb
RTAX_MAX = 0xf
RTAX_NETMASK = 0x2
RTAX_SEARCH = 0xe
RTAX_SRC = 0x8
RTAX_SRCMASK = 0x9
RTAX_STATIC = 0xd
RTA_AUTHOR = 0x40
RTA_BFD = 0x800
RTA_BRD = 0x80
RTA_DNS = 0x1000
RTA_DST = 0x1
RTA_GATEWAY = 0x2
RTA_GENMASK = 0x8
@ -1047,24 +1197,29 @@ const (
RTA_IFP = 0x10
RTA_LABEL = 0x400
RTA_NETMASK = 0x4
RTA_SEARCH = 0x4000
RTA_SRC = 0x100
RTA_SRCMASK = 0x200
RTA_STATIC = 0x2000
RTF_ANNOUNCE = 0x4000
RTF_BFD = 0x1000000
RTF_BLACKHOLE = 0x1000
RTF_BROADCAST = 0x400000
RTF_CACHED = 0x20000
RTF_CLONED = 0x10000
RTF_CLONING = 0x100
RTF_CONNECTED = 0x800000
RTF_DONE = 0x40
RTF_DYNAMIC = 0x10
RTF_FMASK = 0x70f808
RTF_FMASK = 0x110fc08
RTF_GATEWAY = 0x2
RTF_HOST = 0x4
RTF_LLINFO = 0x400
RTF_LOCAL = 0x200000
RTF_MASK = 0x80
RTF_MODIFIED = 0x20
RTF_MPATH = 0x40000
RTF_MPLS = 0x100000
RTF_MULTICAST = 0x200
RTF_PERMANENT_ARP = 0x2000
RTF_PROTO1 = 0x8000
RTF_PROTO2 = 0x4000
@ -1073,23 +1228,26 @@ const (
RTF_STATIC = 0x800
RTF_UP = 0x1
RTF_USETRAILERS = 0x8000
RTF_XRESOLVE = 0x200
RTM_80211INFO = 0x15
RTM_ADD = 0x1
RTM_BFD = 0x12
RTM_CHANGE = 0x3
RTM_CHGADDRATTR = 0x14
RTM_DELADDR = 0xd
RTM_DELETE = 0x2
RTM_DESYNC = 0x10
RTM_GET = 0x4
RTM_IFANNOUNCE = 0xf
RTM_IFINFO = 0xe
RTM_LOCK = 0x8
RTM_INVALIDATE = 0x11
RTM_LOSING = 0x5
RTM_MAXSIZE = 0x800
RTM_MISS = 0x7
RTM_NEWADDR = 0xc
RTM_PROPOSAL = 0x13
RTM_REDIRECT = 0x6
RTM_RESOLVE = 0xb
RTM_RTTUNIT = 0xf4240
RTM_SOURCE = 0x16
RTM_VERSION = 0x5
RTV_EXPIRE = 0x4
RTV_HOPCOUNT = 0x2
@ -1099,67 +1257,74 @@ const (
RTV_RTTVAR = 0x80
RTV_SPIPE = 0x10
RTV_SSTHRESH = 0x20
RT_TABLEID_BITS = 0x8
RT_TABLEID_MASK = 0xff
RT_TABLEID_MAX = 0xff
RUSAGE_CHILDREN = -0x1
RUSAGE_SELF = 0x0
RUSAGE_THREAD = 0x1
SCM_RIGHTS = 0x1
SCM_TIMESTAMP = 0x4
SEEK_CUR = 0x1
SEEK_END = 0x2
SEEK_SET = 0x0
SHUT_RD = 0x0
SHUT_RDWR = 0x2
SHUT_WR = 0x1
SIOCADDMULTI = 0x80206931
SIOCAIFADDR = 0x8040691a
SIOCAIFGROUP = 0x80246987
SIOCALIFADDR = 0x8218691c
SIOCATMARK = 0x40047307
SIOCBRDGADD = 0x8054693c
SIOCBRDGADDS = 0x80546941
SIOCBRDGARL = 0x806e694d
SIOCBRDGADD = 0x8060693c
SIOCBRDGADDL = 0x80606949
SIOCBRDGADDS = 0x80606941
SIOCBRDGARL = 0x808c694d
SIOCBRDGDADDR = 0x81286947
SIOCBRDGDEL = 0x8054693d
SIOCBRDGDELS = 0x80546942
SIOCBRDGFLUSH = 0x80546948
SIOCBRDGFRL = 0x806e694e
SIOCBRDGDEL = 0x8060693d
SIOCBRDGDELS = 0x80606942
SIOCBRDGFLUSH = 0x80606948
SIOCBRDGFRL = 0x808c694e
SIOCBRDGGCACHE = 0xc0146941
SIOCBRDGGFD = 0xc0146952
SIOCBRDGGHT = 0xc0146951
SIOCBRDGGIFFLGS = 0xc054693e
SIOCBRDGGIFFLGS = 0xc060693e
SIOCBRDGGMA = 0xc0146953
SIOCBRDGGPARAM = 0xc03c6958
SIOCBRDGGPARAM = 0xc0406958
SIOCBRDGGPRI = 0xc0146950
SIOCBRDGGRL = 0xc028694f
SIOCBRDGGSIFS = 0xc054693c
SIOCBRDGGTO = 0xc0146946
SIOCBRDGIFS = 0xc0546942
SIOCBRDGIFS = 0xc0606942
SIOCBRDGRTS = 0xc0186943
SIOCBRDGSADDR = 0xc1286944
SIOCBRDGSCACHE = 0x80146940
SIOCBRDGSFD = 0x80146952
SIOCBRDGSHT = 0x80146951
SIOCBRDGSIFCOST = 0x80546955
SIOCBRDGSIFFLGS = 0x8054693f
SIOCBRDGSIFPRIO = 0x80546954
SIOCBRDGSIFCOST = 0x80606955
SIOCBRDGSIFFLGS = 0x8060693f
SIOCBRDGSIFPRIO = 0x80606954
SIOCBRDGSIFPROT = 0x8060694a
SIOCBRDGSMA = 0x80146953
SIOCBRDGSPRI = 0x80146950
SIOCBRDGSPROTO = 0x8014695a
SIOCBRDGSTO = 0x80146945
SIOCBRDGSTXHC = 0x80146959
SIOCDELLABEL = 0x80206997
SIOCDELMULTI = 0x80206932
SIOCDIFADDR = 0x80206919
SIOCDIFGROUP = 0x80246989
SIOCDIFPARENT = 0x802069b4
SIOCDIFPHYADDR = 0x80206949
SIOCDLIFADDR = 0x8218691e
SIOCDPWE3NEIGHBOR = 0x802069de
SIOCDVNETID = 0x802069af
SIOCGETKALIVE = 0xc01869a4
SIOCGETLABEL = 0x8020699a
SIOCGETMPWCFG = 0xc02069ae
SIOCGETPFLOW = 0xc02069fe
SIOCGETPFSYNC = 0xc02069f8
SIOCGETSGCNT = 0xc0147534
SIOCGETVIFCNT = 0xc0147533
SIOCGETVLAN = 0xc0206990
SIOCGHIWAT = 0x40047301
SIOCGIFADDR = 0xc0206921
SIOCGIFASYNCMAP = 0xc020697c
SIOCGIFBRDADDR = 0xc0206923
SIOCGIFCONF = 0xc0086924
SIOCGIFDATA = 0xc020691b
@ -1168,41 +1333,53 @@ const (
SIOCGIFFLAGS = 0xc0206911
SIOCGIFGATTR = 0xc024698b
SIOCGIFGENERIC = 0xc020693a
SIOCGIFGLIST = 0xc024698d
SIOCGIFGMEMB = 0xc024698a
SIOCGIFGROUP = 0xc0246988
SIOCGIFHARDMTU = 0xc02069a5
SIOCGIFMEDIA = 0xc0286936
SIOCGIFLLPRIO = 0xc02069b6
SIOCGIFMEDIA = 0xc0386938
SIOCGIFMETRIC = 0xc0206917
SIOCGIFMTU = 0xc020697e
SIOCGIFNETMASK = 0xc0206925
SIOCGIFPDSTADDR = 0xc0206948
SIOCGIFPAIR = 0xc02069b1
SIOCGIFPARENT = 0xc02069b3
SIOCGIFPRIORITY = 0xc020699c
SIOCGIFPSRCADDR = 0xc0206947
SIOCGIFRDOMAIN = 0xc02069a0
SIOCGIFRTLABEL = 0xc0206983
SIOCGIFRXR = 0x802069aa
SIOCGIFTIMESLOT = 0xc0206986
SIOCGIFSFFPAGE = 0xc1126939
SIOCGIFXFLAGS = 0xc020699e
SIOCGLIFADDR = 0xc218691d
SIOCGLIFPHYADDR = 0xc218694b
SIOCGLIFPHYDF = 0xc02069c2
SIOCGLIFPHYECN = 0xc02069c8
SIOCGLIFPHYRTABLE = 0xc02069a2
SIOCGLIFPHYTTL = 0xc02069a9
SIOCGLOWAT = 0x40047303
SIOCGPGRP = 0x40047309
SIOCGPWE3 = 0xc0206998
SIOCGPWE3CTRLWORD = 0xc02069dc
SIOCGPWE3FAT = 0xc02069dd
SIOCGPWE3NEIGHBOR = 0xc21869de
SIOCGRXHPRIO = 0xc02069db
SIOCGSPPPPARAMS = 0xc0206994
SIOCGTXHPRIO = 0xc02069c6
SIOCGUMBINFO = 0xc02069be
SIOCGUMBPARAM = 0xc02069c0
SIOCGVH = 0xc02069f6
SIOCGVNETFLOWID = 0xc02069c4
SIOCGVNETID = 0xc02069a7
SIOCIFAFATTACH = 0x801169ab
SIOCIFAFDETACH = 0x801169ac
SIOCIFCREATE = 0x8020697a
SIOCIFDESTROY = 0x80206979
SIOCIFGCLONERS = 0xc00c6978
SIOCSETKALIVE = 0x801869a3
SIOCSETLABEL = 0x80206999
SIOCSETMPWCFG = 0x802069ad
SIOCSETPFLOW = 0x802069fd
SIOCSETPFSYNC = 0x802069f7
SIOCSETVLAN = 0x8020698f
SIOCSHIWAT = 0x80047300
SIOCSIFADDR = 0x8020690c
SIOCSIFASYNCMAP = 0x8020697d
SIOCSIFBRDADDR = 0x80206913
SIOCSIFDESCR = 0x80206980
SIOCSIFDSTADDR = 0x8020690e
@ -1210,26 +1387,36 @@ const (
SIOCSIFGATTR = 0x8024698c
SIOCSIFGENERIC = 0x80206939
SIOCSIFLLADDR = 0x8020691f
SIOCSIFMEDIA = 0xc0206935
SIOCSIFLLPRIO = 0x802069b5
SIOCSIFMEDIA = 0xc0206937
SIOCSIFMETRIC = 0x80206918
SIOCSIFMTU = 0x8020697f
SIOCSIFNETMASK = 0x80206916
SIOCSIFPHYADDR = 0x80406946
SIOCSIFPAIR = 0x802069b0
SIOCSIFPARENT = 0x802069b2
SIOCSIFPRIORITY = 0x8020699b
SIOCSIFRDOMAIN = 0x8020699f
SIOCSIFRTLABEL = 0x80206982
SIOCSIFTIMESLOT = 0x80206985
SIOCSIFXFLAGS = 0x8020699d
SIOCSLIFPHYADDR = 0x8218694a
SIOCSLIFPHYDF = 0x802069c1
SIOCSLIFPHYECN = 0x802069c7
SIOCSLIFPHYRTABLE = 0x802069a1
SIOCSLIFPHYTTL = 0x802069a8
SIOCSLOWAT = 0x80047302
SIOCSPGRP = 0x80047308
SIOCSPWE3CTRLWORD = 0x802069dc
SIOCSPWE3FAT = 0x802069dd
SIOCSPWE3NEIGHBOR = 0x821869de
SIOCSRXHPRIO = 0x802069db
SIOCSSPPPPARAMS = 0x80206993
SIOCSTXHPRIO = 0x802069c5
SIOCSUMBPARAM = 0x802069bf
SIOCSVH = 0xc02069f5
SIOCSVNETFLOWID = 0x802069c3
SIOCSVNETID = 0x802069a6
SOCK_CLOEXEC = 0x8000
SOCK_DGRAM = 0x2
SOCK_DNS = 0x1000
SOCK_NONBLOCK = 0x4000
SOCK_RAW = 0x3
SOCK_RDM = 0x4
@ -1241,6 +1428,7 @@ const (
SO_BINDANY = 0x1000
SO_BROADCAST = 0x20
SO_DEBUG = 0x1
SO_DOMAIN = 0x1024
SO_DONTROUTE = 0x10
SO_ERROR = 0x1007
SO_KEEPALIVE = 0x8
@ -1248,6 +1436,7 @@ const (
SO_NETPROC = 0x1020
SO_OOBINLINE = 0x100
SO_PEERCRED = 0x1022
SO_PROTOCOL = 0x1025
SO_RCVBUF = 0x1002
SO_RCVLOWAT = 0x1004
SO_RCVTIMEO = 0x1006
@ -1261,6 +1450,7 @@ const (
SO_TIMESTAMP = 0x800
SO_TYPE = 0x1008
SO_USELOOPBACK = 0x40
SO_ZEROIZE = 0x2000
S_BLKSIZE = 0x200
S_IEXEC = 0x40
S_IFBLK = 0x6000
@ -1290,9 +1480,24 @@ const (
S_IXOTH = 0x1
S_IXUSR = 0x40
TCIFLUSH = 0x1
TCIOFF = 0x3
TCIOFLUSH = 0x3
TCION = 0x4
TCOFLUSH = 0x2
TCP_MAXBURST = 0x4
TCOOFF = 0x1
TCOON = 0x2
TCPOPT_EOL = 0x0
TCPOPT_MAXSEG = 0x2
TCPOPT_NOP = 0x1
TCPOPT_SACK = 0x5
TCPOPT_SACK_HDR = 0x1010500
TCPOPT_SACK_PERMITTED = 0x4
TCPOPT_SACK_PERMIT_HDR = 0x1010402
TCPOPT_SIGNATURE = 0x13
TCPOPT_TIMESTAMP = 0x8
TCPOPT_TSTAMP_HDR = 0x101080a
TCPOPT_WINDOW = 0x3
TCP_INFO = 0x9
TCP_MAXSEG = 0x2
TCP_MAXWIN = 0xffff
TCP_MAX_SACK = 0x3
@ -1301,11 +1506,15 @@ const (
TCP_MSS = 0x200
TCP_NODELAY = 0x1
TCP_NOPUSH = 0x10
TCP_NSTATES = 0xb
TCP_SACKHOLE_LIMIT = 0x80
TCP_SACK_ENABLE = 0x8
TCSAFLUSH = 0x2
TIMER_ABSTIME = 0x1
TIMER_RELTIME = 0x0
TIOCCBRK = 0x2000747a
TIOCCDTR = 0x20007478
TIOCCHKVERAUTH = 0x2000741e
TIOCCLRVERAUTH = 0x2000741d
TIOCCONS = 0x80047462
TIOCDRAIN = 0x2000745e
TIOCEXCL = 0x2000740d
@ -1321,7 +1530,7 @@ const (
TIOCGFLAGS = 0x4004745d
TIOCGPGRP = 0x40047477
TIOCGSID = 0x40047463
TIOCGTSTAMP = 0x400c745b
TIOCGTSTAMP = 0x4010745b
TIOCGWINSZ = 0x40087468
TIOCMBIC = 0x8004746b
TIOCMBIS = 0x8004746c
@ -1360,17 +1569,21 @@ const (
TIOCSETAF = 0x802c7416
TIOCSETAW = 0x802c7415
TIOCSETD = 0x8004741b
TIOCSETVERAUTH = 0x8004741c
TIOCSFLAGS = 0x8004745c
TIOCSIG = 0x8004745f
TIOCSPGRP = 0x80047476
TIOCSTART = 0x2000746e
TIOCSTAT = 0x80047465
TIOCSTI = 0x80017472
TIOCSTAT = 0x20007465
TIOCSTOP = 0x2000746f
TIOCSTSTAMP = 0x8008745a
TIOCSWINSZ = 0x80087467
TIOCUCNTL = 0x80047466
TIOCUCNTL_CBRK = 0x7a
TIOCUCNTL_SBRK = 0x7b
TOSTOP = 0x400000
UTIME_NOW = -0x2
UTIME_OMIT = -0x1
VDISCARD = 0xf
VDSUSP = 0xb
VEOF = 0x0
@ -1381,6 +1594,19 @@ const (
VKILL = 0x5
VLNEXT = 0xe
VMIN = 0x10
VM_ANONMIN = 0x7
VM_LOADAVG = 0x2
VM_MALLOC_CONF = 0xc
VM_MAXID = 0xd
VM_MAXSLP = 0xa
VM_METER = 0x1
VM_NKMEMPAGES = 0x6
VM_PSSTRINGS = 0x3
VM_SWAPENCRYPT = 0x5
VM_USPACE = 0xb
VM_UVMEXP = 0x4
VM_VNODEMIN = 0x9
VM_VTEXTMIN = 0x8
VQUIT = 0x9
VREPRINT = 0x6
VSTART = 0xc
@ -1394,6 +1620,7 @@ const (
WCOREFLAG = 0x80
WNOHANG = 0x1
WUNTRACED = 0x2
XCASE = 0x1000000
)
// Errors
@ -1407,6 +1634,7 @@ const (
EALREADY = syscall.Errno(0x25)
EAUTH = syscall.Errno(0x50)
EBADF = syscall.Errno(0x9)
EBADMSG = syscall.Errno(0x5c)
EBADRPC = syscall.Errno(0x48)
EBUSY = syscall.Errno(0x10)
ECANCELED = syscall.Errno(0x58)
@ -1433,7 +1661,7 @@ const (
EIPSEC = syscall.Errno(0x52)
EISCONN = syscall.Errno(0x38)
EISDIR = syscall.Errno(0x15)
ELAST = syscall.Errno(0x5b)
ELAST = syscall.Errno(0x5f)
ELOOP = syscall.Errno(0x3e)
EMEDIUMTYPE = syscall.Errno(0x56)
EMFILE = syscall.Errno(0x18)
@ -1461,12 +1689,14 @@ const (
ENOTCONN = syscall.Errno(0x39)
ENOTDIR = syscall.Errno(0x14)
ENOTEMPTY = syscall.Errno(0x42)
ENOTRECOVERABLE = syscall.Errno(0x5d)
ENOTSOCK = syscall.Errno(0x26)
ENOTSUP = syscall.Errno(0x5b)
ENOTTY = syscall.Errno(0x19)
ENXIO = syscall.Errno(0x6)
EOPNOTSUPP = syscall.Errno(0x2d)
EOVERFLOW = syscall.Errno(0x57)
EOWNERDEAD = syscall.Errno(0x5e)
EPERM = syscall.Errno(0x1)
EPFNOSUPPORT = syscall.Errno(0x2e)
EPIPE = syscall.Errno(0x20)
@ -1474,6 +1704,7 @@ const (
EPROCUNAVAIL = syscall.Errno(0x4c)
EPROGMISMATCH = syscall.Errno(0x4b)
EPROGUNAVAIL = syscall.Errno(0x4a)
EPROTO = syscall.Errno(0x5f)
EPROTONOSUPPORT = syscall.Errno(0x2b)
EPROTOTYPE = syscall.Errno(0x29)
ERANGE = syscall.Errno(0x22)
@ -1570,7 +1801,7 @@ var errorList = [...]struct {
{32, "EPIPE", "broken pipe"},
{33, "EDOM", "numerical argument out of domain"},
{34, "ERANGE", "result too large"},
{35, "EWOULDBLOCK", "resource temporarily unavailable"},
{35, "EAGAIN", "resource temporarily unavailable"},
{36, "EINPROGRESS", "operation now in progress"},
{37, "EALREADY", "operation already in progress"},
{38, "ENOTSOCK", "socket operation on non-socket"},
@ -1626,7 +1857,11 @@ var errorList = [...]struct {
{88, "ECANCELED", "operation canceled"},
{89, "EIDRM", "identifier removed"},
{90, "ENOMSG", "no message of desired type"},
{91, "ELAST", "not supported"},
{91, "ENOTSUP", "not supported"},
{92, "EBADMSG", "bad message"},
{93, "ENOTRECOVERABLE", "state not recoverable"},
{94, "EOWNERDEAD", "previous owner died"},
{95, "ELAST", "protocol error"},
}
// Signal table
@ -1640,7 +1875,7 @@ var signalList = [...]struct {
{3, "SIGQUIT", "quit"},
{4, "SIGILL", "illegal instruction"},
{5, "SIGTRAP", "trace/BPT trap"},
{6, "SIGABRT", "abort trap"},
{6, "SIGIOT", "abort trap"},
{7, "SIGEMT", "EMT trap"},
{8, "SIGFPE", "floating point exception"},
{9, "SIGKILL", "killed"},
@ -1667,4 +1902,5 @@ var signalList = [...]struct {
{30, "SIGUSR1", "user defined signal 1"},
{31, "SIGUSR2", "user defined signal 2"},
{32, "SIGTHR", "thread AST"},
{28672, "SIGSTKSZ", "unknown signal"},
}

View File

@ -112,6 +112,12 @@ const (
BPF_FILDROP_CAPTURE = 0x1
BPF_FILDROP_DROP = 0x2
BPF_FILDROP_PASS = 0x0
BPF_F_DIR_IN = 0x10
BPF_F_DIR_MASK = 0x30
BPF_F_DIR_OUT = 0x20
BPF_F_DIR_SHIFT = 0x4
BPF_F_FLOWID = 0x8
BPF_F_PRI_MASK = 0x7
BPF_H = 0x8
BPF_IMM = 0x0
BPF_IND = 0x40
@ -140,6 +146,7 @@ const (
BPF_OR = 0x40
BPF_RELEASE = 0x30bb6
BPF_RET = 0x6
BPF_RND = 0xc0
BPF_RSH = 0x70
BPF_ST = 0x2
BPF_STX = 0x3
@ -180,7 +187,65 @@ const (
CTL_KERN = 0x1
CTL_MAXNAME = 0xc
CTL_NET = 0x4
DIOCADDQUEUE = 0xc110445d
DIOCADDRULE = 0xcd604404
DIOCADDSTATE = 0xc1084425
DIOCCHANGERULE = 0xcd60441a
DIOCCLRIFFLAG = 0xc028445a
DIOCCLRSRCNODES = 0x20004455
DIOCCLRSTATES = 0xc0e04412
DIOCCLRSTATUS = 0xc0284416
DIOCGETLIMIT = 0xc0084427
DIOCGETQSTATS = 0xc1204460
DIOCGETQUEUE = 0xc110445f
DIOCGETQUEUES = 0xc110445e
DIOCGETRULE = 0xcd604407
DIOCGETRULES = 0xcd604406
DIOCGETRULESET = 0xc444443b
DIOCGETRULESETS = 0xc444443a
DIOCGETSRCNODES = 0xc0104454
DIOCGETSTATE = 0xc1084413
DIOCGETSTATES = 0xc0104419
DIOCGETSTATUS = 0xc1e84415
DIOCGETSYNFLWATS = 0xc0084463
DIOCGETTIMEOUT = 0xc008441e
DIOCIGETIFACES = 0xc0284457
DIOCKILLSRCNODES = 0xc080445b
DIOCKILLSTATES = 0xc0e04429
DIOCNATLOOK = 0xc0504417
DIOCOSFPADD = 0xc088444f
DIOCOSFPFLUSH = 0x2000444e
DIOCOSFPGET = 0xc0884450
DIOCRADDADDRS = 0xc4504443
DIOCRADDTABLES = 0xc450443d
DIOCRCLRADDRS = 0xc4504442
DIOCRCLRASTATS = 0xc4504448
DIOCRCLRTABLES = 0xc450443c
DIOCRCLRTSTATS = 0xc4504441
DIOCRDELADDRS = 0xc4504444
DIOCRDELTABLES = 0xc450443e
DIOCRGETADDRS = 0xc4504446
DIOCRGETASTATS = 0xc4504447
DIOCRGETTABLES = 0xc450443f
DIOCRGETTSTATS = 0xc4504440
DIOCRINADEFINE = 0xc450444d
DIOCRSETADDRS = 0xc4504445
DIOCRSETTFLAGS = 0xc450444a
DIOCRTSTADDRS = 0xc4504449
DIOCSETDEBUG = 0xc0044418
DIOCSETHOSTID = 0xc0044456
DIOCSETIFFLAG = 0xc0284459
DIOCSETLIMIT = 0xc0084428
DIOCSETREASS = 0xc004445c
DIOCSETSTATUSIF = 0xc0284414
DIOCSETSYNCOOKIES = 0xc0014462
DIOCSETSYNFLWATS = 0xc0084461
DIOCSETTIMEOUT = 0xc008441d
DIOCSTART = 0x20004401
DIOCSTOP = 0x20004402
DIOCXBEGIN = 0xc0104451
DIOCXCOMMIT = 0xc0104452
DIOCXROLLBACK = 0xc0104453
DLT_ARCNET = 0x7
DLT_ATM_RFC1483 = 0xb
DLT_AX25 = 0x3
@ -243,6 +308,8 @@ const (
EMUL_ENABLED = 0x1
EMUL_NATIVE = 0x2
ENDRUNDISC = 0x9
ETH64_8021_RSVD_MASK = 0xfffffffffff0
ETH64_8021_RSVD_PREFIX = 0x180c2000000
ETHERMIN = 0x2e
ETHERMTU = 0x5dc
ETHERTYPE_8023 = 0x4
@ -295,6 +362,7 @@ const (
ETHERTYPE_DN = 0x6003
ETHERTYPE_DOGFIGHT = 0x1989
ETHERTYPE_DSMD = 0x8039
ETHERTYPE_EAPOL = 0x888e
ETHERTYPE_ECMA = 0x803
ETHERTYPE_ENCRYPT = 0x803d
ETHERTYPE_ES = 0x805d
@ -326,6 +394,7 @@ const (
ETHERTYPE_LLDP = 0x88cc
ETHERTYPE_LOGICRAFT = 0x8148
ETHERTYPE_LOOPBACK = 0x9000
ETHERTYPE_MACSEC = 0x88e5
ETHERTYPE_MATRA = 0x807a
ETHERTYPE_MAX = 0xffff
ETHERTYPE_MERIT = 0x807c
@ -354,15 +423,16 @@ const (
ETHERTYPE_NCD = 0x8149
ETHERTYPE_NESTAR = 0x8006
ETHERTYPE_NETBEUI = 0x8191
ETHERTYPE_NHRP = 0x2001
ETHERTYPE_NOVELL = 0x8138
ETHERTYPE_NS = 0x600
ETHERTYPE_NSAT = 0x601
ETHERTYPE_NSCOMPAT = 0x807
ETHERTYPE_NSH = 0x984f
ETHERTYPE_NTRAILER = 0x10
ETHERTYPE_OS9 = 0x7007
ETHERTYPE_OS9NET = 0x7009
ETHERTYPE_PACER = 0x80c6
ETHERTYPE_PAE = 0x888e
ETHERTYPE_PBB = 0x88e7
ETHERTYPE_PCS = 0x4242
ETHERTYPE_PLANNING = 0x8044
@ -445,10 +515,11 @@ const (
ETHER_VLAN_ENCAP_LEN = 0x4
EVFILT_AIO = -0x3
EVFILT_DEVICE = -0x8
EVFILT_EXCEPT = -0x9
EVFILT_PROC = -0x5
EVFILT_READ = -0x1
EVFILT_SIGNAL = -0x6
EVFILT_SYSCOUNT = 0x8
EVFILT_SYSCOUNT = 0x9
EVFILT_TIMER = -0x7
EVFILT_VNODE = -0x4
EVFILT_WRITE = -0x2
@ -470,7 +541,7 @@ const (
EV_FLAG1 = 0x2000
EV_ONESHOT = 0x10
EV_RECEIPT = 0x40
EV_SYSFLAGS = 0xf000
EV_SYSFLAGS = 0xf800
EXTA = 0x4b00
EXTB = 0x9600
EXTPROC = 0x800
@ -736,6 +807,7 @@ const (
IFT_VOICEOVERCABLE = 0xc6
IFT_VOICEOVERFRAMERELAY = 0x99
IFT_VOICEOVERIP = 0x68
IFT_WIREGUARD = 0xfb
IFT_X213 = 0x5d
IFT_X25 = 0x5
IFT_X25DDN = 0x4
@ -801,9 +873,11 @@ const (
IPPROTO_RAW = 0xff
IPPROTO_ROUTING = 0x2b
IPPROTO_RSVP = 0x2e
IPPROTO_SCTP = 0x84
IPPROTO_TCP = 0x6
IPPROTO_TP = 0x1d
IPPROTO_UDP = 0x11
IPPROTO_UDPLITE = 0x88
IPV6_AUTH_LEVEL = 0x35
IPV6_AUTOFLOWLABEL = 0x3b
IPV6_CHECKSUM = 0x1a
@ -910,6 +984,9 @@ const (
IP_TTL = 0x4
ISIG = 0x80
ISTRIP = 0x20
ITIMER_PROF = 0x2
ITIMER_REAL = 0x0
ITIMER_VIRTUAL = 0x1
IUCLC = 0x1000
IXANY = 0x800
IXOFF = 0x400
@ -981,6 +1058,19 @@ const (
MNT_WAIT = 0x1
MNT_WANTRDWR = 0x2000000
MNT_WXALLOWED = 0x800
MOUNT_AFS = "afs"
MOUNT_CD9660 = "cd9660"
MOUNT_EXT2FS = "ext2fs"
MOUNT_FFS = "ffs"
MOUNT_FUSEFS = "fuse"
MOUNT_MFS = "mfs"
MOUNT_MSDOS = "msdos"
MOUNT_NCPFS = "ncpfs"
MOUNT_NFS = "nfs"
MOUNT_NTFS = "ntfs"
MOUNT_TMPFS = "tmpfs"
MOUNT_UDF = "udf"
MOUNT_UFS = "ffs"
MSG_BCAST = 0x100
MSG_CMSG_CLOEXEC = 0x800
MSG_CTRUNC = 0x20
@ -993,6 +1083,7 @@ const (
MSG_PEEK = 0x2
MSG_TRUNC = 0x10
MSG_WAITALL = 0x40
MSG_WAITFORONE = 0x1000
MS_ASYNC = 0x1
MS_INVALIDATE = 0x4
MS_SYNC = 0x2
@ -1001,7 +1092,8 @@ const (
NET_RT_FLAGS = 0x2
NET_RT_IFLIST = 0x3
NET_RT_IFNAMES = 0x6
NET_RT_MAXID = 0x7
NET_RT_MAXID = 0x8
NET_RT_SOURCE = 0x7
NET_RT_STATS = 0x4
NET_RT_TABLE = 0x5
NFDBITS = 0x20
@ -1018,6 +1110,7 @@ const (
NOTE_FORK = 0x40000000
NOTE_LINK = 0x10
NOTE_LOWAT = 0x1
NOTE_OOB = 0x4
NOTE_PCTRLMASK = 0xf0000000
NOTE_PDATAMASK = 0xfffff
NOTE_RENAME = 0x20
@ -1154,7 +1247,7 @@ const (
RTM_PROPOSAL = 0x13
RTM_REDIRECT = 0x6
RTM_RESOLVE = 0xb
RTM_RTTUNIT = 0xf4240
RTM_SOURCE = 0x16
RTM_VERSION = 0x5
RTV_EXPIRE = 0x4
RTV_HOPCOUNT = 0x2
@ -1172,6 +1265,9 @@ const (
RUSAGE_THREAD = 0x1
SCM_RIGHTS = 0x1
SCM_TIMESTAMP = 0x4
SEEK_CUR = 0x1
SEEK_END = 0x2
SEEK_SET = 0x0
SHUT_RD = 0x0
SHUT_RDWR = 0x2
SHUT_WR = 0x1
@ -1188,30 +1284,30 @@ const (
SIOCBRDGDELS = 0x80606942
SIOCBRDGFLUSH = 0x80606948
SIOCBRDGFRL = 0x808c694e
SIOCBRDGGCACHE = 0xc0186941
SIOCBRDGGFD = 0xc0186952
SIOCBRDGGHT = 0xc0186951
SIOCBRDGGCACHE = 0xc0146941
SIOCBRDGGFD = 0xc0146952
SIOCBRDGGHT = 0xc0146951
SIOCBRDGGIFFLGS = 0xc060693e
SIOCBRDGGMA = 0xc0186953
SIOCBRDGGMA = 0xc0146953
SIOCBRDGGPARAM = 0xc0406958
SIOCBRDGGPRI = 0xc0186950
SIOCBRDGGPRI = 0xc0146950
SIOCBRDGGRL = 0xc030694f
SIOCBRDGGTO = 0xc0186946
SIOCBRDGGTO = 0xc0146946
SIOCBRDGIFS = 0xc0606942
SIOCBRDGRTS = 0xc0206943
SIOCBRDGSADDR = 0xc1286944
SIOCBRDGSCACHE = 0x80186940
SIOCBRDGSFD = 0x80186952
SIOCBRDGSHT = 0x80186951
SIOCBRDGSCACHE = 0x80146940
SIOCBRDGSFD = 0x80146952
SIOCBRDGSHT = 0x80146951
SIOCBRDGSIFCOST = 0x80606955
SIOCBRDGSIFFLGS = 0x8060693f
SIOCBRDGSIFPRIO = 0x80606954
SIOCBRDGSIFPROT = 0x8060694a
SIOCBRDGSMA = 0x80186953
SIOCBRDGSPRI = 0x80186950
SIOCBRDGSPROTO = 0x8018695a
SIOCBRDGSTO = 0x80186945
SIOCBRDGSTXHC = 0x80186959
SIOCBRDGSMA = 0x80146953
SIOCBRDGSPRI = 0x80146950
SIOCBRDGSPROTO = 0x8014695a
SIOCBRDGSTO = 0x80146945
SIOCBRDGSTXHC = 0x80146959
SIOCDELLABEL = 0x80206997
SIOCDELMULTI = 0x80206932
SIOCDIFADDR = 0x80206919
@ -1264,6 +1360,7 @@ const (
SIOCGPWE3CTRLWORD = 0xc02069dc
SIOCGPWE3FAT = 0xc02069dd
SIOCGPWE3NEIGHBOR = 0xc21869de
SIOCGRXHPRIO = 0xc02069db
SIOCGSPPPPARAMS = 0xc0206994
SIOCGTXHPRIO = 0xc02069c6
SIOCGUMBINFO = 0xc02069be
@ -1310,17 +1407,13 @@ const (
SIOCSPWE3CTRLWORD = 0x802069dc
SIOCSPWE3FAT = 0x802069dd
SIOCSPWE3NEIGHBOR = 0x821869de
SIOCSRXHPRIO = 0x802069db
SIOCSSPPPPARAMS = 0x80206993
SIOCSTXHPRIO = 0x802069c5
SIOCSUMBPARAM = 0x802069bf
SIOCSVH = 0xc02069f5
SIOCSVNETFLOWID = 0x802069c3
SIOCSVNETID = 0x802069a6
SIOCSWGDPID = 0xc018695b
SIOCSWGMAXFLOW = 0xc0186960
SIOCSWGMAXGROUP = 0xc018695d
SIOCSWSDPID = 0x8018695c
SIOCSWSPORTNO = 0xc060695f
SOCK_CLOEXEC = 0x8000
SOCK_DGRAM = 0x2
SOCK_DNS = 0x1000
@ -1335,6 +1428,7 @@ const (
SO_BINDANY = 0x1000
SO_BROADCAST = 0x20
SO_DEBUG = 0x1
SO_DOMAIN = 0x1024
SO_DONTROUTE = 0x10
SO_ERROR = 0x1007
SO_KEEPALIVE = 0x8
@ -1342,6 +1436,7 @@ const (
SO_NETPROC = 0x1020
SO_OOBINLINE = 0x100
SO_PEERCRED = 0x1022
SO_PROTOCOL = 0x1025
SO_RCVBUF = 0x1002
SO_RCVLOWAT = 0x1004
SO_RCVTIMEO = 0x1006
@ -1391,7 +1486,18 @@ const (
TCOFLUSH = 0x2
TCOOFF = 0x1
TCOON = 0x2
TCP_MAXBURST = 0x4
TCPOPT_EOL = 0x0
TCPOPT_MAXSEG = 0x2
TCPOPT_NOP = 0x1
TCPOPT_SACK = 0x5
TCPOPT_SACK_HDR = 0x1010500
TCPOPT_SACK_PERMITTED = 0x4
TCPOPT_SACK_PERMIT_HDR = 0x1010402
TCPOPT_SIGNATURE = 0x13
TCPOPT_TIMESTAMP = 0x8
TCPOPT_TSTAMP_HDR = 0x101080a
TCPOPT_WINDOW = 0x3
TCP_INFO = 0x9
TCP_MAXSEG = 0x2
TCP_MAXWIN = 0xffff
TCP_MAX_SACK = 0x3
@ -1400,6 +1506,7 @@ const (
TCP_MSS = 0x200
TCP_NODELAY = 0x1
TCP_NOPUSH = 0x10
TCP_SACKHOLE_LIMIT = 0x80
TCP_SACK_ENABLE = 0x8
TCSAFLUSH = 0x2
TIMER_ABSTIME = 0x1
@ -1768,7 +1875,7 @@ var signalList = [...]struct {
{3, "SIGQUIT", "quit"},
{4, "SIGILL", "illegal instruction"},
{5, "SIGTRAP", "trace/BPT trap"},
{6, "SIGABRT", "abort trap"},
{6, "SIGIOT", "abort trap"},
{7, "SIGEMT", "EMT trap"},
{8, "SIGFPE", "floating point exception"},
{9, "SIGKILL", "killed"},
@ -1795,4 +1902,5 @@ var signalList = [...]struct {
{30, "SIGUSR1", "user defined signal 1"},
{31, "SIGUSR2", "user defined signal 2"},
{32, "SIGTHR", "thread AST"},
{28672, "SIGSTKSZ", "unknown signal"},
}

View File

@ -112,6 +112,12 @@ const (
BPF_FILDROP_CAPTURE = 0x1
BPF_FILDROP_DROP = 0x2
BPF_FILDROP_PASS = 0x0
BPF_F_DIR_IN = 0x10
BPF_F_DIR_MASK = 0x30
BPF_F_DIR_OUT = 0x20
BPF_F_DIR_SHIFT = 0x4
BPF_F_FLOWID = 0x8
BPF_F_PRI_MASK = 0x7
BPF_H = 0x8
BPF_IMM = 0x0
BPF_IND = 0x40
@ -140,6 +146,7 @@ const (
BPF_OR = 0x40
BPF_RELEASE = 0x30bb6
BPF_RET = 0x6
BPF_RND = 0xc0
BPF_RSH = 0x70
BPF_ST = 0x2
BPF_STX = 0x3
@ -301,6 +308,8 @@ const (
EMUL_ENABLED = 0x1
EMUL_NATIVE = 0x2
ENDRUNDISC = 0x9
ETH64_8021_RSVD_MASK = 0xfffffffffff0
ETH64_8021_RSVD_PREFIX = 0x180c2000000
ETHERMIN = 0x2e
ETHERMTU = 0x5dc
ETHERTYPE_8023 = 0x4
@ -353,6 +362,7 @@ const (
ETHERTYPE_DN = 0x6003
ETHERTYPE_DOGFIGHT = 0x1989
ETHERTYPE_DSMD = 0x8039
ETHERTYPE_EAPOL = 0x888e
ETHERTYPE_ECMA = 0x803
ETHERTYPE_ENCRYPT = 0x803d
ETHERTYPE_ES = 0x805d
@ -413,15 +423,16 @@ const (
ETHERTYPE_NCD = 0x8149
ETHERTYPE_NESTAR = 0x8006
ETHERTYPE_NETBEUI = 0x8191
ETHERTYPE_NHRP = 0x2001
ETHERTYPE_NOVELL = 0x8138
ETHERTYPE_NS = 0x600
ETHERTYPE_NSAT = 0x601
ETHERTYPE_NSCOMPAT = 0x807
ETHERTYPE_NSH = 0x984f
ETHERTYPE_NTRAILER = 0x10
ETHERTYPE_OS9 = 0x7007
ETHERTYPE_OS9NET = 0x7009
ETHERTYPE_PACER = 0x80c6
ETHERTYPE_PAE = 0x888e
ETHERTYPE_PBB = 0x88e7
ETHERTYPE_PCS = 0x4242
ETHERTYPE_PLANNING = 0x8044
@ -504,10 +515,11 @@ const (
ETHER_VLAN_ENCAP_LEN = 0x4
EVFILT_AIO = -0x3
EVFILT_DEVICE = -0x8
EVFILT_EXCEPT = -0x9
EVFILT_PROC = -0x5
EVFILT_READ = -0x1
EVFILT_SIGNAL = -0x6
EVFILT_SYSCOUNT = 0x8
EVFILT_SYSCOUNT = 0x9
EVFILT_TIMER = -0x7
EVFILT_VNODE = -0x4
EVFILT_WRITE = -0x2
@ -529,7 +541,7 @@ const (
EV_FLAG1 = 0x2000
EV_ONESHOT = 0x10
EV_RECEIPT = 0x40
EV_SYSFLAGS = 0xf000
EV_SYSFLAGS = 0xf800
EXTA = 0x4b00
EXTB = 0x9600
EXTPROC = 0x800
@ -795,6 +807,7 @@ const (
IFT_VOICEOVERCABLE = 0xc6
IFT_VOICEOVERFRAMERELAY = 0x99
IFT_VOICEOVERIP = 0x68
IFT_WIREGUARD = 0xfb
IFT_X213 = 0x5d
IFT_X25 = 0x5
IFT_X25DDN = 0x4
@ -860,6 +873,7 @@ const (
IPPROTO_RAW = 0xff
IPPROTO_ROUTING = 0x2b
IPPROTO_RSVP = 0x2e
IPPROTO_SCTP = 0x84
IPPROTO_TCP = 0x6
IPPROTO_TP = 0x1d
IPPROTO_UDP = 0x11
@ -970,6 +984,9 @@ const (
IP_TTL = 0x4
ISIG = 0x80
ISTRIP = 0x20
ITIMER_PROF = 0x2
ITIMER_REAL = 0x0
ITIMER_VIRTUAL = 0x1
IUCLC = 0x1000
IXANY = 0x800
IXOFF = 0x400
@ -1041,6 +1058,19 @@ const (
MNT_WAIT = 0x1
MNT_WANTRDWR = 0x2000000
MNT_WXALLOWED = 0x800
MOUNT_AFS = "afs"
MOUNT_CD9660 = "cd9660"
MOUNT_EXT2FS = "ext2fs"
MOUNT_FFS = "ffs"
MOUNT_FUSEFS = "fuse"
MOUNT_MFS = "mfs"
MOUNT_MSDOS = "msdos"
MOUNT_NCPFS = "ncpfs"
MOUNT_NFS = "nfs"
MOUNT_NTFS = "ntfs"
MOUNT_TMPFS = "tmpfs"
MOUNT_UDF = "udf"
MOUNT_UFS = "ffs"
MSG_BCAST = 0x100
MSG_CMSG_CLOEXEC = 0x800
MSG_CTRUNC = 0x20
@ -1053,6 +1083,7 @@ const (
MSG_PEEK = 0x2
MSG_TRUNC = 0x10
MSG_WAITALL = 0x40
MSG_WAITFORONE = 0x1000
MS_ASYNC = 0x1
MS_INVALIDATE = 0x4
MS_SYNC = 0x2
@ -1061,7 +1092,8 @@ const (
NET_RT_FLAGS = 0x2
NET_RT_IFLIST = 0x3
NET_RT_IFNAMES = 0x6
NET_RT_MAXID = 0x7
NET_RT_MAXID = 0x8
NET_RT_SOURCE = 0x7
NET_RT_STATS = 0x4
NET_RT_TABLE = 0x5
NFDBITS = 0x20
@ -1078,6 +1110,7 @@ const (
NOTE_FORK = 0x40000000
NOTE_LINK = 0x10
NOTE_LOWAT = 0x1
NOTE_OOB = 0x4
NOTE_PCTRLMASK = 0xf0000000
NOTE_PDATAMASK = 0xfffff
NOTE_RENAME = 0x20
@ -1214,7 +1247,7 @@ const (
RTM_PROPOSAL = 0x13
RTM_REDIRECT = 0x6
RTM_RESOLVE = 0xb
RTM_RTTUNIT = 0xf4240
RTM_SOURCE = 0x16
RTM_VERSION = 0x5
RTV_EXPIRE = 0x4
RTV_HOPCOUNT = 0x2
@ -1232,6 +1265,9 @@ const (
RUSAGE_THREAD = 0x1
SCM_RIGHTS = 0x1
SCM_TIMESTAMP = 0x4
SEEK_CUR = 0x1
SEEK_END = 0x2
SEEK_SET = 0x0
SHUT_RD = 0x0
SHUT_RDWR = 0x2
SHUT_WR = 0x1
@ -1248,30 +1284,30 @@ const (
SIOCBRDGDELS = 0x80606942
SIOCBRDGFLUSH = 0x80606948
SIOCBRDGFRL = 0x808c694e
SIOCBRDGGCACHE = 0xc0186941
SIOCBRDGGFD = 0xc0186952
SIOCBRDGGHT = 0xc0186951
SIOCBRDGGCACHE = 0xc0146941
SIOCBRDGGFD = 0xc0146952
SIOCBRDGGHT = 0xc0146951
SIOCBRDGGIFFLGS = 0xc060693e
SIOCBRDGGMA = 0xc0186953
SIOCBRDGGMA = 0xc0146953
SIOCBRDGGPARAM = 0xc0406958
SIOCBRDGGPRI = 0xc0186950
SIOCBRDGGPRI = 0xc0146950
SIOCBRDGGRL = 0xc030694f
SIOCBRDGGTO = 0xc0186946
SIOCBRDGGTO = 0xc0146946
SIOCBRDGIFS = 0xc0606942
SIOCBRDGRTS = 0xc0206943
SIOCBRDGSADDR = 0xc1286944
SIOCBRDGSCACHE = 0x80186940
SIOCBRDGSFD = 0x80186952
SIOCBRDGSHT = 0x80186951
SIOCBRDGSCACHE = 0x80146940
SIOCBRDGSFD = 0x80146952
SIOCBRDGSHT = 0x80146951
SIOCBRDGSIFCOST = 0x80606955
SIOCBRDGSIFFLGS = 0x8060693f
SIOCBRDGSIFPRIO = 0x80606954
SIOCBRDGSIFPROT = 0x8060694a
SIOCBRDGSMA = 0x80186953
SIOCBRDGSPRI = 0x80186950
SIOCBRDGSPROTO = 0x8018695a
SIOCBRDGSTO = 0x80186945
SIOCBRDGSTXHC = 0x80186959
SIOCBRDGSMA = 0x80146953
SIOCBRDGSPRI = 0x80146950
SIOCBRDGSPROTO = 0x8014695a
SIOCBRDGSTO = 0x80146945
SIOCBRDGSTXHC = 0x80146959
SIOCDELLABEL = 0x80206997
SIOCDELMULTI = 0x80206932
SIOCDIFADDR = 0x80206919
@ -1378,11 +1414,6 @@ const (
SIOCSVH = 0xc02069f5
SIOCSVNETFLOWID = 0x802069c3
SIOCSVNETID = 0x802069a6
SIOCSWGDPID = 0xc018695b
SIOCSWGMAXFLOW = 0xc0186960
SIOCSWGMAXGROUP = 0xc018695d
SIOCSWSDPID = 0x8018695c
SIOCSWSPORTNO = 0xc060695f
SOCK_CLOEXEC = 0x8000
SOCK_DGRAM = 0x2
SOCK_DNS = 0x1000
@ -1455,7 +1486,18 @@ const (
TCOFLUSH = 0x2
TCOOFF = 0x1
TCOON = 0x2
TCP_MAXBURST = 0x4
TCPOPT_EOL = 0x0
TCPOPT_MAXSEG = 0x2
TCPOPT_NOP = 0x1
TCPOPT_SACK = 0x5
TCPOPT_SACK_HDR = 0x1010500
TCPOPT_SACK_PERMITTED = 0x4
TCPOPT_SACK_PERMIT_HDR = 0x1010402
TCPOPT_SIGNATURE = 0x13
TCPOPT_TIMESTAMP = 0x8
TCPOPT_TSTAMP_HDR = 0x101080a
TCPOPT_WINDOW = 0x3
TCP_INFO = 0x9
TCP_MAXSEG = 0x2
TCP_MAXWIN = 0xffff
TCP_MAX_SACK = 0x3
@ -1833,7 +1875,7 @@ var signalList = [...]struct {
{3, "SIGQUIT", "quit"},
{4, "SIGILL", "illegal instruction"},
{5, "SIGTRAP", "trace/BPT trap"},
{6, "SIGABRT", "abort trap"},
{6, "SIGIOT", "abort trap"},
{7, "SIGEMT", "EMT trap"},
{8, "SIGFPE", "floating point exception"},
{9, "SIGKILL", "killed"},
@ -1860,4 +1902,5 @@ var signalList = [...]struct {
{30, "SIGUSR1", "user defined signal 1"},
{31, "SIGUSR2", "user defined signal 2"},
{32, "SIGTHR", "thread AST"},
{81920, "SIGSTKSZ", "unknown signal"},
}

View File

@ -552,6 +552,16 @@ func Chroot(path string) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func ClockGettime(clockid int32, time *Timespec) (err error) {
_, _, e1 := Syscall(SYS_CLOCK_GETTIME, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Close(fd int) (err error) {
_, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0)
if e1 != 0 {

View File

@ -544,6 +544,16 @@ func Chroot(path string) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func ClockGettime(clockid int32, time *Timespec) (err error) {
_, _, e1 := Syscall(SYS_CLOCK_GETTIME, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Close(fd int) (err error) {
_, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0)
if e1 != 0 {

View File

@ -544,6 +544,16 @@ func Chroot(path string) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func ClockGettime(clockid int32, time *Timespec) (err error) {
_, _, e1 := Syscall(SYS_CLOCK_GETTIME, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Close(fd int) (err error) {
_, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0)
if e1 != 0 {

View File

@ -544,6 +544,16 @@ func Chroot(path string) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func ClockGettime(clockid int32, time *Timespec) (err error) {
_, _, e1 := Syscall(SYS_CLOCK_GETTIME, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Close(fd int) (err error) {
_, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0)
if e1 != 0 {

View File

@ -544,6 +544,16 @@ func Chroot(path string) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func ClockGettime(clockid int32, time *Timespec) (err error) {
_, _, e1 := Syscall(SYS_CLOCK_GETTIME, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Close(fd int) (err error) {
_, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0)
if e1 != 0 {

View File

@ -544,6 +544,16 @@ func Chroot(path string) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func ClockGettime(clockid int32, time *Timespec) (err error) {
_, _, e1 := Syscall(SYS_CLOCK_GETTIME, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Close(fd int) (err error) {
_, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0)
if e1 != 0 {

View File

@ -537,6 +537,17 @@ func Chroot(path string) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func ClockAdjtime(clockid int32, buf *Timex) (state int, err error) {
r0, _, e1 := Syscall(SYS_CLOCK_ADJTIME, uintptr(clockid), uintptr(unsafe.Pointer(buf)), 0)
state = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func ClockGetres(clockid int32, res *Timespec) (err error) {
_, _, e1 := Syscall(SYS_CLOCK_GETRES, uintptr(clockid), uintptr(unsafe.Pointer(res)), 0)
if e1 != 0 {

View File

@ -521,6 +521,16 @@ func Chroot(path string) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func ClockGettime(clockid int32, time *Timespec) (err error) {
_, _, e1 := Syscall(SYS_CLOCK_GETTIME, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Close(fd int) (err error) {
_, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0)
if e1 != 0 {

View File

@ -521,6 +521,16 @@ func Chroot(path string) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func ClockGettime(clockid int32, time *Timespec) (err error) {
_, _, e1 := Syscall(SYS_CLOCK_GETTIME, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Close(fd int) (err error) {
_, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0)
if e1 != 0 {

View File

@ -521,6 +521,16 @@ func Chroot(path string) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func ClockGettime(clockid int32, time *Timespec) (err error) {
_, _, e1 := Syscall(SYS_CLOCK_GETTIME, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Close(fd int) (err error) {
_, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0)
if e1 != 0 {

Some files were not shown because too many files have changed in this diff Show More