Update dependencies

This commit is contained in:
Ken-Håvard Lieng 2018-10-06 08:09:29 +02:00
parent ccdd56fea4
commit 66bf957460
158 changed files with 15315 additions and 1835 deletions

File diff suppressed because one or more lines are too long

View File

@ -24,7 +24,7 @@ function brotli(opts) {
); );
} else if (file.isBuffer()) { } else if (file.isBuffer()) {
file.path += '.br'; file.path += '.br';
file.contents = new Buffer(br.compress(file.contents, opts).buffer); file.contents = Buffer.from(br.compress(file.contents, opts).buffer);
return callback(null, file); return callback(null, file);
} }
}); });

View File

@ -9,67 +9,67 @@
"not op_mini all" "not op_mini all"
], ],
"devDependencies": { "devDependencies": {
"@babel/core": "^7.0.0", "@babel/core": "^7.1.2",
"@babel/plugin-proposal-class-properties": "^7.0.0", "@babel/plugin-proposal-class-properties": "^7.1.0",
"@babel/plugin-proposal-export-default-from": "^7.0.0", "@babel/plugin-proposal-export-default-from": "^7.0.0",
"@babel/plugin-proposal-export-namespace-from": "^7.0.0", "@babel/plugin-proposal-export-namespace-from": "^7.0.0",
"@babel/plugin-transform-react-constant-elements": "^7.0.0", "@babel/plugin-transform-react-constant-elements": "^7.0.0",
"@babel/plugin-transform-react-inline-elements": "^7.0.0", "@babel/plugin-transform-react-inline-elements": "^7.0.0",
"@babel/preset-env": "^7.0.0", "@babel/preset-env": "^7.1.0",
"@babel/preset-react": "^7.0.0", "@babel/preset-react": "^7.0.0",
"autoprefixer": "^9.1.3", "autoprefixer": "^9.1.5",
"babel-core": "^7.0.0-0", "babel-core": "^7.0.0-0",
"babel-eslint": "^9.0.0", "babel-eslint": "^10.0.1",
"babel-jest": "^23.4.2", "babel-jest": "^23.6.0",
"babel-loader": "^8.0.0", "babel-loader": "^8.0.4",
"brotli": "^1.3.1", "brotli": "^1.3.1",
"css-loader": "^1.0.0", "css-loader": "^1.0.0",
"cssnano": "^4.1.0", "cssnano": "^4.1.4",
"del": "^3.0.0", "del": "^3.0.0",
"eslint": "^5.4.0", "eslint": "^5.6.1",
"eslint-config-airbnb": "^16.1.0", "eslint-config-airbnb": "^16.1.0",
"eslint-config-prettier": "^3.0.1", "eslint-config-prettier": "^3.1.0",
"eslint-import-resolver-webpack": "^0.10.1", "eslint-import-resolver-webpack": "^0.10.1",
"eslint-loader": "^2.1.0", "eslint-loader": "^2.1.1",
"eslint-plugin-import": "^2.14.0", "eslint-plugin-import": "^2.14.0",
"eslint-plugin-jsx-a11y": "^6.1.1", "eslint-plugin-jsx-a11y": "^6.1.2",
"eslint-plugin-prettier": "^2.6.2", "eslint-plugin-prettier": "^3.0.0",
"eslint-plugin-react": "^7.11.1", "eslint-plugin-react": "^7.11.1",
"express": "^4.14.1", "express": "^4.14.1",
"express-http-proxy": "^1.2.0", "express-http-proxy": "^1.4.0",
"gulp": "4.0.0", "gulp": "4.0.0",
"gulp-util": "^3.0.8", "gulp-util": "^3.0.8",
"jest": "^23.5.0", "jest": "^23.6.0",
"mini-css-extract-plugin": "^0.4.2", "mini-css-extract-plugin": "^0.4.3",
"postcss-flexbugs-fixes": "^4.1.0", "postcss-flexbugs-fixes": "^4.1.0",
"postcss-loader": "^3.0.0", "postcss-loader": "^3.0.0",
"prettier": "1.14.2", "prettier": "1.14.3",
"style-loader": "^0.23.0", "style-loader": "^0.23.0",
"through2": "^2.0.3", "through2": "^2.0.3",
"webpack": "^4.17.1", "webpack": "^4.20.2",
"webpack-dev-middleware": "^3.2.0", "webpack-dev-middleware": "^3.4.0",
"webpack-hot-middleware": "^2.22.3" "webpack-hot-middleware": "^2.24.2"
}, },
"dependencies": { "dependencies": {
"autolinker": "^1.7.1", "autolinker": "^1.7.1",
"backo": "^1.1.0", "backo": "^1.1.0",
"base64-arraybuffer": "^0.1.5", "base64-arraybuffer": "^0.1.5",
"classnames": "^2.2.6", "classnames": "^2.2.6",
"es6-promise": "^4.2.4", "es6-promise": "^4.2.5",
"fontfaceobserver": "^2.0.9", "fontfaceobserver": "^2.0.9",
"formik": "1.1.1", "formik": "1.3.1",
"history": "4.5.1", "history": "4.5.1",
"immer": "^1.5.0", "immer": "^1.7.2",
"js-cookie": "^2.1.4", "js-cookie": "^2.1.4",
"lodash": "^4.17.10", "lodash": "^4.17.11",
"react": "^16.4.2", "react": "^16.5.2",
"react-dom": "^16.4.2", "react-dom": "^16.5.2",
"react-hot-loader": "^4.3.5", "react-hot-loader": "^4.3.11",
"react-redux": "^5.0.2", "react-redux": "^5.0.2",
"react-virtualized": "^9.20.1", "react-virtualized": "^9.20.1",
"redux": "^4.0.0", "redux": "^4.0.0",
"redux-thunk": "^2.3.0", "redux-thunk": "^2.3.0",
"reselect": "^3.0.0", "reselect": "^4.0.0",
"url-pattern": "^1.0.3" "url-pattern": "^1.0.3"
}, },
"scripts": { "scripts": {

View File

@ -27,7 +27,7 @@ input {
font: 16px Roboto Mono, monospace; font: 16px Roboto Mono, monospace;
border: none; border: none;
outline: none; outline: none;
background: #FFF; background: #fff;
} }
input::-ms-clear { input::-ms-clear {

File diff suppressed because it is too large Load Diff

45
go.mod
View File

@ -1,14 +1,14 @@
module github.com/khlieng/dispatch module github.com/khlieng/dispatch
require ( require (
github.com/BurntSushi/toml v0.3.0 // indirect github.com/BurntSushi/toml v0.3.1 // indirect
github.com/RoaringBitmap/roaring v0.4.16 // indirect github.com/RoaringBitmap/roaring v0.4.16 // indirect
github.com/blevesearch/bleve v0.0.0-20180525174403-1d6d47ed3ad9 github.com/blevesearch/bleve v0.0.0-20180525174403-1d6d47ed3ad9
github.com/blevesearch/blevex v0.0.0-20180227211930-4b158bb555a3 // indirect github.com/blevesearch/blevex v0.0.0-20180227211930-4b158bb555a3 // indirect
github.com/blevesearch/go-porterstemmer v0.0.0-20141230013033-23a2c8e5cf1f // indirect github.com/blevesearch/go-porterstemmer v0.0.0-20141230013033-23a2c8e5cf1f // indirect
github.com/blevesearch/segment v0.0.0-20160915185041-762005e7a34f // indirect github.com/blevesearch/segment v0.0.0-20160915185041-762005e7a34f // indirect
github.com/boltdb/bolt v0.0.0-20180302180052-fd01fc79c553 github.com/boltdb/bolt v0.0.0-20180302180052-fd01fc79c553
github.com/couchbase/vellum v0.0.0-20180822133609-0ceea4a37442 // indirect github.com/couchbase/vellum v0.0.0-20180910213445-01d5c56e6095 // indirect
github.com/cznic/b v0.0.0-20180115125044-35e9bbe41f07 // indirect github.com/cznic/b v0.0.0-20180115125044-35e9bbe41f07 // indirect
github.com/cznic/mathutil v0.0.0-20180504122225-ca4c9f2c1369 // indirect github.com/cznic/mathutil v0.0.0-20180504122225-ca4c9f2c1369 // indirect
github.com/cznic/strutil v0.0.0-20171016134553-529a34b1c186 // indirect github.com/cznic/strutil v0.0.0-20171016134553-529a34b1c186 // indirect
@ -20,52 +20,39 @@ require (
github.com/fsnotify/fsnotify v1.4.7 github.com/fsnotify/fsnotify v1.4.7
github.com/glycerine/go-unsnap-stream v0.0.0-20180323001048-9f0cb55181dd // indirect github.com/glycerine/go-unsnap-stream v0.0.0-20180323001048-9f0cb55181dd // indirect
github.com/glycerine/goconvey v0.0.0-20180728074245-46e3a41ad493 // indirect github.com/glycerine/goconvey v0.0.0-20180728074245-46e3a41ad493 // indirect
github.com/golang/protobuf v1.2.0 // indirect
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db // indirect github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db // indirect
github.com/gopherjs/gopherjs v0.0.0-20180825215210-0210a2f0f73c // indirect github.com/gopherjs/gopherjs v0.0.0-20181004151105-1babbf986f6f // indirect
github.com/gorilla/websocket v1.3.0 github.com/gorilla/websocket v1.4.0
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hpcloud/tail v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/jmhodges/levigo v0.0.0-20161115193449-c42d9e0ca023 // indirect github.com/jmhodges/levigo v0.0.0-20161115193449-c42d9e0ca023 // indirect
github.com/jpillora/backoff v0.0.0-20170918002102-8eab2debe79d github.com/jpillora/backoff v0.0.0-20180909062703-3050d21c67d7
github.com/jtolds/gls v4.2.1+incompatible // indirect github.com/jtolds/gls v4.2.1+incompatible // indirect
github.com/kjk/betterguid v0.0.0-20170621091430-c442874ba63a github.com/kjk/betterguid v0.0.0-20170621091430-c442874ba63a
github.com/kr/pretty v0.1.0 // indirect github.com/kr/pretty v0.1.0 // indirect
github.com/magiconair/properties v1.8.0 // indirect
github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329 github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329
github.com/miekg/dns v1.0.8 // indirect github.com/miekg/dns v1.0.12 // indirect
github.com/mitchellh/go-homedir v1.0.0 github.com/mitchellh/go-homedir v1.0.0
github.com/mitchellh/mapstructure v1.0.0 // indirect github.com/mitchellh/mapstructure v1.1.2 // indirect
github.com/mschoch/smat v0.0.0-20160514031455-90eadee771ae // indirect github.com/mschoch/smat v0.0.0-20160514031455-90eadee771ae // indirect
github.com/onsi/ginkgo v1.6.0 // indirect github.com/onsi/gomega v1.4.2 // indirect
github.com/onsi/gomega v1.4.1 // indirect
github.com/pelletier/go-toml v1.2.0 // indirect
github.com/philhofer/fwd v1.0.0 // indirect github.com/philhofer/fwd v1.0.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/smartystreets/assertions v0.0.0-20180820201707-7c9eb446e3cf // indirect github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d // indirect
github.com/smartystreets/goconvey v0.0.0-20180222194500-ef6db91d284a // indirect github.com/smartystreets/goconvey v0.0.0-20180222194500-ef6db91d284a // indirect
github.com/spf13/afero v1.1.1 // indirect
github.com/spf13/cast v1.2.0 github.com/spf13/cast v1.2.0
github.com/spf13/cobra v0.0.3 github.com/spf13/cobra v0.0.3
github.com/spf13/jwalterweatherman v0.0.0-20180814060501-14d3d4c51834 // indirect github.com/spf13/pflag v1.0.3 // indirect
github.com/spf13/pflag v1.0.2 // indirect github.com/spf13/viper v1.2.1
github.com/spf13/viper v1.1.0
github.com/steveyen/gtreap v0.0.0-20150807155958-0abe01ef9be2 // indirect github.com/steveyen/gtreap v0.0.0-20150807155958-0abe01ef9be2 // indirect
github.com/stretchr/testify v1.2.2 github.com/stretchr/testify v1.2.2
github.com/syndtr/goleveldb v0.0.0-20180815032940-ae2bd5eed72d // indirect github.com/syndtr/goleveldb v0.0.0-20180815032940-ae2bd5eed72d // indirect
github.com/tecbot/gorocksdb v0.0.0-20180730101644-8b1d981498e1 // indirect github.com/tecbot/gorocksdb v0.0.0-20180907100951-214b6b7bc0f0 // indirect
github.com/tinylib/msgp v0.0.0-20180215042507-3b5c87ab5fb0 // indirect github.com/tinylib/msgp v0.0.0-20180215042507-3b5c87ab5fb0 // indirect
github.com/willf/bitset v1.1.9 // indirect github.com/willf/bitset v1.1.9 // indirect
github.com/xenolf/lego v1.0.1 github.com/xenolf/lego v1.0.1
golang.org/x/crypto v0.0.0-20180830192347-182538f80094 // indirect golang.org/x/crypto v0.0.0-20181001203147-e3636079e1a4 // indirect
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d golang.org/x/net v0.0.0-20181005035420-146acd28ed58
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f // indirect golang.org/x/sys v0.0.0-20181005133103-4497e2df6f9e // indirect
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522 // indirect
golang.org/x/text v0.0.0-20180410181320-7922cc490dd5 // indirect
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
gopkg.in/fsnotify.v1 v1.4.7 // indirect gopkg.in/square/go-jose.v2 v2.1.9 // indirect
gopkg.in/square/go-jose.v2 v2.1.8 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/yaml.v2 v2.2.1 // indirect
) )

75
go.sum
View File

@ -1,5 +1,5 @@
github.com/BurntSushi/toml v0.3.0 h1:e1/Ivsx3Z0FVTV0NSOv/aVgbUWyQuzj7DDnFblkRvsY= github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/BurntSushi/toml v0.3.0/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/RoaringBitmap/roaring v0.4.16 h1:NholfewybRLOwACgfqfzn/N5xa6keKNs4fP00t0cwLo= github.com/RoaringBitmap/roaring v0.4.16 h1:NholfewybRLOwACgfqfzn/N5xa6keKNs4fP00t0cwLo=
github.com/RoaringBitmap/roaring v0.4.16/go.mod h1:8khRDP4HmeXns4xIj9oGrKSz7XTQiJx2zgh7AcNke4w= github.com/RoaringBitmap/roaring v0.4.16/go.mod h1:8khRDP4HmeXns4xIj9oGrKSz7XTQiJx2zgh7AcNke4w=
github.com/blevesearch/bleve v0.0.0-20180525174403-1d6d47ed3ad9 h1:q25+axgzH1KX+j63v3yrkY1VHc6PkyTfpnzOmtAH154= github.com/blevesearch/bleve v0.0.0-20180525174403-1d6d47ed3ad9 h1:q25+axgzH1KX+j63v3yrkY1VHc6PkyTfpnzOmtAH154=
@ -12,8 +12,8 @@ github.com/blevesearch/segment v0.0.0-20160915185041-762005e7a34f h1:kqbi9lqXLLs
github.com/blevesearch/segment v0.0.0-20160915185041-762005e7a34f/go.mod h1:IInt5XRvpiGE09KOk9mmCMLjHhydIhNPKPPFLFBB7L8= github.com/blevesearch/segment v0.0.0-20160915185041-762005e7a34f/go.mod h1:IInt5XRvpiGE09KOk9mmCMLjHhydIhNPKPPFLFBB7L8=
github.com/boltdb/bolt v0.0.0-20180302180052-fd01fc79c553 h1:yvSJ8qbaWLeS7COhu2KJ0epn4mmc+aGeBP7Dpg7xQTY= github.com/boltdb/bolt v0.0.0-20180302180052-fd01fc79c553 h1:yvSJ8qbaWLeS7COhu2KJ0epn4mmc+aGeBP7Dpg7xQTY=
github.com/boltdb/bolt v0.0.0-20180302180052-fd01fc79c553/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps= github.com/boltdb/bolt v0.0.0-20180302180052-fd01fc79c553/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps=
github.com/couchbase/vellum v0.0.0-20180822133609-0ceea4a37442 h1:gCXKsqWDJ/vxUXbtowgP0PfXm3etTapmDP19yu0lHSg= github.com/couchbase/vellum v0.0.0-20180910213445-01d5c56e6095 h1:dh7mqP7LS9voSd1Wx515giC2lPjPVduBpujISaftHrc=
github.com/couchbase/vellum v0.0.0-20180822133609-0ceea4a37442/go.mod h1:prYTC8EgTu3gwbqJihkud9zRXISvyulAplQ6exdCo1g= github.com/couchbase/vellum v0.0.0-20180910213445-01d5c56e6095/go.mod h1:prYTC8EgTu3gwbqJihkud9zRXISvyulAplQ6exdCo1g=
github.com/cznic/b v0.0.0-20180115125044-35e9bbe41f07 h1:UHFGPvSxX4C4YBApSPvmUfL8tTvWLj2ryqvT9K4Jcuk= github.com/cznic/b v0.0.0-20180115125044-35e9bbe41f07 h1:UHFGPvSxX4C4YBApSPvmUfL8tTvWLj2ryqvT9K4Jcuk=
github.com/cznic/b v0.0.0-20180115125044-35e9bbe41f07/go.mod h1:URriBxXwVq5ijiJ12C7iIZqlA69nTlI+LgI6/pwftG8= github.com/cznic/b v0.0.0-20180115125044-35e9bbe41f07/go.mod h1:URriBxXwVq5ijiJ12C7iIZqlA69nTlI+LgI6/pwftG8=
github.com/cznic/mathutil v0.0.0-20180504122225-ca4c9f2c1369 h1:XNT/Zf5l++1Pyg08/HV04ppB0gKxAqtZQBRYiYrUuYk= github.com/cznic/mathutil v0.0.0-20180504122225-ca4c9f2c1369 h1:XNT/Zf5l++1Pyg08/HV04ppB0gKxAqtZQBRYiYrUuYk=
@ -42,10 +42,10 @@ github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db h1:woRePGFeVFfLKN/pOkfl+p/TAqKOfFu+7KPlMVpok/w= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db h1:woRePGFeVFfLKN/pOkfl+p/TAqKOfFu+7KPlMVpok/w=
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/gopherjs/gopherjs v0.0.0-20180825215210-0210a2f0f73c h1:16eHWuMGvCjSfgRJKqIzapE78onvvTbdi1rMkU00lZw= github.com/gopherjs/gopherjs v0.0.0-20181004151105-1babbf986f6f h1:JJ2EP5vV3LAD2U1CxQtD7PTOO15Y96kXmKDz7TjxGHs=
github.com/gopherjs/gopherjs v0.0.0-20180825215210-0210a2f0f73c/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gopherjs/gopherjs v0.0.0-20181004151105-1babbf986f6f/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gorilla/websocket v1.3.0 h1:r/LXc0VJIMd0rCMsc6DxgczaQtoCwCLatnfXmSYcXx8= github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q=
github.com/gorilla/websocket v1.3.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
@ -54,8 +54,8 @@ github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NH
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/jmhodges/levigo v0.0.0-20161115193449-c42d9e0ca023 h1:y5P5G9cANJZt3MXlMrgELo5mNLZPXH8aGFFFG7IzPU0= github.com/jmhodges/levigo v0.0.0-20161115193449-c42d9e0ca023 h1:y5P5G9cANJZt3MXlMrgELo5mNLZPXH8aGFFFG7IzPU0=
github.com/jmhodges/levigo v0.0.0-20161115193449-c42d9e0ca023/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= github.com/jmhodges/levigo v0.0.0-20161115193449-c42d9e0ca023/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ=
github.com/jpillora/backoff v0.0.0-20170918002102-8eab2debe79d h1:ix3WmphUvN0GDd0DO9MH0v6/5xTv+Xm1bPN+1UJn58k= github.com/jpillora/backoff v0.0.0-20180909062703-3050d21c67d7 h1:K//n/AqR5HjG3qxbrBCL4vJPW0MVFSs9CPK1OOJdRME=
github.com/jpillora/backoff v0.0.0-20170918002102-8eab2debe79d/go.mod h1:2iMrUgbbvHEiQClaW2NsSzMyGHqN+rDFqY705q49KG0= github.com/jpillora/backoff v0.0.0-20180909062703-3050d21c67d7/go.mod h1:2iMrUgbbvHEiQClaW2NsSzMyGHqN+rDFqY705q49KG0=
github.com/jtolds/gls v4.2.1+incompatible h1:fSuqC+Gmlu6l/ZYAoZzx2pyucC8Xza35fpRVWLVmUEE= github.com/jtolds/gls v4.2.1+incompatible h1:fSuqC+Gmlu6l/ZYAoZzx2pyucC8Xza35fpRVWLVmUEE=
github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
github.com/kjk/betterguid v0.0.0-20170621091430-c442874ba63a h1:b+Gt8sQs//Sl5Dcem5zP9Qc2FgEUAygREa2AAa2Vmcw= github.com/kjk/betterguid v0.0.0-20170621091430-c442874ba63a h1:b+Gt8sQs//Sl5Dcem5zP9Qc2FgEUAygREa2AAa2Vmcw=
@ -69,72 +69,79 @@ github.com/magiconair/properties v1.8.0 h1:LLgXmsheXeRoUOBOjtwPQCWIYqM/LU1ayDtDe
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329 h1:2gxZ0XQIU/5z3Z3bUBu+FXuk2pFbkN6tcwi/pjyaDic= github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329 h1:2gxZ0XQIU/5z3Z3bUBu+FXuk2pFbkN6tcwi/pjyaDic=
github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/miekg/dns v1.0.8 h1:Zi8HNpze3NeRWH1PQV6O71YcvJRQ6j0lORO6DAEmAAI= github.com/miekg/dns v1.0.12 h1:814rTNaw7Q7pGncpSEDT06YS8rdGmpUEnKgpQzctJsk=
github.com/miekg/dns v1.0.8/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/miekg/dns v1.0.12/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
github.com/mitchellh/go-homedir v1.0.0 h1:vKb8ShqSby24Yrqr/yDYkuFz8d0WUjys40rvnGC8aR0= github.com/mitchellh/go-homedir v1.0.0 h1:vKb8ShqSby24Yrqr/yDYkuFz8d0WUjys40rvnGC8aR0=
github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/mitchellh/mapstructure v1.0.0 h1:vVpGvMXJPqSDh2VYHF7gsfQj8Ncx+Xw5Y1KHeTRY+7I= github.com/mitchellh/mapstructure v1.0.0 h1:vVpGvMXJPqSDh2VYHF7gsfQj8Ncx+Xw5Y1KHeTRY+7I=
github.com/mitchellh/mapstructure v1.0.0/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.0.0/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE=
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/mschoch/smat v0.0.0-20160514031455-90eadee771ae h1:VeRdUYdCw49yizlSbMEn2SZ+gT+3IUKx8BqxyQdz+BY= github.com/mschoch/smat v0.0.0-20160514031455-90eadee771ae h1:VeRdUYdCw49yizlSbMEn2SZ+gT+3IUKx8BqxyQdz+BY=
github.com/mschoch/smat v0.0.0-20160514031455-90eadee771ae/go.mod h1:qAyveg+e4CE+eKJXWVjKXM4ck2QobLqTDytGJbLLhJg= github.com/mschoch/smat v0.0.0-20160514031455-90eadee771ae/go.mod h1:qAyveg+e4CE+eKJXWVjKXM4ck2QobLqTDytGJbLLhJg=
github.com/onsi/ginkgo v1.6.0 h1:Ix8l273rp3QzYgXSR+c8d1fTG7UPgYkOSELPhiY/YGw= github.com/onsi/ginkgo v1.6.0 h1:Ix8l273rp3QzYgXSR+c8d1fTG7UPgYkOSELPhiY/YGw=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/gomega v1.4.1 h1:PZSj/UFNaVp3KxrzHOcS7oyuWA7LoOY/77yCTEFu21U= github.com/onsi/gomega v1.4.2 h1:3mYCb7aPxS/RU7TI1y4rkEn1oKmPRjNJLNEXgw7MH2I=
github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.4.2/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc=
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
github.com/philhofer/fwd v1.0.0 h1:UbZqGr5Y38ApvM/V/jEljVxwocdweyH+vmYvRPBnbqQ= github.com/philhofer/fwd v1.0.0 h1:UbZqGr5Y38ApvM/V/jEljVxwocdweyH+vmYvRPBnbqQ=
github.com/philhofer/fwd v1.0.0/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= github.com/philhofer/fwd v1.0.0/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/smartystreets/assertions v0.0.0-20180820201707-7c9eb446e3cf h1:6V1qxN6Usn4jy8unvggSJz/NC790tefw8Zdy6OZS5co= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
github.com/smartystreets/assertions v0.0.0-20180820201707-7c9eb446e3cf/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/goconvey v0.0.0-20180222194500-ef6db91d284a h1:JSvGDIbmil4Ui/dDdFBExb7/cmkNjyX5F97oglmvCDo= github.com/smartystreets/goconvey v0.0.0-20180222194500-ef6db91d284a h1:JSvGDIbmil4Ui/dDdFBExb7/cmkNjyX5F97oglmvCDo=
github.com/smartystreets/goconvey v0.0.0-20180222194500-ef6db91d284a/go.mod h1:XDJAKZRPZ1CvBcN2aX5YOUTYGHki24fSF0Iv48Ibg0s= github.com/smartystreets/goconvey v0.0.0-20180222194500-ef6db91d284a/go.mod h1:XDJAKZRPZ1CvBcN2aX5YOUTYGHki24fSF0Iv48Ibg0s=
github.com/spf13/afero v1.1.1 h1:Lt3ihYMlE+lreX1GS4Qw4ZsNpYQLxIXKBTEOXm3nt6I= github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI=
github.com/spf13/afero v1.1.1/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
github.com/spf13/cast v1.2.0 h1:HHl1DSRbEQN2i8tJmtS6ViPyHx35+p51amrdsiTCrkg= github.com/spf13/cast v1.2.0 h1:HHl1DSRbEQN2i8tJmtS6ViPyHx35+p51amrdsiTCrkg=
github.com/spf13/cast v1.2.0/go.mod h1:r2rcYCSwa1IExKTDiTfzaxqT2FNHs8hODu4LnUfgKEg= github.com/spf13/cast v1.2.0/go.mod h1:r2rcYCSwa1IExKTDiTfzaxqT2FNHs8hODu4LnUfgKEg=
github.com/spf13/cobra v0.0.3 h1:ZlrZ4XsMRm04Fr5pSFxBgfND2EBVa1nLpiy1stUsX/8= github.com/spf13/cobra v0.0.3 h1:ZlrZ4XsMRm04Fr5pSFxBgfND2EBVa1nLpiy1stUsX/8=
github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
github.com/spf13/jwalterweatherman v0.0.0-20180814060501-14d3d4c51834 h1:kJI9pPzfsULT/72wy7mxkRQZPtKWgFdCA2RTGZ4v8/E= github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk=
github.com/spf13/jwalterweatherman v0.0.0-20180814060501-14d3d4c51834/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
github.com/spf13/pflag v1.0.2 h1:Fy0orTDgHdbnzHcsOgfCN4LtHf0ec3wwtiwJqwvf3Gc= github.com/spf13/pflag v1.0.2 h1:Fy0orTDgHdbnzHcsOgfCN4LtHf0ec3wwtiwJqwvf3Gc=
github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/spf13/viper v1.1.0 h1:V7OZpY8i3C1x/pDmU0zNNlfVoDz112fSYvtWMjjS3f4= github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg=
github.com/spf13/viper v1.1.0/go.mod h1:A8kyI5cUJhb8N+3pkfONlcEcZbueH6nhAm0Fq7SrnBM= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/spf13/viper v1.2.1 h1:bIcUwXqLseLF3BDAZduuNfekWG87ibtFxi59Bq+oI9M=
github.com/spf13/viper v1.2.1/go.mod h1:P4AexN0a+C9tGAnUFNwDMYYZv3pjFuvmeiMyKRaNVlI=
github.com/steveyen/gtreap v0.0.0-20150807155958-0abe01ef9be2 h1:JNEGSiWg6D3lcBCMCBqN3ELniXujt+0QNHLhNnO0w3s= github.com/steveyen/gtreap v0.0.0-20150807155958-0abe01ef9be2 h1:JNEGSiWg6D3lcBCMCBqN3ELniXujt+0QNHLhNnO0w3s=
github.com/steveyen/gtreap v0.0.0-20150807155958-0abe01ef9be2/go.mod h1:mjqs7N0Q6m5HpR7QfXVBZXZWSqTjQLeTujjA/xUp2uw= github.com/steveyen/gtreap v0.0.0-20150807155958-0abe01ef9be2/go.mod h1:mjqs7N0Q6m5HpR7QfXVBZXZWSqTjQLeTujjA/xUp2uw=
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/syndtr/goleveldb v0.0.0-20180815032940-ae2bd5eed72d h1:4J9HCZVpvDmj2tiKGSTUnb3Ok/9CEQb9oqu9LHKQQpc= github.com/syndtr/goleveldb v0.0.0-20180815032940-ae2bd5eed72d h1:4J9HCZVpvDmj2tiKGSTUnb3Ok/9CEQb9oqu9LHKQQpc=
github.com/syndtr/goleveldb v0.0.0-20180815032940-ae2bd5eed72d/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0= github.com/syndtr/goleveldb v0.0.0-20180815032940-ae2bd5eed72d/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0=
github.com/tecbot/gorocksdb v0.0.0-20180730101644-8b1d981498e1 h1:RHZn+N/7zUNd1vhTmoy4OUcizIHrhskE7kR3v2HEMTg= github.com/tecbot/gorocksdb v0.0.0-20180907100951-214b6b7bc0f0 h1:EEAoIgdGCLu3zSryPb/VFHaIGxDlgku3BflSZAtvJD0=
github.com/tecbot/gorocksdb v0.0.0-20180730101644-8b1d981498e1/go.mod h1:ahpPrc7HpcfEWDQRZEmnXMzHY03mLDYMCxeDzy46i+8= github.com/tecbot/gorocksdb v0.0.0-20180907100951-214b6b7bc0f0/go.mod h1:ahpPrc7HpcfEWDQRZEmnXMzHY03mLDYMCxeDzy46i+8=
github.com/tinylib/msgp v0.0.0-20180215042507-3b5c87ab5fb0 h1:uAwzi+JwkDdOtQZVqPYljFvJr7i43ZgUYXKypk9Eibk= github.com/tinylib/msgp v0.0.0-20180215042507-3b5c87ab5fb0 h1:uAwzi+JwkDdOtQZVqPYljFvJr7i43ZgUYXKypk9Eibk=
github.com/tinylib/msgp v0.0.0-20180215042507-3b5c87ab5fb0/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE= github.com/tinylib/msgp v0.0.0-20180215042507-3b5c87ab5fb0/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE=
github.com/willf/bitset v1.1.9 h1:GBtFynGY9ZWZmEC9sWuu41/7VBXPFCOAbCbqTflOg9c= github.com/willf/bitset v1.1.9 h1:GBtFynGY9ZWZmEC9sWuu41/7VBXPFCOAbCbqTflOg9c=
github.com/willf/bitset v1.1.9/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4= github.com/willf/bitset v1.1.9/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4=
github.com/xenolf/lego v1.0.1 h1:Rr9iqO8MoNxY6OvqdIZTnNZ8bwt0RNz00nGXfoTq4Bc= github.com/xenolf/lego v1.0.1 h1:Rr9iqO8MoNxY6OvqdIZTnNZ8bwt0RNz00nGXfoTq4Bc=
github.com/xenolf/lego v1.0.1/go.mod h1:fwiGnfsIjG7OHPfOvgK7Y/Qo6+2Ox0iozjNTkZICKbY= github.com/xenolf/lego v1.0.1/go.mod h1:fwiGnfsIjG7OHPfOvgK7Y/Qo6+2Ox0iozjNTkZICKbY=
golang.org/x/crypto v0.0.0-20180830192347-182538f80094 h1:rVTAlhYa4+lCfNxmAIEOGQRoD23UqP72M3+rSWVGDTg= golang.org/x/crypto v0.0.0-20181001203147-e3636079e1a4 h1:Vk3wNqEZwyGyei9yq5ekj7frek2u7HUfffJ1/opblzc=
golang.org/x/crypto v0.0.0-20180830192347-182538f80094/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181001203147-e3636079e1a4/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d h1:g9qWBGx4puODJTMVyoPrpoxPFgVGd+z1DZwjfRu4d0I= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181005035420-146acd28ed58 h1:otZG8yDCO4LVps5+9bxOeNiCvgmOyt96J3roHTYs7oE=
golang.org/x/net v0.0.0-20181005035420-146acd28ed58/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522 h1:Ve1ORMCxvRmSXBwJK+t3Oy+V2vRW2OetUQBq4rJIkZE= golang.org/x/sys v0.0.0-20180906133057-8cf3aee42992/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/text v0.0.0-20180410181320-7922cc490dd5 h1:JuX0hiV/F4xp4w8qqbN49Nsatovt4Kckp6J/5EbNi9Y= golang.org/x/sys v0.0.0-20181005133103-4497e2df6f9e h1:EfdBzeKbFSvOjoIqSZcfS8wp0FBLokGBEs9lz1OtSg0=
golang.org/x/text v0.0.0-20180410181320-7922cc490dd5/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/sys v0.0.0-20181005133103-4497e2df6f9e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/square/go-jose.v2 v2.1.8 h1:yECBkTX7ypNaRFILw4trAAYXRLvcGxTeHCBKj/fc8gU= gopkg.in/square/go-jose.v2 v2.1.9 h1:YCFbL5T2gbmC2sMG12s1x2PAlTK5TZNte3hjZEIcCAg=
gopkg.in/square/go-jose.v2 v2.1.8/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= gopkg.in/square/go-jose.v2 v2.1.9/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE= gopkg.in/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE=

View File

@ -38,8 +38,7 @@ type Builder struct {
encoder encoder encoder encoder
opts *BuilderOpts opts *BuilderOpts
builderNodePool builderNodePool builderNodePool *builderNodePool
transitionPool transitionPool
} }
const noneAddr = 1 const noneAddr = 1
@ -51,12 +50,14 @@ func newBuilder(w io.Writer, opts *BuilderOpts) (*Builder, error) {
if opts == nil { if opts == nil {
opts = defaultBuilderOpts opts = defaultBuilderOpts
} }
builderNodePool := &builderNodePool{}
rv := &Builder{ rv := &Builder{
registry: newRegistry(opts.RegistryTableSize, opts.RegistryMRUSize), unfinished: newUnfinishedNodes(builderNodePool),
opts: opts, registry: newRegistry(builderNodePool, opts.RegistryTableSize, opts.RegistryMRUSize),
lastAddr: noneAddr, builderNodePool: builderNodePool,
opts: opts,
lastAddr: noneAddr,
} }
rv.unfinished = newUnfinishedNodes(&rv.builderNodePool)
var err error var err error
rv.encoder, err = loadEncoder(opts.Encoder, w) rv.encoder, err = loadEncoder(opts.Encoder, w)
@ -71,9 +72,7 @@ func newBuilder(w io.Writer, opts *BuilderOpts) (*Builder, error) {
} }
func (b *Builder) Reset(w io.Writer) error { func (b *Builder) Reset(w io.Writer) error {
b.transitionPool.reset() b.unfinished.Reset()
b.builderNodePool.reset()
b.unfinished.Reset(&b.builderNodePool)
b.registry.Reset() b.registry.Reset()
b.lastAddr = noneAddr b.lastAddr = noneAddr
b.encoder.reset(w) b.encoder.reset(w)
@ -107,7 +106,7 @@ func (b *Builder) Insert(key []byte, val uint64) error {
return err return err
} }
b.copyLastKey(key) b.copyLastKey(key)
b.unfinished.addSuffix(key[prefixLen:], out, &b.builderNodePool) b.unfinished.addSuffix(key[prefixLen:], out)
return nil return nil
} }
@ -142,7 +141,7 @@ func (b *Builder) compileFrom(iState int) error {
if addr == noneAddr { if addr == noneAddr {
node = b.unfinished.popEmpty() node = b.unfinished.popEmpty()
} else { } else {
node = b.unfinished.popFreeze(addr, &b.transitionPool) node = b.unfinished.popFreeze(addr)
} }
var err error var err error
addr, err = b.compile(node) addr, err = b.compile(node)
@ -150,7 +149,7 @@ func (b *Builder) compileFrom(iState int) error {
return nil return nil
} }
} }
b.unfinished.topLastFreeze(addr, &b.transitionPool) b.unfinished.topLastFreeze(addr)
return nil return nil
} }
@ -183,22 +182,25 @@ type unfinishedNodes struct {
// this means calls get() and pushXYZ() must be paired, // this means calls get() and pushXYZ() must be paired,
// as well as calls put() and popXYZ() // as well as calls put() and popXYZ()
cache []builderNodeUnfinished cache []builderNodeUnfinished
builderNodePool *builderNodePool
} }
func (u *unfinishedNodes) Reset(p *builderNodePool) { func (u *unfinishedNodes) Reset() {
u.stack = u.stack[:0] u.stack = u.stack[:0]
for i := 0; i < len(u.cache); i++ { for i := 0; i < len(u.cache); i++ {
u.cache[i] = builderNodeUnfinished{} u.cache[i] = builderNodeUnfinished{}
} }
u.pushEmpty(false, p) u.pushEmpty(false)
} }
func newUnfinishedNodes(p *builderNodePool) *unfinishedNodes { func newUnfinishedNodes(p *builderNodePool) *unfinishedNodes {
rv := &unfinishedNodes{ rv := &unfinishedNodes{
stack: make([]*builderNodeUnfinished, 0, 64), stack: make([]*builderNodeUnfinished, 0, 64),
cache: make([]builderNodeUnfinished, 64), cache: make([]builderNodeUnfinished, 64),
builderNodePool: p,
} }
rv.pushEmpty(false, p) rv.pushEmpty(false)
return rv return rv
} }
@ -249,9 +251,9 @@ func (u *unfinishedNodes) findCommonPrefixAndSetOutput(key []byte,
return i, out return i, out
} }
func (u *unfinishedNodes) pushEmpty(final bool, p *builderNodePool) { func (u *unfinishedNodes) pushEmpty(final bool) {
next := u.get() next := u.get()
next.node = p.alloc() next.node = u.builderNodePool.Get()
next.node.final = final next.node.final = final
u.stack = append(u.stack, next) u.stack = append(u.stack, next)
} }
@ -265,11 +267,11 @@ func (u *unfinishedNodes) popRoot() *builderNode {
return rv return rv
} }
func (u *unfinishedNodes) popFreeze(addr int, tp *transitionPool) *builderNode { func (u *unfinishedNodes) popFreeze(addr int) *builderNode {
l := len(u.stack) l := len(u.stack)
var unfinished *builderNodeUnfinished var unfinished *builderNodeUnfinished
u.stack, unfinished = u.stack[:l-1], u.stack[l-1] u.stack, unfinished = u.stack[:l-1], u.stack[l-1]
unfinished.lastCompiled(addr, tp) unfinished.lastCompiled(addr)
rv := unfinished.node rv := unfinished.node
u.put() u.put()
return rv return rv
@ -289,12 +291,12 @@ func (u *unfinishedNodes) setRootOutput(out uint64) {
u.stack[0].node.finalOutput = out u.stack[0].node.finalOutput = out
} }
func (u *unfinishedNodes) topLastFreeze(addr int, tp *transitionPool) { func (u *unfinishedNodes) topLastFreeze(addr int) {
last := len(u.stack) - 1 last := len(u.stack) - 1
u.stack[last].lastCompiled(addr, tp) u.stack[last].lastCompiled(addr)
} }
func (u *unfinishedNodes) addSuffix(bs []byte, out uint64, p *builderNodePool) { func (u *unfinishedNodes) addSuffix(bs []byte, out uint64) {
if len(bs) == 0 { if len(bs) == 0 {
return return
} }
@ -304,13 +306,13 @@ func (u *unfinishedNodes) addSuffix(bs []byte, out uint64, p *builderNodePool) {
u.stack[last].lastOut = out u.stack[last].lastOut = out
for _, b := range bs[1:] { for _, b := range bs[1:] {
next := u.get() next := u.get()
next.node = p.alloc() next.node = u.builderNodePool.Get()
next.hasLastT = true next.hasLastT = true
next.lastIn = b next.lastIn = b
next.lastOut = 0 next.lastOut = 0
u.stack = append(u.stack, next) u.stack = append(u.stack, next)
} }
u.pushEmpty(true, p) u.pushEmpty(true)
} }
type builderNodeUnfinished struct { type builderNodeUnfinished struct {
@ -320,17 +322,17 @@ type builderNodeUnfinished struct {
hasLastT bool hasLastT bool
} }
func (b *builderNodeUnfinished) lastCompiled(addr int, tp *transitionPool) { func (b *builderNodeUnfinished) lastCompiled(addr int) {
if b.hasLastT { if b.hasLastT {
transIn := b.lastIn transIn := b.lastIn
transOut := b.lastOut transOut := b.lastOut
b.hasLastT = false b.hasLastT = false
b.lastOut = 0 b.lastOut = 0
trans := tp.alloc() b.node.trans = append(b.node.trans, transition{
trans.in = transIn in: transIn,
trans.out = transOut out: transOut,
trans.addr = addr addr: addr,
b.node.trans = append(b.node.trans, trans) })
} }
} }
@ -338,8 +340,8 @@ func (b *builderNodeUnfinished) addOutputPrefix(prefix uint64) {
if b.node.final { if b.node.final {
b.node.finalOutput = outputCat(prefix, b.node.finalOutput) b.node.finalOutput = outputCat(prefix, b.node.finalOutput)
} }
for _, t := range b.node.trans { for i := range b.node.trans {
t.out = outputCat(prefix, t.out) b.node.trans[i].out = outputCat(prefix, b.node.trans[i].out)
} }
if b.hasLastT { if b.hasLastT {
b.lastOut = outputCat(prefix, b.lastOut) b.lastOut = outputCat(prefix, b.lastOut)
@ -348,8 +350,22 @@ func (b *builderNodeUnfinished) addOutputPrefix(prefix uint64) {
type builderNode struct { type builderNode struct {
finalOutput uint64 finalOutput uint64
trans []*transition trans []transition
final bool final bool
// intrusive linked list
next *builderNode
}
// reset resets the receiver builderNode to a re-usable state.
func (n *builderNode) reset() {
n.final = false
n.finalOutput = 0
for i := range n.trans {
n.trans[i] = emptyTransition
}
n.trans = n.trans[:0]
n.next = nil
} }
func (n *builderNode) equiv(o *builderNode) bool { func (n *builderNode) equiv(o *builderNode) bool {
@ -377,6 +393,8 @@ func (n *builderNode) equiv(o *builderNode) bool {
return true return true
} }
var emptyTransition = transition{}
type transition struct { type transition struct {
out uint64 out uint64
addr int addr int
@ -398,56 +416,37 @@ func outputCat(l, r uint64) uint64 {
return l + r return l + r
} }
// the next builderNode to alloc() will be all[nextOuter][nextInner] // builderNodePool pools builderNodes using a singly linked list.
//
// NB: builderNode lifecylce is described by the following interactions -
// +------------------------+ +----------------------+
// | Unfinished Nodes | Transfer once | Registry |
// |(not frozen builderNode)|-----builderNode is ------->| (frozen builderNode) |
// +------------------------+ marked frozen +----------------------+
// ^ |
// | |
// | Put()
// | Get() on +-------------------+ when
// +-new char--------| builderNode Pool |<-----------evicted
// +-------------------+
type builderNodePool struct { type builderNodePool struct {
all [][]builderNode head *builderNode
nextOuter int
nextInner int
} }
func (p *builderNodePool) reset() { func (p *builderNodePool) Get() *builderNode {
p.nextOuter = 0 if p.head == nil {
p.nextInner = 0 return &builderNode{}
}
func (p *builderNodePool) alloc() *builderNode {
if p.nextOuter >= len(p.all) {
p.all = append(p.all, make([]builderNode, 256))
} }
rv := &p.all[p.nextOuter][p.nextInner] head := p.head
p.nextInner += 1 p.head = p.head.next
if p.nextInner >= len(p.all[p.nextOuter]) { return head
p.nextOuter += 1
p.nextInner = 0
}
rv.finalOutput = 0
rv.trans = rv.trans[:0]
rv.final = false
return rv
} }
// the next transition to alloc() will be all[nextOuter][nextInner] func (p *builderNodePool) Put(v *builderNode) {
type transitionPool struct { if v == nil {
all [][]transition return
nextOuter int
nextInner int
}
func (p *transitionPool) reset() {
p.nextOuter = 0
p.nextInner = 0
}
func (p *transitionPool) alloc() *transition {
if p.nextOuter >= len(p.all) {
p.all = append(p.all, make([]transition, 256))
} }
rv := &p.all[p.nextOuter][p.nextInner] v.reset()
p.nextInner += 1 v.next = p.head
if p.nextInner >= len(p.all[p.nextOuter]) { p.head = v
p.nextOuter += 1
p.nextInner = 0
}
*rv = transition{}
return rv
} }

View File

@ -29,8 +29,6 @@ func init() {
type decoderV1 struct { type decoderV1 struct {
data []byte data []byte
root uint64
len uint64
} }
func newDecoderV1(data []byte) *decoderV1 { func newDecoderV1(data []byte) *decoderV1 {

View File

@ -14,39 +14,35 @@
package vellum package vellum
import (
"hash"
"hash/fnv"
)
type registryCell struct { type registryCell struct {
addr int addr int
node *builderNode node *builderNode
} }
type registry struct { type registry struct {
table []registryCell builderNodePool *builderNodePool
tableSize uint table []registryCell
mruSize uint tableSize uint
hasher hash.Hash64 mruSize uint
} }
func newRegistry(tableSize, mruSize int) *registry { func newRegistry(p *builderNodePool, tableSize, mruSize int) *registry {
nsize := tableSize * mruSize nsize := tableSize * mruSize
rv := &registry{ rv := &registry{
table: make([]registryCell, nsize), builderNodePool: p,
tableSize: uint(tableSize), table: make([]registryCell, nsize),
mruSize: uint(mruSize), tableSize: uint(tableSize),
hasher: fnv.New64a(), mruSize: uint(mruSize),
} }
return rv return rv
} }
func (r *registry) Reset() { func (r *registry) Reset() {
for i := 0; i < len(r.table); i++ { var empty registryCell
r.table[i] = registryCell{} for i := range r.table {
r.builderNodePool.Put(r.table[i].node)
r.table[i] = empty
} }
r.hasher.Reset()
} }
func (r *registry) entry(node *builderNode) (bool, int, *registryCell) { func (r *registry) entry(node *builderNode) (bool, int, *registryCell) {
@ -57,7 +53,7 @@ func (r *registry) entry(node *builderNode) (bool, int, *registryCell) {
start := r.mruSize * uint(bucket) start := r.mruSize * uint(bucket)
end := start + r.mruSize end := start + r.mruSize
rc := registryCache(r.table[start:end]) rc := registryCache(r.table[start:end])
return rc.entry(node) return rc.entry(node, r.builderNodePool)
} }
const fnvPrime = 1099511628211 const fnvPrime = 1099511628211
@ -81,11 +77,12 @@ func (r *registry) hash(b *builderNode) int {
type registryCache []registryCell type registryCache []registryCell
func (r registryCache) entry(node *builderNode) (bool, int, *registryCell) { func (r registryCache) entry(node *builderNode, pool *builderNodePool) (bool, int, *registryCell) {
if len(r) == 1 { if len(r) == 1 {
if r[0].node != nil && r[0].node.equiv(node) { if r[0].node != nil && r[0].node.equiv(node) {
return true, r[0].addr, nil return true, r[0].addr, nil
} }
pool.Put(r[0].node)
r[0].node = node r[0].node = node
return false, 0, &r[0] return false, 0, &r[0]
} }
@ -98,6 +95,7 @@ func (r registryCache) entry(node *builderNode) (bool, int, *registryCell) {
} }
// no match // no match
last := len(r) - 1 last := len(r) - 1
pool.Put(r[last].node)
r[last].node = node // discard LRU r[last].node = node // discard LRU
r.promote(last) r.promote(last)
return false, 0, &r[0] return false, 0, &r[0]

View File

@ -3,13 +3,11 @@ sudo: false
matrix: matrix:
include: include:
- go: 1.4
- go: 1.5.x
- go: 1.6.x
- go: 1.7.x - go: 1.7.x
- go: 1.8.x - go: 1.8.x
- go: 1.9.x - go: 1.9.x
- go: 1.10.x - go: 1.10.x
- go: 1.11.x
- go: tip - go: tip
allow_failures: allow_failures:
- go: tip - go: tip

View File

@ -6,12 +6,14 @@ package websocket
import ( import (
"bytes" "bytes"
"context"
"crypto/tls" "crypto/tls"
"errors" "errors"
"io" "io"
"io/ioutil" "io/ioutil"
"net" "net"
"net/http" "net/http"
"net/http/httptrace"
"net/url" "net/url"
"strings" "strings"
"time" "time"
@ -51,6 +53,10 @@ type Dialer struct {
// NetDial is nil, net.Dial is used. // NetDial is nil, net.Dial is used.
NetDial func(network, addr string) (net.Conn, error) NetDial func(network, addr string) (net.Conn, error)
// NetDialContext specifies the dial function for creating TCP connections. If
// NetDialContext is nil, net.DialContext is used.
NetDialContext func(ctx context.Context, network, addr string) (net.Conn, error)
// Proxy specifies a function to return a proxy for a given // Proxy specifies a function to return a proxy for a given
// Request. If the function returns a non-nil error, the // Request. If the function returns a non-nil error, the
// request is aborted with the provided error. // request is aborted with the provided error.
@ -69,6 +75,17 @@ type Dialer struct {
// do not limit the size of the messages that can be sent or received. // do not limit the size of the messages that can be sent or received.
ReadBufferSize, WriteBufferSize int ReadBufferSize, WriteBufferSize int
// WriteBufferPool is a pool of buffers for write operations. If the value
// is not set, then write buffers are allocated to the connection for the
// lifetime of the connection.
//
// A pool is most useful when the application has a modest volume of writes
// across a large number of connections.
//
// Applications should use a single pool for each unique value of
// WriteBufferSize.
WriteBufferPool BufferPool
// Subprotocols specifies the client's requested subprotocols. // Subprotocols specifies the client's requested subprotocols.
Subprotocols []string Subprotocols []string
@ -84,6 +101,11 @@ type Dialer struct {
Jar http.CookieJar Jar http.CookieJar
} }
// Dial creates a new client connection by calling DialContext with a background context.
func (d *Dialer) Dial(urlStr string, requestHeader http.Header) (*Conn, *http.Response, error) {
return d.DialContext(context.Background(), urlStr, requestHeader)
}
var errMalformedURL = errors.New("malformed ws or wss URL") var errMalformedURL = errors.New("malformed ws or wss URL")
func hostPortNoPort(u *url.URL) (hostPort, hostNoPort string) { func hostPortNoPort(u *url.URL) (hostPort, hostNoPort string) {
@ -111,19 +133,20 @@ var DefaultDialer = &Dialer{
} }
// nilDialer is dialer to use when receiver is nil. // nilDialer is dialer to use when receiver is nil.
var nilDialer Dialer = *DefaultDialer var nilDialer = *DefaultDialer
// Dial creates a new client connection. Use requestHeader to specify the // DialContext creates a new client connection. Use requestHeader to specify the
// origin (Origin), subprotocols (Sec-WebSocket-Protocol) and cookies (Cookie). // origin (Origin), subprotocols (Sec-WebSocket-Protocol) and cookies (Cookie).
// Use the response.Header to get the selected subprotocol // Use the response.Header to get the selected subprotocol
// (Sec-WebSocket-Protocol) and cookies (Set-Cookie). // (Sec-WebSocket-Protocol) and cookies (Set-Cookie).
// //
// The context will be used in the request and in the Dialer
//
// If the WebSocket handshake fails, ErrBadHandshake is returned along with a // If the WebSocket handshake fails, ErrBadHandshake is returned along with a
// non-nil *http.Response so that callers can handle redirects, authentication, // non-nil *http.Response so that callers can handle redirects, authentication,
// etcetera. The response body may not contain the entire response and does not // etcetera. The response body may not contain the entire response and does not
// need to be closed by the application. // need to be closed by the application.
func (d *Dialer) Dial(urlStr string, requestHeader http.Header) (*Conn, *http.Response, error) { func (d *Dialer) DialContext(ctx context.Context, urlStr string, requestHeader http.Header) (*Conn, *http.Response, error) {
if d == nil { if d == nil {
d = &nilDialer d = &nilDialer
} }
@ -161,6 +184,7 @@ func (d *Dialer) Dial(urlStr string, requestHeader http.Header) (*Conn, *http.Re
Header: make(http.Header), Header: make(http.Header),
Host: u.Host, Host: u.Host,
} }
req = req.WithContext(ctx)
// Set the cookies present in the cookie jar of the dialer // Set the cookies present in the cookie jar of the dialer
if d.Jar != nil { if d.Jar != nil {
@ -204,20 +228,30 @@ func (d *Dialer) Dial(urlStr string, requestHeader http.Header) (*Conn, *http.Re
req.Header["Sec-WebSocket-Extensions"] = []string{"permessage-deflate; server_no_context_takeover; client_no_context_takeover"} req.Header["Sec-WebSocket-Extensions"] = []string{"permessage-deflate; server_no_context_takeover; client_no_context_takeover"}
} }
var deadline time.Time
if d.HandshakeTimeout != 0 { if d.HandshakeTimeout != 0 {
deadline = time.Now().Add(d.HandshakeTimeout) var cancel func()
ctx, cancel = context.WithTimeout(ctx, d.HandshakeTimeout)
defer cancel()
} }
// Get network dial function. // Get network dial function.
netDial := d.NetDial var netDial func(network, add string) (net.Conn, error)
if netDial == nil {
netDialer := &net.Dialer{Deadline: deadline} if d.NetDialContext != nil {
netDial = netDialer.Dial netDial = func(network, addr string) (net.Conn, error) {
return d.NetDialContext(ctx, network, addr)
}
} else if d.NetDial != nil {
netDial = d.NetDial
} else {
netDialer := &net.Dialer{}
netDial = func(network, addr string) (net.Conn, error) {
return netDialer.DialContext(ctx, network, addr)
}
} }
// If needed, wrap the dial function to set the connection deadline. // If needed, wrap the dial function to set the connection deadline.
if !deadline.Equal(time.Time{}) { if deadline, ok := ctx.Deadline(); ok {
forwardDial := netDial forwardDial := netDial
netDial = func(network, addr string) (net.Conn, error) { netDial = func(network, addr string) (net.Conn, error) {
c, err := forwardDial(network, addr) c, err := forwardDial(network, addr)
@ -249,7 +283,17 @@ func (d *Dialer) Dial(urlStr string, requestHeader http.Header) (*Conn, *http.Re
} }
hostPort, hostNoPort := hostPortNoPort(u) hostPort, hostNoPort := hostPortNoPort(u)
trace := httptrace.ContextClientTrace(ctx)
if trace != nil && trace.GetConn != nil {
trace.GetConn(hostPort)
}
netConn, err := netDial("tcp", hostPort) netConn, err := netDial("tcp", hostPort)
if trace != nil && trace.GotConn != nil {
trace.GotConn(httptrace.GotConnInfo{
Conn: netConn,
})
}
if err != nil { if err != nil {
return nil, nil, err return nil, nil, err
} }
@ -267,22 +311,31 @@ func (d *Dialer) Dial(urlStr string, requestHeader http.Header) (*Conn, *http.Re
} }
tlsConn := tls.Client(netConn, cfg) tlsConn := tls.Client(netConn, cfg)
netConn = tlsConn netConn = tlsConn
if err := tlsConn.Handshake(); err != nil {
return nil, nil, err var err error
if trace != nil {
err = doHandshakeWithTrace(trace, tlsConn, cfg)
} else {
err = doHandshake(tlsConn, cfg)
} }
if !cfg.InsecureSkipVerify {
if err := tlsConn.VerifyHostname(cfg.ServerName); err != nil { if err != nil {
return nil, nil, err return nil, nil, err
}
} }
} }
conn := newConn(netConn, false, d.ReadBufferSize, d.WriteBufferSize) conn := newConn(netConn, false, d.ReadBufferSize, d.WriteBufferSize, d.WriteBufferPool, nil, nil)
if err := req.Write(netConn); err != nil { if err := req.Write(netConn); err != nil {
return nil, nil, err return nil, nil, err
} }
if trace != nil && trace.GotFirstResponseByte != nil {
if peek, err := conn.br.Peek(1); err == nil && len(peek) == 1 {
trace.GotFirstResponseByte()
}
}
resp, err := http.ReadResponse(conn.br, req) resp, err := http.ReadResponse(conn.br, req)
if err != nil { if err != nil {
return nil, nil, err return nil, nil, err
@ -328,3 +381,15 @@ func (d *Dialer) Dial(urlStr string, requestHeader http.Header) (*Conn, *http.Re
netConn = nil // to avoid close in defer. netConn = nil // to avoid close in defer.
return conn, resp, nil return conn, resp, nil
} }
func doHandshake(tlsConn *tls.Conn, cfg *tls.Config) error {
if err := tlsConn.Handshake(); err != nil {
return err
}
if !cfg.InsecureSkipVerify {
if err := tlsConn.VerifyHostname(cfg.ServerName); err != nil {
return err
}
}
return nil
}

View File

@ -223,6 +223,20 @@ func isValidReceivedCloseCode(code int) bool {
return validReceivedCloseCodes[code] || (code >= 3000 && code <= 4999) return validReceivedCloseCodes[code] || (code >= 3000 && code <= 4999)
} }
// BufferPool represents a pool of buffers. The *sync.Pool type satisfies this
// interface. The type of the value stored in a pool is not specified.
type BufferPool interface {
// Get gets a value from the pool or returns nil if the pool is empty.
Get() interface{}
// Put adds a value to the pool.
Put(interface{})
}
// writePoolData is the type added to the write buffer pool. This wrapper is
// used to prevent applications from peeking at and depending on the values
// added to the pool.
type writePoolData struct{ buf []byte }
// The Conn type represents a WebSocket connection. // The Conn type represents a WebSocket connection.
type Conn struct { type Conn struct {
conn net.Conn conn net.Conn
@ -232,6 +246,8 @@ type Conn struct {
// Write fields // Write fields
mu chan bool // used as mutex to protect write to conn mu chan bool // used as mutex to protect write to conn
writeBuf []byte // frame is constructed in this buffer. writeBuf []byte // frame is constructed in this buffer.
writePool BufferPool
writeBufSize int
writeDeadline time.Time writeDeadline time.Time
writer io.WriteCloser // the current writer returned to the application writer io.WriteCloser // the current writer returned to the application
isWriting bool // for best-effort concurrent write detection isWriting bool // for best-effort concurrent write detection
@ -263,64 +279,29 @@ type Conn struct {
newDecompressionReader func(io.Reader) io.ReadCloser newDecompressionReader func(io.Reader) io.ReadCloser
} }
func newConn(conn net.Conn, isServer bool, readBufferSize, writeBufferSize int) *Conn { func newConn(conn net.Conn, isServer bool, readBufferSize, writeBufferSize int, writeBufferPool BufferPool, br *bufio.Reader, writeBuf []byte) *Conn {
return newConnBRW(conn, isServer, readBufferSize, writeBufferSize, nil)
}
type writeHook struct {
p []byte
}
func (wh *writeHook) Write(p []byte) (int, error) {
wh.p = p
return len(p), nil
}
func newConnBRW(conn net.Conn, isServer bool, readBufferSize, writeBufferSize int, brw *bufio.ReadWriter) *Conn {
mu := make(chan bool, 1)
mu <- true
var br *bufio.Reader
if readBufferSize == 0 && brw != nil && brw.Reader != nil {
// Reuse the supplied bufio.Reader if the buffer has a useful size.
// This code assumes that peek on a reader returns
// bufio.Reader.buf[:0].
brw.Reader.Reset(conn)
if p, err := brw.Reader.Peek(0); err == nil && cap(p) >= 256 {
br = brw.Reader
}
}
if br == nil { if br == nil {
if readBufferSize == 0 { if readBufferSize == 0 {
readBufferSize = defaultReadBufferSize readBufferSize = defaultReadBufferSize
} } else if readBufferSize < maxControlFramePayloadSize {
if readBufferSize < maxControlFramePayloadSize { // must be large enough for control frame
readBufferSize = maxControlFramePayloadSize readBufferSize = maxControlFramePayloadSize
} }
br = bufio.NewReaderSize(conn, readBufferSize) br = bufio.NewReaderSize(conn, readBufferSize)
} }
var writeBuf []byte if writeBufferSize <= 0 {
if writeBufferSize == 0 && brw != nil && brw.Writer != nil { writeBufferSize = defaultWriteBufferSize
// Use the bufio.Writer's buffer if the buffer has a useful size. This }
// code assumes that bufio.Writer.buf[:1] is passed to the writeBufferSize += maxFrameHeaderSize
// bufio.Writer's underlying writer.
var wh writeHook if writeBuf == nil && writeBufferPool == nil {
brw.Writer.Reset(&wh) writeBuf = make([]byte, writeBufferSize)
brw.Writer.WriteByte(0)
brw.Flush()
if cap(wh.p) >= maxFrameHeaderSize+256 {
writeBuf = wh.p[:cap(wh.p)]
}
}
if writeBuf == nil {
if writeBufferSize == 0 {
writeBufferSize = defaultWriteBufferSize
}
writeBuf = make([]byte, writeBufferSize+maxFrameHeaderSize)
} }
mu := make(chan bool, 1)
mu <- true
c := &Conn{ c := &Conn{
isServer: isServer, isServer: isServer,
br: br, br: br,
@ -328,6 +309,8 @@ func newConnBRW(conn net.Conn, isServer bool, readBufferSize, writeBufferSize in
mu: mu, mu: mu,
readFinal: true, readFinal: true,
writeBuf: writeBuf, writeBuf: writeBuf,
writePool: writeBufferPool,
writeBufSize: writeBufferSize,
enableWriteCompression: true, enableWriteCompression: true,
compressionLevel: defaultCompressionLevel, compressionLevel: defaultCompressionLevel,
} }
@ -370,6 +353,15 @@ func (c *Conn) writeFatal(err error) error {
return err return err
} }
func (c *Conn) read(n int) ([]byte, error) {
p, err := c.br.Peek(n)
if err == io.EOF {
err = errUnexpectedEOF
}
c.br.Discard(len(p))
return p, err
}
func (c *Conn) write(frameType int, deadline time.Time, buf0, buf1 []byte) error { func (c *Conn) write(frameType int, deadline time.Time, buf0, buf1 []byte) error {
<-c.mu <-c.mu
defer func() { c.mu <- true }() defer func() { c.mu <- true }()
@ -475,7 +467,19 @@ func (c *Conn) prepWrite(messageType int) error {
c.writeErrMu.Lock() c.writeErrMu.Lock()
err := c.writeErr err := c.writeErr
c.writeErrMu.Unlock() c.writeErrMu.Unlock()
return err if err != nil {
return err
}
if c.writeBuf == nil {
wpd, ok := c.writePool.Get().(writePoolData)
if ok {
c.writeBuf = wpd.buf
} else {
c.writeBuf = make([]byte, c.writeBufSize)
}
}
return nil
} }
// NextWriter returns a writer for the next message to send. The writer's Close // NextWriter returns a writer for the next message to send. The writer's Close
@ -601,6 +605,10 @@ func (w *messageWriter) flushFrame(final bool, extra []byte) error {
if final { if final {
c.writer = nil c.writer = nil
if c.writePool != nil {
c.writePool.Put(writePoolData{buf: c.writeBuf})
c.writeBuf = nil
}
return nil return nil
} }

View File

@ -1,18 +0,0 @@
// Copyright 2016 The Gorilla WebSocket Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build go1.5
package websocket
import "io"
func (c *Conn) read(n int) ([]byte, error) {
p, err := c.br.Peek(n)
if err == io.EOF {
err = errUnexpectedEOF
}
c.br.Discard(len(p))
return p, err
}

View File

@ -1,21 +0,0 @@
// Copyright 2016 The Gorilla WebSocket Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build !go1.5
package websocket
import "io"
func (c *Conn) read(n int) ([]byte, error) {
p, err := c.br.Peek(n)
if err == io.EOF {
err = errUnexpectedEOF
}
if len(p) > 0 {
// advance over the bytes just read
io.ReadFull(c.br, p)
}
return p, err
}

View File

@ -19,7 +19,6 @@ import (
type PreparedMessage struct { type PreparedMessage struct {
messageType int messageType int
data []byte data []byte
err error
mu sync.Mutex mu sync.Mutex
frames map[prepareKey]*preparedFrame frames map[prepareKey]*preparedFrame
} }

View File

@ -7,7 +7,7 @@ package websocket
import ( import (
"bufio" "bufio"
"errors" "errors"
"net" "io"
"net/http" "net/http"
"net/url" "net/url"
"strings" "strings"
@ -33,6 +33,17 @@ type Upgrader struct {
// or received. // or received.
ReadBufferSize, WriteBufferSize int ReadBufferSize, WriteBufferSize int
// WriteBufferPool is a pool of buffers for write operations. If the value
// is not set, then write buffers are allocated to the connection for the
// lifetime of the connection.
//
// A pool is most useful when the application has a modest volume of writes
// across a large number of connections.
//
// Applications should use a single pool for each unique value of
// WriteBufferSize.
WriteBufferPool BufferPool
// Subprotocols specifies the server's supported protocols in order of // Subprotocols specifies the server's supported protocols in order of
// preference. If this field is not nil, then the Upgrade method negotiates a // preference. If this field is not nil, then the Upgrade method negotiates a
// subprotocol by selecting the first match in this list with a protocol // subprotocol by selecting the first match in this list with a protocol
@ -159,17 +170,12 @@ func (u *Upgrader) Upgrade(w http.ResponseWriter, r *http.Request, responseHeade
} }
} }
var (
netConn net.Conn
err error
)
h, ok := w.(http.Hijacker) h, ok := w.(http.Hijacker)
if !ok { if !ok {
return u.returnError(w, r, http.StatusInternalServerError, "websocket: response does not implement http.Hijacker") return u.returnError(w, r, http.StatusInternalServerError, "websocket: response does not implement http.Hijacker")
} }
var brw *bufio.ReadWriter var brw *bufio.ReadWriter
netConn, brw, err = h.Hijack() netConn, brw, err := h.Hijack()
if err != nil { if err != nil {
return u.returnError(w, r, http.StatusInternalServerError, err.Error()) return u.returnError(w, r, http.StatusInternalServerError, err.Error())
} }
@ -179,7 +185,21 @@ func (u *Upgrader) Upgrade(w http.ResponseWriter, r *http.Request, responseHeade
return nil, errors.New("websocket: client sent data before handshake is complete") return nil, errors.New("websocket: client sent data before handshake is complete")
} }
c := newConnBRW(netConn, true, u.ReadBufferSize, u.WriteBufferSize, brw) var br *bufio.Reader
if u.ReadBufferSize == 0 && bufioReaderSize(netConn, brw.Reader) > 256 {
// Reuse hijacked buffered reader as connection reader.
br = brw.Reader
}
buf := bufioWriterBuffer(netConn, brw.Writer)
var writeBuf []byte
if u.WriteBufferPool == nil && u.WriteBufferSize == 0 && len(buf) >= maxFrameHeaderSize+256 {
// Reuse hijacked write buffer as connection buffer.
writeBuf = buf
}
c := newConn(netConn, true, u.ReadBufferSize, u.WriteBufferSize, u.WriteBufferPool, br, writeBuf)
c.subprotocol = subprotocol c.subprotocol = subprotocol
if compress { if compress {
@ -187,7 +207,13 @@ func (u *Upgrader) Upgrade(w http.ResponseWriter, r *http.Request, responseHeade
c.newDecompressionReader = decompressNoContextTakeover c.newDecompressionReader = decompressNoContextTakeover
} }
p := c.writeBuf[:0] // Use larger of hijacked buffer and connection write buffer for header.
p := buf
if len(c.writeBuf) > len(p) {
p = c.writeBuf
}
p = p[:0]
p = append(p, "HTTP/1.1 101 Switching Protocols\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Accept: "...) p = append(p, "HTTP/1.1 101 Switching Protocols\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Accept: "...)
p = append(p, computeAcceptKey(challengeKey)...) p = append(p, computeAcceptKey(challengeKey)...)
p = append(p, "\r\n"...) p = append(p, "\r\n"...)
@ -298,3 +324,40 @@ func IsWebSocketUpgrade(r *http.Request) bool {
return tokenListContainsValue(r.Header, "Connection", "upgrade") && return tokenListContainsValue(r.Header, "Connection", "upgrade") &&
tokenListContainsValue(r.Header, "Upgrade", "websocket") tokenListContainsValue(r.Header, "Upgrade", "websocket")
} }
// bufioReaderSize size returns the size of a bufio.Reader.
func bufioReaderSize(originalReader io.Reader, br *bufio.Reader) int {
// This code assumes that peek on a reset reader returns
// bufio.Reader.buf[:0].
// TODO: Use bufio.Reader.Size() after Go 1.10
br.Reset(originalReader)
if p, err := br.Peek(0); err == nil {
return cap(p)
}
return 0
}
// writeHook is an io.Writer that records the last slice passed to it vio
// io.Writer.Write.
type writeHook struct {
p []byte
}
func (wh *writeHook) Write(p []byte) (int, error) {
wh.p = p
return len(p), nil
}
// bufioWriterBuffer grabs the buffer from a bufio.Writer.
func bufioWriterBuffer(originalWriter io.Writer, bw *bufio.Writer) []byte {
// This code assumes that bufio.Writer.buf[:1] is passed to the
// bufio.Writer's underlying writer.
var wh writeHook
bw.Reset(&wh)
bw.WriteByte(0)
bw.Flush()
bw.Reset(originalWriter)
return wh.p[:cap(wh.p)]
}

19
vendor/github.com/gorilla/websocket/trace.go generated vendored Normal file
View File

@ -0,0 +1,19 @@
// +build go1.8
package websocket
import (
"crypto/tls"
"net/http/httptrace"
)
func doHandshakeWithTrace(trace *httptrace.ClientTrace, tlsConn *tls.Conn, cfg *tls.Config) error {
if trace.TLSHandshakeStart != nil {
trace.TLSHandshakeStart()
}
err := doHandshake(tlsConn, cfg)
if trace.TLSHandshakeDone != nil {
trace.TLSHandshakeDone(tlsConn.ConnectionState(), err)
}
return err
}

12
vendor/github.com/gorilla/websocket/trace_17.go generated vendored Normal file
View File

@ -0,0 +1,12 @@
// +build !go1.8
package websocket
import (
"crypto/tls"
"net/http/httptrace"
)
func doHandshakeWithTrace(trace *httptrace.ClientTrace, tlsConn *tls.Conn, cfg *tls.Config) error {
return doHandshake(tlsConn, cfg)
}

View File

@ -178,7 +178,7 @@ headers:
return false return false
} }
// parseExtensiosn parses WebSocket extensions from a header. // parseExtensions parses WebSocket extensions from a header.
func parseExtensions(header http.Header) []map[string]string { func parseExtensions(header http.Header) []map[string]string {
// From RFC 6455: // From RFC 6455:
// //

View File

@ -71,7 +71,8 @@ func (b *Backoff) ForAttempt(attempt float64) time.Duration {
//keep within bounds //keep within bounds
if dur < min { if dur < min {
return min return min
} else if dur > max { }
if dur > max {
return max return max
} }
return dur return dur
@ -86,3 +87,13 @@ func (b *Backoff) Reset() {
func (b *Backoff) Attempt() float64 { func (b *Backoff) Attempt() float64 {
return b.attempt return b.attempt
} }
// Copy returns a backoff with equals constraints as the original
func (b *Backoff) Copy() *Backoff {
return &Backoff{
Factor: b.Factor,
Jitter: b.Jitter,
Min: b.Min,
Max: b.Max,
}
}

View File

@ -1,7 +1,8 @@
language: go language: go
sudo: false sudo: false
go: go:
- 1.9.x - 1.10.x
- 1.11.x
- tip - tip
env: env:

View File

@ -5,17 +5,29 @@
branch = "master" branch = "master"
name = "golang.org/x/crypto" name = "golang.org/x/crypto"
packages = ["ed25519","ed25519/internal/edwards25519"] packages = ["ed25519","ed25519/internal/edwards25519"]
revision = "b080dc9a8c480b08e698fb1219160d598526310f" revision = "b47b1587369238182299fe4dad77d05b8b461e06"
[[projects]] [[projects]]
branch = "master" branch = "master"
name = "golang.org/x/net" name = "golang.org/x/net"
packages = ["bpf","internal/iana","internal/socket","ipv4","ipv6"] packages = ["bpf","context","internal/iana","internal/socket","ipv4","ipv6"]
revision = "894f8ed5849b15b810ae41e9590a0d05395bba27" revision = "1e491301e022f8f977054da4c2d852decd59571f"
[[projects]]
branch = "master"
name = "golang.org/x/sync"
packages = ["errgroup"]
revision = "1d60e4601c6fd243af51cc01ddf169918a5407ca"
[[projects]]
branch = "master"
name = "golang.org/x/sys"
packages = ["unix"]
revision = "e4b3c5e9061176387e7cea65e4dc5853801f3fb7"
[solve-meta] [solve-meta]
analyzer-name = "dep" analyzer-name = "dep"
analyzer-version = 1 analyzer-version = 1
inputs-digest = "c4abc38abaeeeeb9be92455c9c02cae32841122b8982aaa067ef25bb8e86ff9d" inputs-digest = "89261d224d04ffe1530fb9e91fcf649ef0e571531482d043fdad683898871768"
solver-name = "gps-cdcl" solver-name = "gps-cdcl"
solver-version = 1 solver-version = 1

View File

@ -64,6 +64,9 @@ A not-so-up-to-date-list-that-may-be-actually-current:
* https://github.com/oif/apex * https://github.com/oif/apex
* https://github.com/jedisct1/dnscrypt-proxy * https://github.com/jedisct1/dnscrypt-proxy
* https://github.com/jedisct1/rpdns * https://github.com/jedisct1/rpdns
* https://github.com/xor-gate/sshfp
* https://github.com/rs/dnstrace
* https://blitiri.com.ar/p/dnss ([github mirror](https://github.com/albertito/dnss))
Send pull request if you want to be listed here. Send pull request if you want to be listed here.

View File

@ -89,32 +89,22 @@ func (c *Client) Dial(address string) (conn *Conn, err error) {
// create a new dialer with the appropriate timeout // create a new dialer with the appropriate timeout
var d net.Dialer var d net.Dialer
if c.Dialer == nil { if c.Dialer == nil {
d = net.Dialer{Timeout:c.getTimeoutForRequest(c.dialTimeout())} d = net.Dialer{Timeout: c.getTimeoutForRequest(c.dialTimeout())}
} else { } else {
d = net.Dialer(*c.Dialer) d = *c.Dialer
} }
network := "udp" network := c.Net
useTLS := false if network == "" {
network = "udp"
switch c.Net {
case "tcp-tls":
network = "tcp"
useTLS = true
case "tcp4-tls":
network = "tcp4"
useTLS = true
case "tcp6-tls":
network = "tcp6"
useTLS = true
default:
if c.Net != "" {
network = c.Net
}
} }
useTLS := strings.HasPrefix(network, "tcp") && strings.HasSuffix(network, "-tls")
conn = new(Conn) conn = new(Conn)
if useTLS { if useTLS {
network = strings.TrimSuffix(network, "-tls")
conn.Conn, err = tls.DialWithDialer(&d, network, address, c.TLSConfig) conn.Conn, err = tls.DialWithDialer(&d, network, address, c.TLSConfig)
} else { } else {
conn.Conn, err = d.Dial(network, address) conn.Conn, err = d.Dial(network, address)
@ -122,6 +112,7 @@ func (c *Client) Dial(address string) (conn *Conn, err error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
return conn, nil return conn, nil
} }
@ -576,7 +567,7 @@ func (c *Client) ExchangeContext(ctx context.Context, m *Msg, a string) (r *Msg,
if deadline, ok := ctx.Deadline(); !ok { if deadline, ok := ctx.Deadline(); !ok {
timeout = 0 timeout = 0
} else { } else {
timeout = deadline.Sub(time.Now()) timeout = time.Until(deadline)
} }
// not passing the context to the underlying calls, as the API does not support // not passing the context to the underlying calls, as the API does not support
// context. For timeouts you should set up Client.Dialer and call Client.Exchange. // context. For timeouts you should set up Client.Dialer and call Client.Exchange.

View File

@ -173,7 +173,7 @@ func (k *DNSKEY) KeyTag() uint16 {
keytag += int(v) << 8 keytag += int(v) << 8
} }
} }
keytag += (keytag >> 16) & 0xFFFF keytag += keytag >> 16 & 0xFFFF
keytag &= 0xFFFF keytag &= 0xFFFF
} }
return uint16(keytag) return uint16(keytag)
@ -512,8 +512,8 @@ func (rr *RRSIG) ValidityPeriod(t time.Time) bool {
} }
modi := (int64(rr.Inception) - utc) / year68 modi := (int64(rr.Inception) - utc) / year68
mode := (int64(rr.Expiration) - utc) / year68 mode := (int64(rr.Expiration) - utc) / year68
ti := int64(rr.Inception) + (modi * year68) ti := int64(rr.Inception) + modi*year68
te := int64(rr.Expiration) + (mode * year68) te := int64(rr.Expiration) + mode*year68
return ti <= utc && utc <= te return ti <= utc && utc <= te
} }
@ -533,6 +533,11 @@ func (k *DNSKEY) publicKeyRSA() *rsa.PublicKey {
return nil return nil
} }
if len(keybuf) < 1+1+64 {
// Exponent must be at least 1 byte and modulus at least 64
return nil
}
// RFC 2537/3110, section 2. RSA Public KEY Resource Records // RFC 2537/3110, section 2. RSA Public KEY Resource Records
// Length is in the 0th byte, unless its zero, then it // Length is in the 0th byte, unless its zero, then it
// it in bytes 1 and 2 and its a 16 bit number // it in bytes 1 and 2 and its a 16 bit number
@ -542,13 +547,22 @@ func (k *DNSKEY) publicKeyRSA() *rsa.PublicKey {
explen = uint16(keybuf[1])<<8 | uint16(keybuf[2]) explen = uint16(keybuf[1])<<8 | uint16(keybuf[2])
keyoff = 3 keyoff = 3
} }
if explen > 4 {
// Larger exponent than supported by the crypto package. if explen > 4 || explen == 0 || keybuf[keyoff] == 0 {
// Exponent larger than supported by the crypto package,
// empty, or contains prohibited leading zero.
return nil return nil
} }
modoff := keyoff + int(explen)
modlen := len(keybuf) - modoff
if modlen < 64 || modlen > 512 || keybuf[modoff] == 0 {
// Modulus is too small, large, or contains prohibited leading zero.
return nil
}
pubkey := new(rsa.PublicKey) pubkey := new(rsa.PublicKey)
pubkey.N = big.NewInt(0)
expo := uint64(0) expo := uint64(0)
for i := 0; i < int(explen); i++ { for i := 0; i < int(explen); i++ {
expo <<= 8 expo <<= 8
@ -560,7 +574,9 @@ func (k *DNSKEY) publicKeyRSA() *rsa.PublicKey {
} }
pubkey.E = int(expo) pubkey.E = int(expo)
pubkey.N.SetBytes(keybuf[keyoff+int(explen):]) pubkey.N = big.NewInt(0)
pubkey.N.SetBytes(keybuf[modoff:])
return pubkey return pubkey
} }

View File

@ -1,7 +1,6 @@
package dns package dns
import ( import (
"bytes"
"crypto" "crypto"
"crypto/dsa" "crypto/dsa"
"crypto/ecdsa" "crypto/ecdsa"
@ -181,22 +180,10 @@ func readPrivateKeyED25519(m map[string]string) (ed25519.PrivateKey, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
if len(p1) != 32 { if len(p1) != ed25519.SeedSize {
return nil, ErrPrivKey return nil, ErrPrivKey
} }
// RFC 8080 and Golang's x/crypto/ed25519 differ as to how the p = ed25519.NewKeyFromSeed(p1)
// private keys are represented. RFC 8080 specifies that private
// keys be stored solely as the seed value (p1 above) while the
// ed25519 package represents them as the seed value concatenated
// to the public key, which is derived from the seed value.
//
// ed25519.GenerateKey reads exactly 32 bytes from the passed in
// io.Reader and uses them as the seed. It also derives the
// public key and produces a compatible private key.
_, p, err = ed25519.GenerateKey(bytes.NewReader(p1))
if err != nil {
return nil, err
}
case "created", "publish", "activate": case "created", "publish", "activate":
/* not used in Go (yet) */ /* not used in Go (yet) */
} }

View File

@ -82,7 +82,7 @@ func (r *DNSKEY) PrivateKeyString(p crypto.PrivateKey) string {
"Public_value(y): " + pub + "\n" "Public_value(y): " + pub + "\n"
case ed25519.PrivateKey: case ed25519.PrivateKey:
private := toBase64(p[:32]) private := toBase64(p.Seed())
return format + return format +
"Algorithm: " + algorithm + "\n" + "Algorithm: " + algorithm + "\n" +
"PrivateKey: " + private + "\n" "PrivateKey: " + private + "\n"

25
vendor/github.com/miekg/dns/duplicate.go generated vendored Normal file
View File

@ -0,0 +1,25 @@
package dns
//go:generate go run duplicate_generate.go
// IsDuplicate checks of r1 and r2 are duplicates of each other, excluding the TTL.
// So this means the header data is equal *and* the RDATA is the same. Return true
// is so, otherwise false.
// It's is a protocol violation to have identical RRs in a message.
func IsDuplicate(r1, r2 RR) bool {
if r1.Header().Class != r2.Header().Class {
return false
}
if r1.Header().Rrtype != r2.Header().Rrtype {
return false
}
if !isDulicateName(r1.Header().Name, r2.Header().Name) {
return false
}
// ignore TTL
return isDuplicateRdata(r1, r2)
}
// isDulicateName checks if the domain names s1 and s2 are equal.
func isDulicateName(s1, s2 string) bool { return equal(s1, s2) }

158
vendor/github.com/miekg/dns/duplicate_generate.go generated vendored Normal file
View File

@ -0,0 +1,158 @@
//+build ignore
// types_generate.go is meant to run with go generate. It will use
// go/{importer,types} to track down all the RR struct types. Then for each type
// it will generate conversion tables (TypeToRR and TypeToString) and banal
// methods (len, Header, copy) based on the struct tags. The generated source is
// written to ztypes.go, and is meant to be checked into git.
package main
import (
"bytes"
"fmt"
"go/format"
"go/importer"
"go/types"
"log"
"os"
)
var packageHdr = `
// Code generated by "go run duplicate_generate.go"; DO NOT EDIT.
package dns
`
func getTypeStruct(t types.Type, scope *types.Scope) (*types.Struct, bool) {
st, ok := t.Underlying().(*types.Struct)
if !ok {
return nil, false
}
if st.Field(0).Type() == scope.Lookup("RR_Header").Type() {
return st, false
}
if st.Field(0).Anonymous() {
st, _ := getTypeStruct(st.Field(0).Type(), scope)
return st, true
}
return nil, false
}
func main() {
// Import and type-check the package
pkg, err := importer.Default().Import("github.com/miekg/dns")
fatalIfErr(err)
scope := pkg.Scope()
// Collect actual types (*X)
var namedTypes []string
for _, name := range scope.Names() {
o := scope.Lookup(name)
if o == nil || !o.Exported() {
continue
}
if st, _ := getTypeStruct(o.Type(), scope); st == nil {
continue
}
if name == "PrivateRR" || name == "RFC3597" {
continue
}
if name == "OPT" || name == "ANY" || name == "IXFR" || name == "AXFR" {
continue
}
namedTypes = append(namedTypes, o.Name())
}
b := &bytes.Buffer{}
b.WriteString(packageHdr)
// Generate the giant switch that calls the correct function for each type.
fmt.Fprint(b, "// isDuplicateRdata calls the rdata specific functions\n")
fmt.Fprint(b, "func isDuplicateRdata(r1, r2 RR) bool {\n")
fmt.Fprint(b, "switch r1.Header().Rrtype {\n")
for _, name := range namedTypes {
o := scope.Lookup(name)
_, isEmbedded := getTypeStruct(o.Type(), scope)
if isEmbedded {
continue
}
fmt.Fprintf(b, "case Type%s:\nreturn isDuplicate%s(r1.(*%s), r2.(*%s))\n", name, name, name, name)
}
fmt.Fprintf(b, "}\nreturn false\n}\n")
// Generate the duplicate check for each type.
fmt.Fprint(b, "// isDuplicate() functions\n\n")
for _, name := range namedTypes {
o := scope.Lookup(name)
st, isEmbedded := getTypeStruct(o.Type(), scope)
if isEmbedded {
continue
}
fmt.Fprintf(b, "func isDuplicate%s(r1, r2 *%s) bool {\n", name, name)
for i := 1; i < st.NumFields(); i++ {
field := st.Field(i).Name()
o2 := func(s string) { fmt.Fprintf(b, s+"\n", field, field) }
o3 := func(s string) { fmt.Fprintf(b, s+"\n", field, field, field) }
// For some reason, a and aaaa don't pop up as *types.Slice here (mostly like because the are
// *indirectly* defined as a slice in the net package).
if _, ok := st.Field(i).Type().(*types.Slice); ok || st.Tag(i) == `dns:"a"` || st.Tag(i) == `dns:"aaaa"` {
o2("if len(r1.%s) != len(r2.%s) {\nreturn false\n}")
if st.Tag(i) == `dns:"cdomain-name"` || st.Tag(i) == `dns:"domain-name"` {
o3(`for i := 0; i < len(r1.%s); i++ {
if !isDulicateName(r1.%s[i], r2.%s[i]) {
return false
}
}`)
continue
}
o3(`for i := 0; i < len(r1.%s); i++ {
if r1.%s[i] != r2.%s[i] {
return false
}
}`)
continue
}
switch st.Tag(i) {
case `dns:"-"`:
// ignored
case `dns:"cdomain-name"`, `dns:"domain-name"`:
o2("if !isDulicateName(r1.%s, r2.%s) {\nreturn false\n}")
default:
o2("if r1.%s != r2.%s {\nreturn false\n}")
}
}
fmt.Fprintf(b, "return true\n}\n\n")
}
// gofmt
res, err := format.Source(b.Bytes())
if err != nil {
b.WriteTo(os.Stderr)
log.Fatal(err)
}
// write result
f, err := os.Create("zduplicate.go")
fatalIfErr(err)
defer f.Close()
f.Write(res)
}
func fatalIfErr(err error) {
if err != nil {
log.Fatal(err)
}
}

View File

@ -92,17 +92,17 @@ func (rr *OPT) len() int {
// Version returns the EDNS version used. Only zero is defined. // Version returns the EDNS version used. Only zero is defined.
func (rr *OPT) Version() uint8 { func (rr *OPT) Version() uint8 {
return uint8((rr.Hdr.Ttl & 0x00FF0000) >> 16) return uint8(rr.Hdr.Ttl & 0x00FF0000 >> 16)
} }
// SetVersion sets the version of EDNS. This is usually zero. // SetVersion sets the version of EDNS. This is usually zero.
func (rr *OPT) SetVersion(v uint8) { func (rr *OPT) SetVersion(v uint8) {
rr.Hdr.Ttl = rr.Hdr.Ttl&0xFF00FFFF | (uint32(v) << 16) rr.Hdr.Ttl = rr.Hdr.Ttl&0xFF00FFFF | uint32(v)<<16
} }
// ExtendedRcode returns the EDNS extended RCODE field (the upper 8 bits of the TTL). // ExtendedRcode returns the EDNS extended RCODE field (the upper 8 bits of the TTL).
func (rr *OPT) ExtendedRcode() int { func (rr *OPT) ExtendedRcode() int {
return int((rr.Hdr.Ttl&0xFF000000)>>24) + 15 return int(rr.Hdr.Ttl&0xFF000000>>24) + 15
} }
// SetExtendedRcode sets the EDNS extended RCODE field. // SetExtendedRcode sets the EDNS extended RCODE field.
@ -110,7 +110,7 @@ func (rr *OPT) SetExtendedRcode(v uint8) {
if v < RcodeBadVers { // Smaller than 16.. Use the 4 bits you have! if v < RcodeBadVers { // Smaller than 16.. Use the 4 bits you have!
return return
} }
rr.Hdr.Ttl = rr.Hdr.Ttl&0x00FFFFFF | (uint32(v-15) << 24) rr.Hdr.Ttl = rr.Hdr.Ttl&0x00FFFFFF | uint32(v-15)<<24
} }
// UDPSize returns the UDP buffer size. // UDPSize returns the UDP buffer size.

View File

@ -133,10 +133,20 @@ BuildRR:
// Convert a $GENERATE modifier 0,0,d to something Printf can deal with. // Convert a $GENERATE modifier 0,0,d to something Printf can deal with.
func modToPrintf(s string) (string, int, error) { func modToPrintf(s string) (string, int, error) {
xs := strings.SplitN(s, ",", 3) xs := strings.Split(s, ",")
if len(xs) != 3 {
// Modifier is { offset [ ,width [ ,base ] ] } - provide default
// values for optional width and type, if necessary.
switch len(xs) {
case 1:
xs = append(xs, "0", "d")
case 2:
xs = append(xs, "d")
case 3:
default:
return "", 0, errors.New("bad modifier in $GENERATE") return "", 0, errors.New("bad modifier in $GENERATE")
} }
// xs[0] is offset, xs[1] is width, xs[2] is base // xs[0] is offset, xs[1] is width, xs[2] is base
if xs[2] != "o" && xs[2] != "d" && xs[2] != "x" && xs[2] != "X" { if xs[2] != "o" && xs[2] != "d" && xs[2] != "x" && xs[2] != "X" {
return "", 0, errors.New("bad base in $GENERATE") return "", 0, errors.New("bad base in $GENERATE")

View File

@ -178,10 +178,10 @@ func equal(a, b string) bool {
ai := a[i] ai := a[i]
bi := b[i] bi := b[i]
if ai >= 'A' && ai <= 'Z' { if ai >= 'A' && ai <= 'Z' {
ai |= ('a' - 'A') ai |= 'a' - 'A'
} }
if bi >= 'A' && bi <= 'Z' { if bi >= 'A' && bi <= 'Z' {
bi |= ('a' - 'A') bi |= 'a' - 'A'
} }
if ai != bi { if ai != bi {
return false return false

44
vendor/github.com/miekg/dns/listen_go111.go generated vendored Normal file
View File

@ -0,0 +1,44 @@
// +build go1.11
// +build aix darwin dragonfly freebsd linux netbsd openbsd
package dns
import (
"context"
"net"
"syscall"
"golang.org/x/sys/unix"
)
const supportsReusePort = true
func reuseportControl(network, address string, c syscall.RawConn) error {
var opErr error
err := c.Control(func(fd uintptr) {
opErr = unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_REUSEPORT, 1)
})
if err != nil {
return err
}
return opErr
}
func listenTCP(network, addr string, reuseport bool) (net.Listener, error) {
var lc net.ListenConfig
if reuseport {
lc.Control = reuseportControl
}
return lc.Listen(context.Background(), network, addr)
}
func listenUDP(network, addr string, reuseport bool) (net.PacketConn, error) {
var lc net.ListenConfig
if reuseport {
lc.Control = reuseportControl
}
return lc.ListenPacket(context.Background(), network, addr)
}

23
vendor/github.com/miekg/dns/listen_go_not111.go generated vendored Normal file
View File

@ -0,0 +1,23 @@
// +build !go1.11 !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd
package dns
import "net"
const supportsReusePort = false
func listenTCP(network, addr string, reuseport bool) (net.Listener, error) {
if reuseport {
// TODO(tmthrgd): return an error?
}
return net.Listen(network, addr)
}
func listenUDP(network, addr string, reuseport bool) (net.PacketConn, error) {
if reuseport {
// TODO(tmthrgd): return an error?
}
return net.ListenPacket(network, addr)
}

57
vendor/github.com/miekg/dns/msg.go generated vendored
View File

@ -367,12 +367,10 @@ Loop:
var buf [3]byte var buf [3]byte
bufs := strconv.AppendInt(buf[:0], int64(b), 10) bufs := strconv.AppendInt(buf[:0], int64(b), 10)
s = append(s, '\\') s = append(s, '\\')
for i := 0; i < 3-len(bufs); i++ { for i := len(bufs); i < 3; i++ {
s = append(s, '0') s = append(s, '0')
} }
for _, r := range bufs { s = append(s, bufs...)
s = append(s, r)
}
// presentation-format \DDD escapes add 3 extra bytes // presentation-format \DDD escapes add 3 extra bytes
maxLen += 3 maxLen += 3
} else { } else {
@ -512,7 +510,7 @@ func unpackTxt(msg []byte, off0 int) (ss []string, off int, err error) {
off = off0 off = off0
var s string var s string
for off < len(msg) && err == nil { for off < len(msg) && err == nil {
s, off, err = unpackTxtString(msg, off) s, off, err = unpackString(msg, off)
if err == nil { if err == nil {
ss = append(ss, s) ss = append(ss, s)
} }
@ -520,39 +518,6 @@ func unpackTxt(msg []byte, off0 int) (ss []string, off int, err error) {
return return
} }
func unpackTxtString(msg []byte, offset int) (string, int, error) {
if offset+1 > len(msg) {
return "", offset, &Error{err: "overflow unpacking txt"}
}
l := int(msg[offset])
if offset+l+1 > len(msg) {
return "", offset, &Error{err: "overflow unpacking txt"}
}
s := make([]byte, 0, l)
for _, b := range msg[offset+1 : offset+1+l] {
switch b {
case '"', '\\':
s = append(s, '\\', b)
default:
if b < 32 || b > 127 { // unprintable
var buf [3]byte
bufs := strconv.AppendInt(buf[:0], int64(b), 10)
s = append(s, '\\')
for i := 0; i < 3-len(bufs); i++ {
s = append(s, '0')
}
for _, r := range bufs {
s = append(s, r)
}
} else {
s = append(s, b)
}
}
}
offset += 1 + l
return string(s), offset, nil
}
// Helpers for dealing with escaped bytes // Helpers for dealing with escaped bytes
func isDigit(b byte) bool { return b >= '0' && b <= '9' } func isDigit(b byte) bool { return b >= '0' && b <= '9' }
@ -808,15 +773,15 @@ func (dns *Msg) Unpack(msg []byte) (err error) {
} }
dns.Id = dh.Id dns.Id = dh.Id
dns.Response = (dh.Bits & _QR) != 0 dns.Response = dh.Bits&_QR != 0
dns.Opcode = int(dh.Bits>>11) & 0xF dns.Opcode = int(dh.Bits>>11) & 0xF
dns.Authoritative = (dh.Bits & _AA) != 0 dns.Authoritative = dh.Bits&_AA != 0
dns.Truncated = (dh.Bits & _TC) != 0 dns.Truncated = dh.Bits&_TC != 0
dns.RecursionDesired = (dh.Bits & _RD) != 0 dns.RecursionDesired = dh.Bits&_RD != 0
dns.RecursionAvailable = (dh.Bits & _RA) != 0 dns.RecursionAvailable = dh.Bits&_RA != 0
dns.Zero = (dh.Bits & _Z) != 0 dns.Zero = dh.Bits&_Z != 0
dns.AuthenticatedData = (dh.Bits & _AD) != 0 dns.AuthenticatedData = dh.Bits&_AD != 0
dns.CheckingDisabled = (dh.Bits & _CD) != 0 dns.CheckingDisabled = dh.Bits&_CD != 0
dns.Rcode = int(dh.Bits & 0xF) dns.Rcode = int(dh.Bits & 0xF)
// If we are at the end of the message we should return *just* the // If we are at the end of the message we should return *just* the

View File

@ -7,6 +7,7 @@ import (
"encoding/hex" "encoding/hex"
"net" "net"
"strconv" "strconv"
"strings"
) )
// helper functions called from the generated zmsg.go // helper functions called from the generated zmsg.go
@ -223,8 +224,8 @@ func unpackUint48(msg []byte, off int) (i uint64, off1 int, err error) {
return 0, len(msg), &Error{err: "overflow unpacking uint64 as uint48"} return 0, len(msg), &Error{err: "overflow unpacking uint64 as uint48"}
} }
// Used in TSIG where the last 48 bits are occupied, so for now, assume a uint48 (6 bytes) // Used in TSIG where the last 48 bits are occupied, so for now, assume a uint48 (6 bytes)
i = (uint64(uint64(msg[off])<<40 | uint64(msg[off+1])<<32 | uint64(msg[off+2])<<24 | uint64(msg[off+3])<<16 | i = uint64(uint64(msg[off])<<40 | uint64(msg[off+1])<<32 | uint64(msg[off+2])<<24 | uint64(msg[off+3])<<16 |
uint64(msg[off+4])<<8 | uint64(msg[off+5]))) uint64(msg[off+4])<<8 | uint64(msg[off+5]))
off += 6 off += 6
return i, off, nil return i, off, nil
} }
@ -267,29 +268,27 @@ func unpackString(msg []byte, off int) (string, int, error) {
if off+l+1 > len(msg) { if off+l+1 > len(msg) {
return "", off, &Error{err: "overflow unpacking txt"} return "", off, &Error{err: "overflow unpacking txt"}
} }
s := make([]byte, 0, l) var s strings.Builder
s.Grow(l)
for _, b := range msg[off+1 : off+1+l] { for _, b := range msg[off+1 : off+1+l] {
switch b { switch {
case '"', '\\': case b == '"' || b == '\\':
s = append(s, '\\', b) s.WriteByte('\\')
default: s.WriteByte(b)
if b < 32 || b > 127 { // unprintable case b < ' ' || b > '~': // unprintable
var buf [3]byte var buf [3]byte
bufs := strconv.AppendInt(buf[:0], int64(b), 10) bufs := strconv.AppendInt(buf[:0], int64(b), 10)
s = append(s, '\\') s.WriteByte('\\')
for i := 0; i < 3-len(bufs); i++ { for i := len(bufs); i < 3; i++ {
s = append(s, '0') s.WriteByte('0')
}
for _, r := range bufs {
s = append(s, r)
}
} else {
s = append(s, b)
} }
s.Write(bufs)
default:
s.WriteByte(b)
} }
} }
off += 1 + l off += 1 + l
return string(s), off, nil return s.String(), off, nil
} }
func packString(s string, msg []byte, off int) (int, error) { func packString(s string, msg []byte, off int) (int, error) {
@ -363,7 +362,7 @@ func packStringHex(s string, msg []byte, off int) (int, error) {
if err != nil { if err != nil {
return len(msg), err return len(msg), err
} }
if off+(len(h)) > len(msg) { if off+len(h) > len(msg) {
return len(msg), &Error{err: "overflow packing hex"} return len(msg), &Error{err: "overflow packing hex"}
} }
copy(msg[off:off+len(h)], h) copy(msg[off:off+len(h)], h)
@ -603,7 +602,7 @@ func packDataNsec(bitmap []uint16, msg []byte, off int) (int, error) {
// Setting the octets length // Setting the octets length
msg[off+1] = byte(length) msg[off+1] = byte(length)
// Setting the bit value for the type in the right octet // Setting the bit value for the type in the right octet
msg[off+1+int(length)] |= byte(1 << (7 - (t % 8))) msg[off+1+int(length)] |= byte(1 << (7 - t%8))
lastwindow, lastlength = window, length lastwindow, lastlength = window, length
} }
off += int(lastlength) + 2 off += int(lastlength) + 2

View File

@ -134,7 +134,7 @@ func PrivateHandle(rtypestr string, rtype uint16, generator func() PrivateRdata)
typeToparserFunc[rtype] = parserFunc{setPrivateRR, true} typeToparserFunc[rtype] = parserFunc{setPrivateRR, true}
} }
// PrivateHandleRemove removes defenitions required to support private RR type. // PrivateHandleRemove removes definitions required to support private RR type.
func PrivateHandleRemove(rtype uint16) { func PrivateHandleRemove(rtype uint16) {
rtypestr, ok := TypeToString[rtype] rtypestr, ok := TypeToString[rtype]
if ok { if ok {
@ -144,5 +144,4 @@ func PrivateHandleRemove(rtype uint16) {
delete(StringToType, rtypestr) delete(StringToType, rtypestr)
delete(typeToUnpack, rtype) delete(typeToUnpack, rtype)
} }
return
} }

View File

@ -5,6 +5,7 @@ package dns
// rrs. // rrs.
// m is used to store the RRs temporary. If it is nil a new map will be allocated. // m is used to store the RRs temporary. If it is nil a new map will be allocated.
func Dedup(rrs []RR, m map[string]RR) []RR { func Dedup(rrs []RR, m map[string]RR) []RR {
if m == nil { if m == nil {
m = make(map[string]RR) m = make(map[string]RR)
} }

View File

@ -10,7 +10,6 @@ import (
) )
const maxTok = 2048 // Largest token we can return. const maxTok = 2048 // Largest token we can return.
const maxUint16 = 1<<16 - 1
// Tokinize a RFC 1035 zone file. The tokenizer will normalize it: // Tokinize a RFC 1035 zone file. The tokenizer will normalize it:
// * Add ownernames if they are left blank; // * Add ownernames if they are left blank;
@ -80,9 +79,9 @@ type lex struct {
length int // length of the token length int // length of the token
err bool // when true, token text has lexer error err bool // when true, token text has lexer error
value uint8 // value: zString, _BLANK, etc. value uint8 // value: zString, _BLANK, etc.
torc uint16 // type or class as parsed in the lexer, we only need to look this up in the grammar
line int // line in the file line int // line in the file
column int // column in the file column int // column in the file
torc uint16 // type or class as parsed in the lexer, we only need to look this up in the grammar
comment string // any comment text seen comment string // any comment text seen
} }
@ -209,10 +208,9 @@ func parseZone(r io.Reader, origin, f string, defttl *ttlState, t chan *Token, i
var prevName string var prevName string
for l := range c { for l := range c {
// Lexer spotted an error already // Lexer spotted an error already
if l.err == true { if l.err {
t <- &Token{Error: &ParseError{f, l.token, l}} t <- &Token{Error: &ParseError{f, l.token, l}}
return return
} }
switch st { switch st {
case zExpectOwnerDir: case zExpectOwnerDir:
@ -639,7 +637,6 @@ func zlexer(s *scan, c chan lex) {
if quote { if quote {
str[stri] = x str[stri] = x
stri++ stri++
break
} }
// discard if outside of quotes // discard if outside of quotes
case '\n': case '\n':

View File

@ -893,19 +893,19 @@ Altitude:
if !ok { if !ok {
return nil, &ParseError{f, "bad LOC Size", l}, "" return nil, &ParseError{f, "bad LOC Size", l}, ""
} }
rr.Size = (e & 0x0f) | (m << 4 & 0xf0) rr.Size = e&0x0f | m<<4&0xf0
case 1: // HorizPre case 1: // HorizPre
e, m, ok := stringToCm(l.token) e, m, ok := stringToCm(l.token)
if !ok { if !ok {
return nil, &ParseError{f, "bad LOC HorizPre", l}, "" return nil, &ParseError{f, "bad LOC HorizPre", l}, ""
} }
rr.HorizPre = (e & 0x0f) | (m << 4 & 0xf0) rr.HorizPre = e&0x0f | m<<4&0xf0
case 2: // VertPre case 2: // VertPre
e, m, ok := stringToCm(l.token) e, m, ok := stringToCm(l.token)
if !ok { if !ok {
return nil, &ParseError{f, "bad LOC VertPre", l}, "" return nil, &ParseError{f, "bad LOC VertPre", l}, ""
} }
rr.VertPre = (e & 0x0f) | (m << 4 & 0xf0) rr.VertPre = e&0x0f | m<<4&0xf0
} }
count++ count++
case zBlank: case zBlank:
@ -1665,9 +1665,9 @@ func setTA(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) {
return nil, &ParseError{f, "bad TA DigestType", l}, "" return nil, &ParseError{f, "bad TA DigestType", l}, ""
} }
rr.DigestType = uint8(i) rr.DigestType = uint8(i)
s, e, c1 := endingToString(c, "bad TA Digest", f) s, err, c1 := endingToString(c, "bad TA Digest", f)
if e != nil { if err != nil {
return nil, e.(*ParseError), c1 return nil, err, c1
} }
rr.Digest = s rr.Digest = s
return rr, nil, c1 return rr, nil, c1

View File

@ -42,7 +42,7 @@ func (s *scan) tokenText() (byte, error) {
// delay the newline handling until the next token is delivered, // delay the newline handling until the next token is delivered,
// fixes off-by-one errors when reporting a parse error. // fixes off-by-one errors when reporting a parse error.
if s.eof == true { if s.eof {
s.position.Line++ s.position.Line++
s.position.Column = 0 s.position.Column = 0
s.eof = false s.eof = false

147
vendor/github.com/miekg/dns/serve_mux.go generated vendored Normal file
View File

@ -0,0 +1,147 @@
package dns
import (
"strings"
"sync"
)
// ServeMux is an DNS request multiplexer. It matches the zone name of
// each incoming request against a list of registered patterns add calls
// the handler for the pattern that most closely matches the zone name.
//
// ServeMux is DNSSEC aware, meaning that queries for the DS record are
// redirected to the parent zone (if that is also registered), otherwise
// the child gets the query.
//
// ServeMux is also safe for concurrent access from multiple goroutines.
//
// The zero ServeMux is empty and ready for use.
type ServeMux struct {
z map[string]Handler
m sync.RWMutex
}
// NewServeMux allocates and returns a new ServeMux.
func NewServeMux() *ServeMux {
return new(ServeMux)
}
// DefaultServeMux is the default ServeMux used by Serve.
var DefaultServeMux = NewServeMux()
func (mux *ServeMux) match(q string, t uint16) Handler {
mux.m.RLock()
defer mux.m.RUnlock()
if mux.z == nil {
return nil
}
var handler Handler
// TODO(tmthrgd): Once https://go-review.googlesource.com/c/go/+/137575
// lands in a go release, replace the following with strings.ToLower.
var sb strings.Builder
for i := 0; i < len(q); i++ {
c := q[i]
if !(c >= 'A' && c <= 'Z') {
continue
}
sb.Grow(len(q))
sb.WriteString(q[:i])
for ; i < len(q); i++ {
c := q[i]
if c >= 'A' && c <= 'Z' {
c += 'a' - 'A'
}
sb.WriteByte(c)
}
q = sb.String()
break
}
for off, end := 0, false; !end; off, end = NextLabel(q, off) {
if h, ok := mux.z[q[off:]]; ok {
if t != TypeDS {
return h
}
// Continue for DS to see if we have a parent too, if so delegate to the parent
handler = h
}
}
// Wildcard match, if we have found nothing try the root zone as a last resort.
if h, ok := mux.z["."]; ok {
return h
}
return handler
}
// Handle adds a handler to the ServeMux for pattern.
func (mux *ServeMux) Handle(pattern string, handler Handler) {
if pattern == "" {
panic("dns: invalid pattern " + pattern)
}
mux.m.Lock()
if mux.z == nil {
mux.z = make(map[string]Handler)
}
mux.z[Fqdn(pattern)] = handler
mux.m.Unlock()
}
// HandleFunc adds a handler function to the ServeMux for pattern.
func (mux *ServeMux) HandleFunc(pattern string, handler func(ResponseWriter, *Msg)) {
mux.Handle(pattern, HandlerFunc(handler))
}
// HandleRemove deregisters the handler specific for pattern from the ServeMux.
func (mux *ServeMux) HandleRemove(pattern string) {
if pattern == "" {
panic("dns: invalid pattern " + pattern)
}
mux.m.Lock()
delete(mux.z, Fqdn(pattern))
mux.m.Unlock()
}
// ServeDNS dispatches the request to the handler whose pattern most
// closely matches the request message.
//
// ServeDNS is DNSSEC aware, meaning that queries for the DS record
// are redirected to the parent zone (if that is also registered),
// otherwise the child gets the query.
//
// If no handler is found, or there is no question, a standard SERVFAIL
// message is returned
func (mux *ServeMux) ServeDNS(w ResponseWriter, req *Msg) {
var h Handler
if len(req.Question) >= 1 { // allow more than one question
h = mux.match(req.Question[0].Name, req.Question[0].Qtype)
}
if h != nil {
h.ServeDNS(w, req)
} else {
HandleFailed(w, req)
}
}
// Handle registers the handler with the given pattern
// in the DefaultServeMux. The documentation for
// ServeMux explains how patterns are matched.
func Handle(pattern string, handler Handler) { DefaultServeMux.Handle(pattern, handler) }
// HandleRemove deregisters the handle with the given pattern
// in the DefaultServeMux.
func HandleRemove(pattern string) { DefaultServeMux.HandleRemove(pattern) }
// HandleFunc registers the handler function with the given pattern
// in the DefaultServeMux.
func HandleFunc(pattern string, handler func(ResponseWriter, *Msg)) {
DefaultServeMux.HandleFunc(pattern, handler)
}

450
vendor/github.com/miekg/dns/server.go generated vendored
View File

@ -4,10 +4,13 @@ package dns
import ( import (
"bytes" "bytes"
"context"
"crypto/tls" "crypto/tls"
"encoding/binary" "encoding/binary"
"errors"
"io" "io"
"net" "net"
"strings"
"sync" "sync"
"sync/atomic" "sync/atomic"
"time" "time"
@ -16,17 +19,39 @@ import (
// Default maximum number of TCP queries before we close the socket. // Default maximum number of TCP queries before we close the socket.
const maxTCPQueries = 128 const maxTCPQueries = 128
// Interval for stop worker if no load // The maximum number of idle workers.
//
// This controls the maximum number of workers that are allowed to stay
// idle waiting for incoming requests before being torn down.
//
// If this limit is reached, the server will just keep spawning new
// workers (goroutines) for each incoming request. In this case, each
// worker will only be used for a single request.
const maxIdleWorkersCount = 10000
// The maximum length of time a worker may idle for before being destroyed.
const idleWorkerTimeout = 10 * time.Second const idleWorkerTimeout = 10 * time.Second
// Maximum number of workers // aLongTimeAgo is a non-zero time, far in the past, used for
const maxWorkersCount = 10000 // immediate cancelation of network operations.
var aLongTimeAgo = time.Unix(1, 0)
// Handler is implemented by any value that implements ServeDNS. // Handler is implemented by any value that implements ServeDNS.
type Handler interface { type Handler interface {
ServeDNS(w ResponseWriter, r *Msg) ServeDNS(w ResponseWriter, r *Msg)
} }
// The HandlerFunc type is an adapter to allow the use of
// ordinary functions as DNS handlers. If f is a function
// with the appropriate signature, HandlerFunc(f) is a
// Handler object that calls f.
type HandlerFunc func(ResponseWriter, *Msg)
// ServeDNS calls f(w, r).
func (f HandlerFunc) ServeDNS(w ResponseWriter, r *Msg) {
f(w, r)
}
// A ResponseWriter interface is used by an DNS handler to // A ResponseWriter interface is used by an DNS handler to
// construct an DNS response. // construct an DNS response.
type ResponseWriter interface { type ResponseWriter interface {
@ -49,46 +74,24 @@ type ResponseWriter interface {
Hijack() Hijack()
} }
// A ConnectionStater interface is used by a DNS Handler to access TLS connection state
// when available.
type ConnectionStater interface {
ConnectionState() *tls.ConnectionState
}
type response struct { type response struct {
msg []byte msg []byte
hijacked bool // connection has been hijacked by handler hijacked bool // connection has been hijacked by handler
tsigStatus error
tsigTimersOnly bool tsigTimersOnly bool
tsigStatus error
tsigRequestMAC string tsigRequestMAC string
tsigSecret map[string]string // the tsig secrets tsigSecret map[string]string // the tsig secrets
udp *net.UDPConn // i/o connection if UDP was used udp *net.UDPConn // i/o connection if UDP was used
tcp net.Conn // i/o connection if TCP was used tcp net.Conn // i/o connection if TCP was used
udpSession *SessionUDP // oob data to get egress interface right udpSession *SessionUDP // oob data to get egress interface right
writer Writer // writer to output the raw DNS bits writer Writer // writer to output the raw DNS bits
} wg *sync.WaitGroup // for gracefull shutdown
// ServeMux is an DNS request multiplexer. It matches the
// zone name of each incoming request against a list of
// registered patterns add calls the handler for the pattern
// that most closely matches the zone name. ServeMux is DNSSEC aware, meaning
// that queries for the DS record are redirected to the parent zone (if that
// is also registered), otherwise the child gets the query.
// ServeMux is also safe for concurrent access from multiple goroutines.
type ServeMux struct {
z map[string]Handler
m *sync.RWMutex
}
// NewServeMux allocates and returns a new ServeMux.
func NewServeMux() *ServeMux { return &ServeMux{z: make(map[string]Handler), m: new(sync.RWMutex)} }
// DefaultServeMux is the default ServeMux used by Serve.
var DefaultServeMux = NewServeMux()
// The HandlerFunc type is an adapter to allow the use of
// ordinary functions as DNS handlers. If f is a function
// with the appropriate signature, HandlerFunc(f) is a
// Handler object that calls f.
type HandlerFunc func(ResponseWriter, *Msg)
// ServeDNS calls f(w, r).
func (f HandlerFunc) ServeDNS(w ResponseWriter, r *Msg) {
f(w, r)
} }
// HandleFailed returns a HandlerFunc that returns SERVFAIL for every request it gets. // HandleFailed returns a HandlerFunc that returns SERVFAIL for every request it gets.
@ -99,8 +102,6 @@ func HandleFailed(w ResponseWriter, r *Msg) {
w.WriteMsg(m) w.WriteMsg(m)
} }
func failedHandler() Handler { return HandlerFunc(HandleFailed) }
// ListenAndServe Starts a server on address and network specified Invoke handler // ListenAndServe Starts a server on address and network specified Invoke handler
// for incoming queries. // for incoming queries.
func ListenAndServe(addr string, network string, handler Handler) error { func ListenAndServe(addr string, network string, handler Handler) error {
@ -139,99 +140,6 @@ func ActivateAndServe(l net.Listener, p net.PacketConn, handler Handler) error {
return server.ActivateAndServe() return server.ActivateAndServe()
} }
func (mux *ServeMux) match(q string, t uint16) Handler {
mux.m.RLock()
defer mux.m.RUnlock()
var handler Handler
b := make([]byte, len(q)) // worst case, one label of length q
off := 0
end := false
for {
l := len(q[off:])
for i := 0; i < l; i++ {
b[i] = q[off+i]
if b[i] >= 'A' && b[i] <= 'Z' {
b[i] |= ('a' - 'A')
}
}
if h, ok := mux.z[string(b[:l])]; ok { // causes garbage, might want to change the map key
if t != TypeDS {
return h
}
// Continue for DS to see if we have a parent too, if so delegeate to the parent
handler = h
}
off, end = NextLabel(q, off)
if end {
break
}
}
// Wildcard match, if we have found nothing try the root zone as a last resort.
if h, ok := mux.z["."]; ok {
return h
}
return handler
}
// Handle adds a handler to the ServeMux for pattern.
func (mux *ServeMux) Handle(pattern string, handler Handler) {
if pattern == "" {
panic("dns: invalid pattern " + pattern)
}
mux.m.Lock()
mux.z[Fqdn(pattern)] = handler
mux.m.Unlock()
}
// HandleFunc adds a handler function to the ServeMux for pattern.
func (mux *ServeMux) HandleFunc(pattern string, handler func(ResponseWriter, *Msg)) {
mux.Handle(pattern, HandlerFunc(handler))
}
// HandleRemove deregistrars the handler specific for pattern from the ServeMux.
func (mux *ServeMux) HandleRemove(pattern string) {
if pattern == "" {
panic("dns: invalid pattern " + pattern)
}
mux.m.Lock()
delete(mux.z, Fqdn(pattern))
mux.m.Unlock()
}
// ServeDNS dispatches the request to the handler whose
// pattern most closely matches the request message. If DefaultServeMux
// is used the correct thing for DS queries is done: a possible parent
// is sought.
// If no handler is found a standard SERVFAIL message is returned
// If the request message does not have exactly one question in the
// question section a SERVFAIL is returned, unlesss Unsafe is true.
func (mux *ServeMux) ServeDNS(w ResponseWriter, request *Msg) {
var h Handler
if len(request.Question) < 1 { // allow more than one question
h = failedHandler()
} else {
if h = mux.match(request.Question[0].Name, request.Question[0].Qtype); h == nil {
h = failedHandler()
}
}
h.ServeDNS(w, request)
}
// Handle registers the handler with the given pattern
// in the DefaultServeMux. The documentation for
// ServeMux explains how patterns are matched.
func Handle(pattern string, handler Handler) { DefaultServeMux.Handle(pattern, handler) }
// HandleRemove deregisters the handle with the given pattern
// in the DefaultServeMux.
func HandleRemove(pattern string) { DefaultServeMux.HandleRemove(pattern) }
// HandleFunc registers the handler function with the given pattern
// in the DefaultServeMux.
func HandleFunc(pattern string, handler func(ResponseWriter, *Msg)) {
DefaultServeMux.HandleFunc(pattern, handler)
}
// Writer writes raw DNS messages; each call to Write should send an entire message. // Writer writes raw DNS messages; each call to Write should send an entire message.
type Writer interface { type Writer interface {
io.Writer io.Writer
@ -305,14 +213,30 @@ type Server struct {
DecorateWriter DecorateWriter DecorateWriter DecorateWriter
// Maximum number of TCP queries before we close the socket. Default is maxTCPQueries (unlimited if -1). // Maximum number of TCP queries before we close the socket. Default is maxTCPQueries (unlimited if -1).
MaxTCPQueries int MaxTCPQueries int
// Whether to set the SO_REUSEPORT socket option, allowing multiple listeners to be bound to a single address.
// It is only supported on go1.11+ and when using ListenAndServe.
ReusePort bool
// UDP packet or TCP connection queue // UDP packet or TCP connection queue
queue chan *response queue chan *response
// Workers count // Workers count
workersCount int32 workersCount int32
// Shutdown handling // Shutdown handling
lock sync.RWMutex lock sync.RWMutex
started bool started bool
shutdown chan struct{}
conns map[net.Conn]struct{}
// A pool for UDP message buffers.
udpPool sync.Pool
}
func (srv *Server) isStarted() bool {
srv.lock.RLock()
started := srv.started
srv.lock.RUnlock()
return started
} }
func (srv *Server) worker(w *response) { func (srv *Server) worker(w *response) {
@ -320,7 +244,7 @@ func (srv *Server) worker(w *response) {
for { for {
count := atomic.LoadInt32(&srv.workersCount) count := atomic.LoadInt32(&srv.workersCount)
if count > maxWorkersCount { if count > maxIdleWorkersCount {
return return
} }
if atomic.CompareAndSwapInt32(&srv.workersCount, count, count+1) { if atomic.CompareAndSwapInt32(&srv.workersCount, count, count+1) {
@ -360,10 +284,36 @@ func (srv *Server) spawnWorker(w *response) {
} }
} }
func makeUDPBuffer(size int) func() interface{} {
return func() interface{} {
return make([]byte, size)
}
}
func (srv *Server) init() {
srv.queue = make(chan *response)
srv.shutdown = make(chan struct{})
srv.conns = make(map[net.Conn]struct{})
if srv.UDPSize == 0 {
srv.UDPSize = MinMsgSize
}
srv.udpPool.New = makeUDPBuffer(srv.UDPSize)
}
func unlockOnce(l sync.Locker) func() {
var once sync.Once
return func() { once.Do(l.Unlock) }
}
// ListenAndServe starts a nameserver on the configured address in *Server. // ListenAndServe starts a nameserver on the configured address in *Server.
func (srv *Server) ListenAndServe() error { func (srv *Server) ListenAndServe() error {
unlock := unlockOnce(&srv.lock)
srv.lock.Lock() srv.lock.Lock()
defer srv.lock.Unlock() defer unlock()
if srv.started { if srv.started {
return &Error{err: "server already started"} return &Error{err: "server already started"}
} }
@ -372,63 +322,47 @@ func (srv *Server) ListenAndServe() error {
if addr == "" { if addr == "" {
addr = ":domain" addr = ":domain"
} }
if srv.UDPSize == 0 {
srv.UDPSize = MinMsgSize srv.init()
}
srv.queue = make(chan *response)
defer close(srv.queue) defer close(srv.queue)
switch srv.Net { switch srv.Net {
case "tcp", "tcp4", "tcp6": case "tcp", "tcp4", "tcp6":
a, err := net.ResolveTCPAddr(srv.Net, addr) l, err := listenTCP(srv.Net, addr, srv.ReusePort)
if err != nil {
return err
}
l, err := net.ListenTCP(srv.Net, a)
if err != nil { if err != nil {
return err return err
} }
srv.Listener = l srv.Listener = l
srv.started = true srv.started = true
srv.lock.Unlock() unlock()
err = srv.serveTCP(l) return srv.serveTCP(l)
srv.lock.Lock() // to satisfy the defer at the top
return err
case "tcp-tls", "tcp4-tls", "tcp6-tls": case "tcp-tls", "tcp4-tls", "tcp6-tls":
network := "tcp" if srv.TLSConfig == nil || (len(srv.TLSConfig.Certificates) == 0 && srv.TLSConfig.GetCertificate == nil) {
if srv.Net == "tcp4-tls" { return errors.New("dns: neither Certificates nor GetCertificate set in Config")
network = "tcp4"
} else if srv.Net == "tcp6-tls" {
network = "tcp6"
} }
network := strings.TrimSuffix(srv.Net, "-tls")
l, err := tls.Listen(network, addr, srv.TLSConfig) l, err := listenTCP(network, addr, srv.ReusePort)
if err != nil { if err != nil {
return err return err
} }
l = tls.NewListener(l, srv.TLSConfig)
srv.Listener = l srv.Listener = l
srv.started = true srv.started = true
srv.lock.Unlock() unlock()
err = srv.serveTCP(l) return srv.serveTCP(l)
srv.lock.Lock() // to satisfy the defer at the top
return err
case "udp", "udp4", "udp6": case "udp", "udp4", "udp6":
a, err := net.ResolveUDPAddr(srv.Net, addr) l, err := listenUDP(srv.Net, addr, srv.ReusePort)
if err != nil { if err != nil {
return err return err
} }
l, err := net.ListenUDP(srv.Net, a) u := l.(*net.UDPConn)
if err != nil { if e := setUDPSocketOptions(u); e != nil {
return err
}
if e := setUDPSocketOptions(l); e != nil {
return e return e
} }
srv.PacketConn = l srv.PacketConn = l
srv.started = true srv.started = true
srv.lock.Unlock() unlock()
err = srv.serveUDP(l) return srv.serveUDP(u)
srv.lock.Lock() // to satisfy the defer at the top
return err
} }
return &Error{err: "bad network"} return &Error{err: "bad network"}
} }
@ -436,20 +370,20 @@ func (srv *Server) ListenAndServe() error {
// ActivateAndServe starts a nameserver with the PacketConn or Listener // ActivateAndServe starts a nameserver with the PacketConn or Listener
// configured in *Server. Its main use is to start a server from systemd. // configured in *Server. Its main use is to start a server from systemd.
func (srv *Server) ActivateAndServe() error { func (srv *Server) ActivateAndServe() error {
unlock := unlockOnce(&srv.lock)
srv.lock.Lock() srv.lock.Lock()
defer srv.lock.Unlock() defer unlock()
if srv.started { if srv.started {
return &Error{err: "server already started"} return &Error{err: "server already started"}
} }
srv.init()
defer close(srv.queue)
pConn := srv.PacketConn pConn := srv.PacketConn
l := srv.Listener l := srv.Listener
srv.queue = make(chan *response)
defer close(srv.queue)
if pConn != nil { if pConn != nil {
if srv.UDPSize == 0 {
srv.UDPSize = MinMsgSize
}
// Check PacketConn interface's type is valid and value // Check PacketConn interface's type is valid and value
// is not nil // is not nil
if t, ok := pConn.(*net.UDPConn); ok && t != nil { if t, ok := pConn.(*net.UDPConn); ok && t != nil {
@ -457,18 +391,14 @@ func (srv *Server) ActivateAndServe() error {
return e return e
} }
srv.started = true srv.started = true
srv.lock.Unlock() unlock()
e := srv.serveUDP(t) return srv.serveUDP(t)
srv.lock.Lock() // to satisfy the defer at the top
return e
} }
} }
if l != nil { if l != nil {
srv.started = true srv.started = true
srv.lock.Unlock() unlock()
e := srv.serveTCP(l) return srv.serveTCP(l)
srv.lock.Lock() // to satisfy the defer at the top
return e
} }
return &Error{err: "bad listeners"} return &Error{err: "bad listeners"}
} }
@ -476,23 +406,58 @@ func (srv *Server) ActivateAndServe() error {
// Shutdown shuts down a server. After a call to Shutdown, ListenAndServe and // Shutdown shuts down a server. After a call to Shutdown, ListenAndServe and
// ActivateAndServe will return. // ActivateAndServe will return.
func (srv *Server) Shutdown() error { func (srv *Server) Shutdown() error {
return srv.ShutdownContext(context.Background())
}
// ShutdownContext shuts down a server. After a call to ShutdownContext,
// ListenAndServe and ActivateAndServe will return.
//
// A context.Context may be passed to limit how long to wait for connections
// to terminate.
func (srv *Server) ShutdownContext(ctx context.Context) error {
srv.lock.Lock() srv.lock.Lock()
if !srv.started { started := srv.started
srv.lock.Unlock()
return &Error{err: "server not started"}
}
srv.started = false srv.started = false
srv.lock.Unlock() srv.lock.Unlock()
if !started {
return &Error{err: "server not started"}
}
if srv.PacketConn != nil {
srv.PacketConn.SetReadDeadline(aLongTimeAgo) // Unblock reads
}
if srv.Listener != nil {
srv.Listener.Close()
}
srv.lock.Lock()
for rw := range srv.conns {
rw.SetReadDeadline(aLongTimeAgo) // Unblock reads
}
srv.lock.Unlock()
if testShutdownNotify != nil {
testShutdownNotify.Broadcast()
}
var ctxErr error
select {
case <-srv.shutdown:
case <-ctx.Done():
ctxErr = ctx.Err()
}
if srv.PacketConn != nil { if srv.PacketConn != nil {
srv.PacketConn.Close() srv.PacketConn.Close()
} }
if srv.Listener != nil {
srv.Listener.Close() return ctxErr
}
return nil
} }
var testShutdownNotify *sync.Cond
// getReadTimeout is a helper func to use system timeout if server did not intend to change it. // getReadTimeout is a helper func to use system timeout if server did not intend to change it.
func (srv *Server) getReadTimeout() time.Duration { func (srv *Server) getReadTimeout() time.Duration {
rtimeout := dnsTimeout rtimeout := dnsTimeout
@ -510,22 +475,36 @@ func (srv *Server) serveTCP(l net.Listener) error {
srv.NotifyStartedFunc() srv.NotifyStartedFunc()
} }
for { var wg sync.WaitGroup
defer func() {
wg.Wait()
close(srv.shutdown)
}()
for srv.isStarted() {
rw, err := l.Accept() rw, err := l.Accept()
srv.lock.RLock()
if !srv.started {
srv.lock.RUnlock()
return nil
}
srv.lock.RUnlock()
if err != nil { if err != nil {
if !srv.isStarted() {
return nil
}
if neterr, ok := err.(net.Error); ok && neterr.Temporary() { if neterr, ok := err.(net.Error); ok && neterr.Temporary() {
continue continue
} }
return err return err
} }
srv.spawnWorker(&response{tsigSecret: srv.TsigSecret, tcp: rw}) srv.lock.Lock()
// Track the connection to allow unblocking reads on shutdown.
srv.conns[rw] = struct{}{}
srv.lock.Unlock()
wg.Add(1)
srv.spawnWorker(&response{
tsigSecret: srv.TsigSecret,
tcp: rw,
wg: &wg,
})
} }
return nil
} }
// serveUDP starts a UDP listener for the server. // serveUDP starts a UDP listener for the server.
@ -541,27 +520,42 @@ func (srv *Server) serveUDP(l *net.UDPConn) error {
reader = srv.DecorateReader(reader) reader = srv.DecorateReader(reader)
} }
var wg sync.WaitGroup
defer func() {
wg.Wait()
close(srv.shutdown)
}()
rtimeout := srv.getReadTimeout() rtimeout := srv.getReadTimeout()
// deadline is not used here // deadline is not used here
for { for srv.isStarted() {
m, s, err := reader.ReadUDP(l, rtimeout) m, s, err := reader.ReadUDP(l, rtimeout)
srv.lock.RLock()
if !srv.started {
srv.lock.RUnlock()
return nil
}
srv.lock.RUnlock()
if err != nil { if err != nil {
if !srv.isStarted() {
return nil
}
if netErr, ok := err.(net.Error); ok && netErr.Temporary() { if netErr, ok := err.(net.Error); ok && netErr.Temporary() {
continue continue
} }
return err return err
} }
if len(m) < headerSize { if len(m) < headerSize {
if cap(m) == srv.UDPSize {
srv.udpPool.Put(m[:srv.UDPSize])
}
continue continue
} }
srv.spawnWorker(&response{msg: m, tsigSecret: srv.TsigSecret, udp: l, udpSession: s}) wg.Add(1)
srv.spawnWorker(&response{
msg: m,
tsigSecret: srv.TsigSecret,
udp: l,
udpSession: s,
wg: &wg,
})
} }
return nil
} }
func (srv *Server) serve(w *response) { func (srv *Server) serve(w *response) {
@ -574,20 +568,28 @@ func (srv *Server) serve(w *response) {
if w.udp != nil { if w.udp != nil {
// serve UDP // serve UDP
srv.serveDNS(w) srv.serveDNS(w)
return
}
reader := Reader(&defaultReader{srv}) w.wg.Done()
if srv.DecorateReader != nil { return
reader = srv.DecorateReader(reader)
} }
defer func() { defer func() {
if !w.hijacked { if !w.hijacked {
w.Close() w.Close()
} }
srv.lock.Lock()
delete(srv.conns, w.tcp)
srv.lock.Unlock()
w.wg.Done()
}() }()
reader := Reader(&defaultReader{srv})
if srv.DecorateReader != nil {
reader = srv.DecorateReader(reader)
}
idleTimeout := tcpIdleTimeout idleTimeout := tcpIdleTimeout
if srv.IdleTimeout != nil { if srv.IdleTimeout != nil {
idleTimeout = srv.IdleTimeout() idleTimeout = srv.IdleTimeout()
@ -600,7 +602,7 @@ func (srv *Server) serve(w *response) {
limit = maxTCPQueries limit = maxTCPQueries
} }
for q := 0; q < limit || limit == -1; q++ { for q := 0; (q < limit || limit == -1) && srv.isStarted(); q++ {
var err error var err error
w.msg, err = reader.ReadTCP(w.tcp, timeout) w.msg, err = reader.ReadTCP(w.tcp, timeout)
if err != nil { if err != nil {
@ -620,6 +622,13 @@ func (srv *Server) serve(w *response) {
} }
} }
func (srv *Server) disposeBuffer(w *response) {
if w.udp != nil && cap(w.msg) == srv.UDPSize {
srv.udpPool.Put(w.msg[:srv.UDPSize])
}
w.msg = nil
}
func (srv *Server) serveDNS(w *response) { func (srv *Server) serveDNS(w *response) {
req := new(Msg) req := new(Msg)
err := req.Unpack(w.msg) err := req.Unpack(w.msg)
@ -627,9 +636,9 @@ func (srv *Server) serveDNS(w *response) {
x := new(Msg) x := new(Msg)
x.SetRcodeFormatError(req) x.SetRcodeFormatError(req)
w.WriteMsg(x) w.WriteMsg(x)
return
} }
if !srv.Unsafe && req.Response { if err != nil || !srv.Unsafe && req.Response {
srv.disposeBuffer(w)
return return
} }
@ -646,6 +655,8 @@ func (srv *Server) serveDNS(w *response) {
} }
} }
srv.disposeBuffer(w)
handler := srv.Handler handler := srv.Handler
if handler == nil { if handler == nil {
handler = DefaultServeMux handler = DefaultServeMux
@ -691,9 +702,10 @@ func (srv *Server) readTCP(conn net.Conn, timeout time.Duration) ([]byte, error)
func (srv *Server) readUDP(conn *net.UDPConn, timeout time.Duration) ([]byte, *SessionUDP, error) { func (srv *Server) readUDP(conn *net.UDPConn, timeout time.Duration) ([]byte, *SessionUDP, error) {
conn.SetReadDeadline(time.Now().Add(timeout)) conn.SetReadDeadline(time.Now().Add(timeout))
m := make([]byte, srv.UDPSize) m := srv.udpPool.Get().([]byte)
n, s, err := ReadFromSessionUDP(conn, m) n, s, err := ReadFromSessionUDP(conn, m)
if err != nil { if err != nil {
srv.udpPool.Put(m)
return nil, nil, err return nil, nil, err
} }
m = m[:n] m = m[:n]
@ -780,3 +792,15 @@ func (w *response) Close() error {
} }
return nil return nil
} }
// ConnectionState() implements the ConnectionStater.ConnectionState() interface.
func (w *response) ConnectionState() *tls.ConnectionState {
type tlsConnectionStater interface {
ConnectionState() tls.ConnectionState
}
if v, ok := w.tcp.(tlsConnectionStater); ok {
t := v.ConnectionState()
return &t
}
return nil
}

View File

@ -127,8 +127,7 @@ func (rr *SIG) Verify(k *KEY, buf []byte) error {
if offset+1 >= buflen { if offset+1 >= buflen {
continue continue
} }
var rdlen uint16 rdlen := binary.BigEndian.Uint16(buf[offset:])
rdlen = binary.BigEndian.Uint16(buf[offset:])
offset += 2 offset += 2
offset += int(rdlen) offset += int(rdlen)
} }

20
vendor/github.com/miekg/dns/types.go generated vendored
View File

@ -330,7 +330,7 @@ func (rr *MX) String() string {
type AFSDB struct { type AFSDB struct {
Hdr RR_Header Hdr RR_Header
Subtype uint16 Subtype uint16
Hostname string `dns:"cdomain-name"` Hostname string `dns:"domain-name"`
} }
func (rr *AFSDB) String() string { func (rr *AFSDB) String() string {
@ -728,7 +728,7 @@ func (rr *LOC) String() string {
lat = lat % LOC_DEGREES lat = lat % LOC_DEGREES
m := lat / LOC_HOURS m := lat / LOC_HOURS
lat = lat % LOC_HOURS lat = lat % LOC_HOURS
s += fmt.Sprintf("%02d %02d %0.3f %s ", h, m, (float64(lat) / 1000), ns) s += fmt.Sprintf("%02d %02d %0.3f %s ", h, m, float64(lat)/1000, ns)
lon := rr.Longitude lon := rr.Longitude
ew := "E" ew := "E"
@ -742,7 +742,7 @@ func (rr *LOC) String() string {
lon = lon % LOC_DEGREES lon = lon % LOC_DEGREES
m = lon / LOC_HOURS m = lon / LOC_HOURS
lon = lon % LOC_HOURS lon = lon % LOC_HOURS
s += fmt.Sprintf("%02d %02d %0.3f %s ", h, m, (float64(lon) / 1000), ew) s += fmt.Sprintf("%02d %02d %0.3f %s ", h, m, float64(lon)/1000, ew)
var alt = float64(rr.Altitude) / 100 var alt = float64(rr.Altitude) / 100
alt -= LOC_ALTITUDEBASE alt -= LOC_ALTITUDEBASE
@ -752,9 +752,9 @@ func (rr *LOC) String() string {
s += fmt.Sprintf("%.0fm ", alt) s += fmt.Sprintf("%.0fm ", alt)
} }
s += cmToM((rr.Size&0xf0)>>4, rr.Size&0x0f) + "m " s += cmToM(rr.Size&0xf0>>4, rr.Size&0x0f) + "m "
s += cmToM((rr.HorizPre&0xf0)>>4, rr.HorizPre&0x0f) + "m " s += cmToM(rr.HorizPre&0xf0>>4, rr.HorizPre&0x0f) + "m "
s += cmToM((rr.VertPre&0xf0)>>4, rr.VertPre&0x0f) + "m" s += cmToM(rr.VertPre&0xf0>>4, rr.VertPre&0x0f) + "m"
return s return s
} }
@ -1306,11 +1306,11 @@ func (rr *CSYNC) len() int {
// string representation used when printing the record. // string representation used when printing the record.
// It takes serial arithmetic (RFC 1982) into account. // It takes serial arithmetic (RFC 1982) into account.
func TimeToString(t uint32) string { func TimeToString(t uint32) string {
mod := ((int64(t) - time.Now().Unix()) / year68) - 1 mod := (int64(t)-time.Now().Unix())/year68 - 1
if mod < 0 { if mod < 0 {
mod = 0 mod = 0
} }
ti := time.Unix(int64(t)-(mod*year68), 0).UTC() ti := time.Unix(int64(t)-mod*year68, 0).UTC()
return ti.Format("20060102150405") return ti.Format("20060102150405")
} }
@ -1322,11 +1322,11 @@ func StringToTime(s string) (uint32, error) {
if err != nil { if err != nil {
return 0, err return 0, err
} }
mod := (t.Unix() / year68) - 1 mod := t.Unix()/year68 - 1
if mod < 0 { if mod < 0 {
mod = 0 mod = 0
} }
return uint32(t.Unix() - (mod * year68)), nil return uint32(t.Unix() - mod*year68), nil
} }
// saltToString converts a NSECX salt to uppercase and returns "-" when it is empty. // saltToString converts a NSECX salt to uppercase and returns "-" when it is empty.

View File

@ -3,7 +3,7 @@ package dns
import "fmt" import "fmt"
// Version is current version of this library. // Version is current version of this library.
var Version = V{1, 0, 8} var Version = V{1, 0, 12}
// V holds the version of this library. // V holds the version of this library.
type V struct { type V struct {

View File

@ -109,9 +109,6 @@ func compressionLenHelperType(c map[string]int, r RR, initLen int) int {
func compressionLenSearchType(c map[string]int, r RR) (int, bool, int) { func compressionLenSearchType(c map[string]int, r RR) (int, bool, int) {
switch x := r.(type) { switch x := r.(type) {
case *AFSDB:
k1, ok1, sz1 := compressionLenSearch(c, x.Hostname)
return k1, ok1, sz1
case *CNAME: case *CNAME:
k1, ok1, sz1 := compressionLenSearch(c, x.Target) k1, ok1, sz1 := compressionLenSearch(c, x.Target)
return k1, ok1, sz1 return k1, ok1, sz1

943
vendor/github.com/miekg/dns/zduplicate.go generated vendored Normal file
View File

@ -0,0 +1,943 @@
// Code generated by "go run duplicate_generate.go"; DO NOT EDIT.
package dns
// isDuplicateRdata calls the rdata specific functions
func isDuplicateRdata(r1, r2 RR) bool {
switch r1.Header().Rrtype {
case TypeA:
return isDuplicateA(r1.(*A), r2.(*A))
case TypeAAAA:
return isDuplicateAAAA(r1.(*AAAA), r2.(*AAAA))
case TypeAFSDB:
return isDuplicateAFSDB(r1.(*AFSDB), r2.(*AFSDB))
case TypeAVC:
return isDuplicateAVC(r1.(*AVC), r2.(*AVC))
case TypeCAA:
return isDuplicateCAA(r1.(*CAA), r2.(*CAA))
case TypeCERT:
return isDuplicateCERT(r1.(*CERT), r2.(*CERT))
case TypeCNAME:
return isDuplicateCNAME(r1.(*CNAME), r2.(*CNAME))
case TypeCSYNC:
return isDuplicateCSYNC(r1.(*CSYNC), r2.(*CSYNC))
case TypeDHCID:
return isDuplicateDHCID(r1.(*DHCID), r2.(*DHCID))
case TypeDNAME:
return isDuplicateDNAME(r1.(*DNAME), r2.(*DNAME))
case TypeDNSKEY:
return isDuplicateDNSKEY(r1.(*DNSKEY), r2.(*DNSKEY))
case TypeDS:
return isDuplicateDS(r1.(*DS), r2.(*DS))
case TypeEID:
return isDuplicateEID(r1.(*EID), r2.(*EID))
case TypeEUI48:
return isDuplicateEUI48(r1.(*EUI48), r2.(*EUI48))
case TypeEUI64:
return isDuplicateEUI64(r1.(*EUI64), r2.(*EUI64))
case TypeGID:
return isDuplicateGID(r1.(*GID), r2.(*GID))
case TypeGPOS:
return isDuplicateGPOS(r1.(*GPOS), r2.(*GPOS))
case TypeHINFO:
return isDuplicateHINFO(r1.(*HINFO), r2.(*HINFO))
case TypeHIP:
return isDuplicateHIP(r1.(*HIP), r2.(*HIP))
case TypeKX:
return isDuplicateKX(r1.(*KX), r2.(*KX))
case TypeL32:
return isDuplicateL32(r1.(*L32), r2.(*L32))
case TypeL64:
return isDuplicateL64(r1.(*L64), r2.(*L64))
case TypeLOC:
return isDuplicateLOC(r1.(*LOC), r2.(*LOC))
case TypeLP:
return isDuplicateLP(r1.(*LP), r2.(*LP))
case TypeMB:
return isDuplicateMB(r1.(*MB), r2.(*MB))
case TypeMD:
return isDuplicateMD(r1.(*MD), r2.(*MD))
case TypeMF:
return isDuplicateMF(r1.(*MF), r2.(*MF))
case TypeMG:
return isDuplicateMG(r1.(*MG), r2.(*MG))
case TypeMINFO:
return isDuplicateMINFO(r1.(*MINFO), r2.(*MINFO))
case TypeMR:
return isDuplicateMR(r1.(*MR), r2.(*MR))
case TypeMX:
return isDuplicateMX(r1.(*MX), r2.(*MX))
case TypeNAPTR:
return isDuplicateNAPTR(r1.(*NAPTR), r2.(*NAPTR))
case TypeNID:
return isDuplicateNID(r1.(*NID), r2.(*NID))
case TypeNIMLOC:
return isDuplicateNIMLOC(r1.(*NIMLOC), r2.(*NIMLOC))
case TypeNINFO:
return isDuplicateNINFO(r1.(*NINFO), r2.(*NINFO))
case TypeNS:
return isDuplicateNS(r1.(*NS), r2.(*NS))
case TypeNSAPPTR:
return isDuplicateNSAPPTR(r1.(*NSAPPTR), r2.(*NSAPPTR))
case TypeNSEC:
return isDuplicateNSEC(r1.(*NSEC), r2.(*NSEC))
case TypeNSEC3:
return isDuplicateNSEC3(r1.(*NSEC3), r2.(*NSEC3))
case TypeNSEC3PARAM:
return isDuplicateNSEC3PARAM(r1.(*NSEC3PARAM), r2.(*NSEC3PARAM))
case TypeOPENPGPKEY:
return isDuplicateOPENPGPKEY(r1.(*OPENPGPKEY), r2.(*OPENPGPKEY))
case TypePTR:
return isDuplicatePTR(r1.(*PTR), r2.(*PTR))
case TypePX:
return isDuplicatePX(r1.(*PX), r2.(*PX))
case TypeRKEY:
return isDuplicateRKEY(r1.(*RKEY), r2.(*RKEY))
case TypeRP:
return isDuplicateRP(r1.(*RP), r2.(*RP))
case TypeRRSIG:
return isDuplicateRRSIG(r1.(*RRSIG), r2.(*RRSIG))
case TypeRT:
return isDuplicateRT(r1.(*RT), r2.(*RT))
case TypeSMIMEA:
return isDuplicateSMIMEA(r1.(*SMIMEA), r2.(*SMIMEA))
case TypeSOA:
return isDuplicateSOA(r1.(*SOA), r2.(*SOA))
case TypeSPF:
return isDuplicateSPF(r1.(*SPF), r2.(*SPF))
case TypeSRV:
return isDuplicateSRV(r1.(*SRV), r2.(*SRV))
case TypeSSHFP:
return isDuplicateSSHFP(r1.(*SSHFP), r2.(*SSHFP))
case TypeTA:
return isDuplicateTA(r1.(*TA), r2.(*TA))
case TypeTALINK:
return isDuplicateTALINK(r1.(*TALINK), r2.(*TALINK))
case TypeTKEY:
return isDuplicateTKEY(r1.(*TKEY), r2.(*TKEY))
case TypeTLSA:
return isDuplicateTLSA(r1.(*TLSA), r2.(*TLSA))
case TypeTSIG:
return isDuplicateTSIG(r1.(*TSIG), r2.(*TSIG))
case TypeTXT:
return isDuplicateTXT(r1.(*TXT), r2.(*TXT))
case TypeUID:
return isDuplicateUID(r1.(*UID), r2.(*UID))
case TypeUINFO:
return isDuplicateUINFO(r1.(*UINFO), r2.(*UINFO))
case TypeURI:
return isDuplicateURI(r1.(*URI), r2.(*URI))
case TypeX25:
return isDuplicateX25(r1.(*X25), r2.(*X25))
}
return false
}
// isDuplicate() functions
func isDuplicateA(r1, r2 *A) bool {
if len(r1.A) != len(r2.A) {
return false
}
for i := 0; i < len(r1.A); i++ {
if r1.A[i] != r2.A[i] {
return false
}
}
return true
}
func isDuplicateAAAA(r1, r2 *AAAA) bool {
if len(r1.AAAA) != len(r2.AAAA) {
return false
}
for i := 0; i < len(r1.AAAA); i++ {
if r1.AAAA[i] != r2.AAAA[i] {
return false
}
}
return true
}
func isDuplicateAFSDB(r1, r2 *AFSDB) bool {
if r1.Subtype != r2.Subtype {
return false
}
if !isDulicateName(r1.Hostname, r2.Hostname) {
return false
}
return true
}
func isDuplicateAVC(r1, r2 *AVC) bool {
if len(r1.Txt) != len(r2.Txt) {
return false
}
for i := 0; i < len(r1.Txt); i++ {
if r1.Txt[i] != r2.Txt[i] {
return false
}
}
return true
}
func isDuplicateCAA(r1, r2 *CAA) bool {
if r1.Flag != r2.Flag {
return false
}
if r1.Tag != r2.Tag {
return false
}
if r1.Value != r2.Value {
return false
}
return true
}
func isDuplicateCERT(r1, r2 *CERT) bool {
if r1.Type != r2.Type {
return false
}
if r1.KeyTag != r2.KeyTag {
return false
}
if r1.Algorithm != r2.Algorithm {
return false
}
if r1.Certificate != r2.Certificate {
return false
}
return true
}
func isDuplicateCNAME(r1, r2 *CNAME) bool {
if !isDulicateName(r1.Target, r2.Target) {
return false
}
return true
}
func isDuplicateCSYNC(r1, r2 *CSYNC) bool {
if r1.Serial != r2.Serial {
return false
}
if r1.Flags != r2.Flags {
return false
}
if len(r1.TypeBitMap) != len(r2.TypeBitMap) {
return false
}
for i := 0; i < len(r1.TypeBitMap); i++ {
if r1.TypeBitMap[i] != r2.TypeBitMap[i] {
return false
}
}
return true
}
func isDuplicateDHCID(r1, r2 *DHCID) bool {
if r1.Digest != r2.Digest {
return false
}
return true
}
func isDuplicateDNAME(r1, r2 *DNAME) bool {
if !isDulicateName(r1.Target, r2.Target) {
return false
}
return true
}
func isDuplicateDNSKEY(r1, r2 *DNSKEY) bool {
if r1.Flags != r2.Flags {
return false
}
if r1.Protocol != r2.Protocol {
return false
}
if r1.Algorithm != r2.Algorithm {
return false
}
if r1.PublicKey != r2.PublicKey {
return false
}
return true
}
func isDuplicateDS(r1, r2 *DS) bool {
if r1.KeyTag != r2.KeyTag {
return false
}
if r1.Algorithm != r2.Algorithm {
return false
}
if r1.DigestType != r2.DigestType {
return false
}
if r1.Digest != r2.Digest {
return false
}
return true
}
func isDuplicateEID(r1, r2 *EID) bool {
if r1.Endpoint != r2.Endpoint {
return false
}
return true
}
func isDuplicateEUI48(r1, r2 *EUI48) bool {
if r1.Address != r2.Address {
return false
}
return true
}
func isDuplicateEUI64(r1, r2 *EUI64) bool {
if r1.Address != r2.Address {
return false
}
return true
}
func isDuplicateGID(r1, r2 *GID) bool {
if r1.Gid != r2.Gid {
return false
}
return true
}
func isDuplicateGPOS(r1, r2 *GPOS) bool {
if r1.Longitude != r2.Longitude {
return false
}
if r1.Latitude != r2.Latitude {
return false
}
if r1.Altitude != r2.Altitude {
return false
}
return true
}
func isDuplicateHINFO(r1, r2 *HINFO) bool {
if r1.Cpu != r2.Cpu {
return false
}
if r1.Os != r2.Os {
return false
}
return true
}
func isDuplicateHIP(r1, r2 *HIP) bool {
if r1.HitLength != r2.HitLength {
return false
}
if r1.PublicKeyAlgorithm != r2.PublicKeyAlgorithm {
return false
}
if r1.PublicKeyLength != r2.PublicKeyLength {
return false
}
if r1.Hit != r2.Hit {
return false
}
if r1.PublicKey != r2.PublicKey {
return false
}
if len(r1.RendezvousServers) != len(r2.RendezvousServers) {
return false
}
for i := 0; i < len(r1.RendezvousServers); i++ {
if !isDulicateName(r1.RendezvousServers[i], r2.RendezvousServers[i]) {
return false
}
}
return true
}
func isDuplicateKX(r1, r2 *KX) bool {
if r1.Preference != r2.Preference {
return false
}
if !isDulicateName(r1.Exchanger, r2.Exchanger) {
return false
}
return true
}
func isDuplicateL32(r1, r2 *L32) bool {
if r1.Preference != r2.Preference {
return false
}
if len(r1.Locator32) != len(r2.Locator32) {
return false
}
for i := 0; i < len(r1.Locator32); i++ {
if r1.Locator32[i] != r2.Locator32[i] {
return false
}
}
return true
}
func isDuplicateL64(r1, r2 *L64) bool {
if r1.Preference != r2.Preference {
return false
}
if r1.Locator64 != r2.Locator64 {
return false
}
return true
}
func isDuplicateLOC(r1, r2 *LOC) bool {
if r1.Version != r2.Version {
return false
}
if r1.Size != r2.Size {
return false
}
if r1.HorizPre != r2.HorizPre {
return false
}
if r1.VertPre != r2.VertPre {
return false
}
if r1.Latitude != r2.Latitude {
return false
}
if r1.Longitude != r2.Longitude {
return false
}
if r1.Altitude != r2.Altitude {
return false
}
return true
}
func isDuplicateLP(r1, r2 *LP) bool {
if r1.Preference != r2.Preference {
return false
}
if !isDulicateName(r1.Fqdn, r2.Fqdn) {
return false
}
return true
}
func isDuplicateMB(r1, r2 *MB) bool {
if !isDulicateName(r1.Mb, r2.Mb) {
return false
}
return true
}
func isDuplicateMD(r1, r2 *MD) bool {
if !isDulicateName(r1.Md, r2.Md) {
return false
}
return true
}
func isDuplicateMF(r1, r2 *MF) bool {
if !isDulicateName(r1.Mf, r2.Mf) {
return false
}
return true
}
func isDuplicateMG(r1, r2 *MG) bool {
if !isDulicateName(r1.Mg, r2.Mg) {
return false
}
return true
}
func isDuplicateMINFO(r1, r2 *MINFO) bool {
if !isDulicateName(r1.Rmail, r2.Rmail) {
return false
}
if !isDulicateName(r1.Email, r2.Email) {
return false
}
return true
}
func isDuplicateMR(r1, r2 *MR) bool {
if !isDulicateName(r1.Mr, r2.Mr) {
return false
}
return true
}
func isDuplicateMX(r1, r2 *MX) bool {
if r1.Preference != r2.Preference {
return false
}
if !isDulicateName(r1.Mx, r2.Mx) {
return false
}
return true
}
func isDuplicateNAPTR(r1, r2 *NAPTR) bool {
if r1.Order != r2.Order {
return false
}
if r1.Preference != r2.Preference {
return false
}
if r1.Flags != r2.Flags {
return false
}
if r1.Service != r2.Service {
return false
}
if r1.Regexp != r2.Regexp {
return false
}
if !isDulicateName(r1.Replacement, r2.Replacement) {
return false
}
return true
}
func isDuplicateNID(r1, r2 *NID) bool {
if r1.Preference != r2.Preference {
return false
}
if r1.NodeID != r2.NodeID {
return false
}
return true
}
func isDuplicateNIMLOC(r1, r2 *NIMLOC) bool {
if r1.Locator != r2.Locator {
return false
}
return true
}
func isDuplicateNINFO(r1, r2 *NINFO) bool {
if len(r1.ZSData) != len(r2.ZSData) {
return false
}
for i := 0; i < len(r1.ZSData); i++ {
if r1.ZSData[i] != r2.ZSData[i] {
return false
}
}
return true
}
func isDuplicateNS(r1, r2 *NS) bool {
if !isDulicateName(r1.Ns, r2.Ns) {
return false
}
return true
}
func isDuplicateNSAPPTR(r1, r2 *NSAPPTR) bool {
if !isDulicateName(r1.Ptr, r2.Ptr) {
return false
}
return true
}
func isDuplicateNSEC(r1, r2 *NSEC) bool {
if !isDulicateName(r1.NextDomain, r2.NextDomain) {
return false
}
if len(r1.TypeBitMap) != len(r2.TypeBitMap) {
return false
}
for i := 0; i < len(r1.TypeBitMap); i++ {
if r1.TypeBitMap[i] != r2.TypeBitMap[i] {
return false
}
}
return true
}
func isDuplicateNSEC3(r1, r2 *NSEC3) bool {
if r1.Hash != r2.Hash {
return false
}
if r1.Flags != r2.Flags {
return false
}
if r1.Iterations != r2.Iterations {
return false
}
if r1.SaltLength != r2.SaltLength {
return false
}
if r1.Salt != r2.Salt {
return false
}
if r1.HashLength != r2.HashLength {
return false
}
if r1.NextDomain != r2.NextDomain {
return false
}
if len(r1.TypeBitMap) != len(r2.TypeBitMap) {
return false
}
for i := 0; i < len(r1.TypeBitMap); i++ {
if r1.TypeBitMap[i] != r2.TypeBitMap[i] {
return false
}
}
return true
}
func isDuplicateNSEC3PARAM(r1, r2 *NSEC3PARAM) bool {
if r1.Hash != r2.Hash {
return false
}
if r1.Flags != r2.Flags {
return false
}
if r1.Iterations != r2.Iterations {
return false
}
if r1.SaltLength != r2.SaltLength {
return false
}
if r1.Salt != r2.Salt {
return false
}
return true
}
func isDuplicateOPENPGPKEY(r1, r2 *OPENPGPKEY) bool {
if r1.PublicKey != r2.PublicKey {
return false
}
return true
}
func isDuplicatePTR(r1, r2 *PTR) bool {
if !isDulicateName(r1.Ptr, r2.Ptr) {
return false
}
return true
}
func isDuplicatePX(r1, r2 *PX) bool {
if r1.Preference != r2.Preference {
return false
}
if !isDulicateName(r1.Map822, r2.Map822) {
return false
}
if !isDulicateName(r1.Mapx400, r2.Mapx400) {
return false
}
return true
}
func isDuplicateRKEY(r1, r2 *RKEY) bool {
if r1.Flags != r2.Flags {
return false
}
if r1.Protocol != r2.Protocol {
return false
}
if r1.Algorithm != r2.Algorithm {
return false
}
if r1.PublicKey != r2.PublicKey {
return false
}
return true
}
func isDuplicateRP(r1, r2 *RP) bool {
if !isDulicateName(r1.Mbox, r2.Mbox) {
return false
}
if !isDulicateName(r1.Txt, r2.Txt) {
return false
}
return true
}
func isDuplicateRRSIG(r1, r2 *RRSIG) bool {
if r1.TypeCovered != r2.TypeCovered {
return false
}
if r1.Algorithm != r2.Algorithm {
return false
}
if r1.Labels != r2.Labels {
return false
}
if r1.OrigTtl != r2.OrigTtl {
return false
}
if r1.Expiration != r2.Expiration {
return false
}
if r1.Inception != r2.Inception {
return false
}
if r1.KeyTag != r2.KeyTag {
return false
}
if !isDulicateName(r1.SignerName, r2.SignerName) {
return false
}
if r1.Signature != r2.Signature {
return false
}
return true
}
func isDuplicateRT(r1, r2 *RT) bool {
if r1.Preference != r2.Preference {
return false
}
if !isDulicateName(r1.Host, r2.Host) {
return false
}
return true
}
func isDuplicateSMIMEA(r1, r2 *SMIMEA) bool {
if r1.Usage != r2.Usage {
return false
}
if r1.Selector != r2.Selector {
return false
}
if r1.MatchingType != r2.MatchingType {
return false
}
if r1.Certificate != r2.Certificate {
return false
}
return true
}
func isDuplicateSOA(r1, r2 *SOA) bool {
if !isDulicateName(r1.Ns, r2.Ns) {
return false
}
if !isDulicateName(r1.Mbox, r2.Mbox) {
return false
}
if r1.Serial != r2.Serial {
return false
}
if r1.Refresh != r2.Refresh {
return false
}
if r1.Retry != r2.Retry {
return false
}
if r1.Expire != r2.Expire {
return false
}
if r1.Minttl != r2.Minttl {
return false
}
return true
}
func isDuplicateSPF(r1, r2 *SPF) bool {
if len(r1.Txt) != len(r2.Txt) {
return false
}
for i := 0; i < len(r1.Txt); i++ {
if r1.Txt[i] != r2.Txt[i] {
return false
}
}
return true
}
func isDuplicateSRV(r1, r2 *SRV) bool {
if r1.Priority != r2.Priority {
return false
}
if r1.Weight != r2.Weight {
return false
}
if r1.Port != r2.Port {
return false
}
if !isDulicateName(r1.Target, r2.Target) {
return false
}
return true
}
func isDuplicateSSHFP(r1, r2 *SSHFP) bool {
if r1.Algorithm != r2.Algorithm {
return false
}
if r1.Type != r2.Type {
return false
}
if r1.FingerPrint != r2.FingerPrint {
return false
}
return true
}
func isDuplicateTA(r1, r2 *TA) bool {
if r1.KeyTag != r2.KeyTag {
return false
}
if r1.Algorithm != r2.Algorithm {
return false
}
if r1.DigestType != r2.DigestType {
return false
}
if r1.Digest != r2.Digest {
return false
}
return true
}
func isDuplicateTALINK(r1, r2 *TALINK) bool {
if !isDulicateName(r1.PreviousName, r2.PreviousName) {
return false
}
if !isDulicateName(r1.NextName, r2.NextName) {
return false
}
return true
}
func isDuplicateTKEY(r1, r2 *TKEY) bool {
if !isDulicateName(r1.Algorithm, r2.Algorithm) {
return false
}
if r1.Inception != r2.Inception {
return false
}
if r1.Expiration != r2.Expiration {
return false
}
if r1.Mode != r2.Mode {
return false
}
if r1.Error != r2.Error {
return false
}
if r1.KeySize != r2.KeySize {
return false
}
if r1.Key != r2.Key {
return false
}
if r1.OtherLen != r2.OtherLen {
return false
}
if r1.OtherData != r2.OtherData {
return false
}
return true
}
func isDuplicateTLSA(r1, r2 *TLSA) bool {
if r1.Usage != r2.Usage {
return false
}
if r1.Selector != r2.Selector {
return false
}
if r1.MatchingType != r2.MatchingType {
return false
}
if r1.Certificate != r2.Certificate {
return false
}
return true
}
func isDuplicateTSIG(r1, r2 *TSIG) bool {
if !isDulicateName(r1.Algorithm, r2.Algorithm) {
return false
}
if r1.TimeSigned != r2.TimeSigned {
return false
}
if r1.Fudge != r2.Fudge {
return false
}
if r1.MACSize != r2.MACSize {
return false
}
if r1.MAC != r2.MAC {
return false
}
if r1.OrigId != r2.OrigId {
return false
}
if r1.Error != r2.Error {
return false
}
if r1.OtherLen != r2.OtherLen {
return false
}
if r1.OtherData != r2.OtherData {
return false
}
return true
}
func isDuplicateTXT(r1, r2 *TXT) bool {
if len(r1.Txt) != len(r2.Txt) {
return false
}
for i := 0; i < len(r1.Txt); i++ {
if r1.Txt[i] != r2.Txt[i] {
return false
}
}
return true
}
func isDuplicateUID(r1, r2 *UID) bool {
if r1.Uid != r2.Uid {
return false
}
return true
}
func isDuplicateUINFO(r1, r2 *UINFO) bool {
if r1.Uinfo != r2.Uinfo {
return false
}
return true
}
func isDuplicateURI(r1, r2 *URI) bool {
if r1.Priority != r2.Priority {
return false
}
if r1.Weight != r2.Weight {
return false
}
if r1.Target != r2.Target {
return false
}
return true
}
func isDuplicateX25(r1, r2 *X25) bool {
if r1.PSDNAddress != r2.PSDNAddress {
return false
}
return true
}

View File

@ -42,7 +42,7 @@ func (rr *AFSDB) pack(msg []byte, off int, compression map[string]int, compress
if err != nil { if err != nil {
return off, err return off, err
} }
off, err = PackDomainName(rr.Hostname, msg, off, compression, compress) off, err = PackDomainName(rr.Hostname, msg, off, compression, false)
if err != nil { if err != nil {
return off, err return off, err
} }

View File

@ -1,7 +1,7 @@
language: go language: go
go: go:
- 1.9.x - "1.11.x"
- tip - tip
script: script:

21
vendor/github.com/mitchellh/mapstructure/CHANGELOG.md generated vendored Normal file
View File

@ -0,0 +1,21 @@
## 1.1.2
* Fix error when decode hook decodes interface implementation into interface
type. [GH-140]
## 1.1.1
* Fix panic that can happen in `decodePtr`
## 1.1.0
* Added `StringToIPHookFunc` to convert `string` to `net.IP` and `net.IPNet` [GH-133]
* Support struct to struct decoding [GH-137]
* If source map value is nil, then destination map value is nil (instead of empty)
* If source slice value is nil, then destination slice value is nil (instead of empty)
* If source pointer is nil, then destination pointer is set to nil (instead of
allocated zero value of type)
## 1.0.0
* Initial tagged stable release.

View File

@ -2,6 +2,8 @@ package mapstructure
import ( import (
"errors" "errors"
"fmt"
"net"
"reflect" "reflect"
"strconv" "strconv"
"strings" "strings"
@ -115,6 +117,50 @@ func StringToTimeDurationHookFunc() DecodeHookFunc {
} }
} }
// StringToIPHookFunc returns a DecodeHookFunc that converts
// strings to net.IP
func StringToIPHookFunc() DecodeHookFunc {
return func(
f reflect.Type,
t reflect.Type,
data interface{}) (interface{}, error) {
if f.Kind() != reflect.String {
return data, nil
}
if t != reflect.TypeOf(net.IP{}) {
return data, nil
}
// Convert it by parsing
ip := net.ParseIP(data.(string))
if ip == nil {
return net.IP{}, fmt.Errorf("failed parsing ip %v", data)
}
return ip, nil
}
}
// StringToIPNetHookFunc returns a DecodeHookFunc that converts
// strings to net.IPNet
func StringToIPNetHookFunc() DecodeHookFunc {
return func(
f reflect.Type,
t reflect.Type,
data interface{}) (interface{}, error) {
if f.Kind() != reflect.String {
return data, nil
}
if t != reflect.TypeOf(net.IPNet{}) {
return data, nil
}
// Convert it by parsing
_, net, err := net.ParseCIDR(data.(string))
return net, err
}
}
// StringToTimeHookFunc returns a DecodeHookFunc that converts // StringToTimeHookFunc returns a DecodeHookFunc that converts
// strings to time.Time. // strings to time.Time.
func StringToTimeHookFunc(layout string) DecodeHookFunc { func StringToTimeHookFunc(layout string) DecodeHookFunc {

View File

@ -224,6 +224,17 @@ func (d *Decoder) Decode(input interface{}) error {
// Decodes an unknown data type into a specific reflection value. // Decodes an unknown data type into a specific reflection value.
func (d *Decoder) decode(name string, input interface{}, outVal reflect.Value) error { func (d *Decoder) decode(name string, input interface{}, outVal reflect.Value) error {
var inputVal reflect.Value
if input != nil {
inputVal = reflect.ValueOf(input)
// We need to check here if input is a typed nil. Typed nils won't
// match the "input == nil" below so we check that here.
if inputVal.Kind() == reflect.Ptr && inputVal.IsNil() {
input = nil
}
}
if input == nil { if input == nil {
// If the data is nil, then we don't set anything, unless ZeroFields is set // If the data is nil, then we don't set anything, unless ZeroFields is set
// to true. // to true.
@ -237,7 +248,6 @@ func (d *Decoder) decode(name string, input interface{}, outVal reflect.Value) e
return nil return nil
} }
inputVal := reflect.ValueOf(input)
if !inputVal.IsValid() { if !inputVal.IsValid() {
// If the input value is invalid, then we just set the value // If the input value is invalid, then we just set the value
// to be the zero value. // to be the zero value.
@ -260,8 +270,8 @@ func (d *Decoder) decode(name string, input interface{}, outVal reflect.Value) e
} }
var err error var err error
inputKind := getKind(outVal) outputKind := getKind(outVal)
switch inputKind { switch outputKind {
case reflect.Bool: case reflect.Bool:
err = d.decodeBool(name, input, outVal) err = d.decodeBool(name, input, outVal)
case reflect.Interface: case reflect.Interface:
@ -288,7 +298,7 @@ func (d *Decoder) decode(name string, input interface{}, outVal reflect.Value) e
err = d.decodeFunc(name, input, outVal) err = d.decodeFunc(name, input, outVal)
default: default:
// If we reached this point then we weren't able to decode it // If we reached this point then we weren't able to decode it
return fmt.Errorf("%s: unsupported type: %s", name, inputKind) return fmt.Errorf("%s: unsupported type: %s", name, outputKind)
} }
// If we reached here, then we successfully decoded SOMETHING, so // If we reached here, then we successfully decoded SOMETHING, so
@ -306,7 +316,16 @@ func (d *Decoder) decodeBasic(name string, data interface{}, val reflect.Value)
if val.IsValid() && val.Elem().IsValid() { if val.IsValid() && val.Elem().IsValid() {
return d.decode(name, data, val.Elem()) return d.decode(name, data, val.Elem())
} }
dataVal := reflect.ValueOf(data) dataVal := reflect.ValueOf(data)
// If the input data is a pointer, and the assigned type is the dereference
// of that exact pointer, then indirect it so that we can assign it.
// Example: *string to string
if dataVal.Kind() == reflect.Ptr && dataVal.Type().Elem() == val.Type() {
dataVal = reflect.Indirect(dataVal)
}
if !dataVal.IsValid() { if !dataVal.IsValid() {
dataVal = reflect.Zero(val.Type()) dataVal = reflect.Zero(val.Type())
} }
@ -323,7 +342,7 @@ func (d *Decoder) decodeBasic(name string, data interface{}, val reflect.Value)
} }
func (d *Decoder) decodeString(name string, data interface{}, val reflect.Value) error { func (d *Decoder) decodeString(name string, data interface{}, val reflect.Value) error {
dataVal := reflect.ValueOf(data) dataVal := reflect.Indirect(reflect.ValueOf(data))
dataKind := getKind(dataVal) dataKind := getKind(dataVal)
converted := true converted := true
@ -375,7 +394,7 @@ func (d *Decoder) decodeString(name string, data interface{}, val reflect.Value)
} }
func (d *Decoder) decodeInt(name string, data interface{}, val reflect.Value) error { func (d *Decoder) decodeInt(name string, data interface{}, val reflect.Value) error {
dataVal := reflect.ValueOf(data) dataVal := reflect.Indirect(reflect.ValueOf(data))
dataKind := getKind(dataVal) dataKind := getKind(dataVal)
dataType := dataVal.Type() dataType := dataVal.Type()
@ -417,7 +436,7 @@ func (d *Decoder) decodeInt(name string, data interface{}, val reflect.Value) er
} }
func (d *Decoder) decodeUint(name string, data interface{}, val reflect.Value) error { func (d *Decoder) decodeUint(name string, data interface{}, val reflect.Value) error {
dataVal := reflect.ValueOf(data) dataVal := reflect.Indirect(reflect.ValueOf(data))
dataKind := getKind(dataVal) dataKind := getKind(dataVal)
switch { switch {
@ -460,7 +479,7 @@ func (d *Decoder) decodeUint(name string, data interface{}, val reflect.Value) e
} }
func (d *Decoder) decodeBool(name string, data interface{}, val reflect.Value) error { func (d *Decoder) decodeBool(name string, data interface{}, val reflect.Value) error {
dataVal := reflect.ValueOf(data) dataVal := reflect.Indirect(reflect.ValueOf(data))
dataKind := getKind(dataVal) dataKind := getKind(dataVal)
switch { switch {
@ -491,7 +510,7 @@ func (d *Decoder) decodeBool(name string, data interface{}, val reflect.Value) e
} }
func (d *Decoder) decodeFloat(name string, data interface{}, val reflect.Value) error { func (d *Decoder) decodeFloat(name string, data interface{}, val reflect.Value) error {
dataVal := reflect.ValueOf(data) dataVal := reflect.Indirect(reflect.ValueOf(data))
dataKind := getKind(dataVal) dataKind := getKind(dataVal)
dataType := dataVal.Type() dataType := dataVal.Type()
@ -595,6 +614,20 @@ func (d *Decoder) decodeMapFromMap(name string, dataVal reflect.Value, val refle
// Accumulate errors // Accumulate errors
errors := make([]string, 0) errors := make([]string, 0)
// If the input data is empty, then we just match what the input data is.
if dataVal.Len() == 0 {
if dataVal.IsNil() {
if !val.IsNil() {
val.Set(dataVal)
}
} else {
// Set to empty allocated value
val.Set(valMap)
}
return nil
}
for _, k := range dataVal.MapKeys() { for _, k := range dataVal.MapKeys() {
fieldName := fmt.Sprintf("%s[%s]", name, k) fieldName := fmt.Sprintf("%s[%s]", name, k)
@ -706,11 +739,33 @@ func (d *Decoder) decodeMapFromStruct(name string, dataVal reflect.Value, val re
} }
func (d *Decoder) decodePtr(name string, data interface{}, val reflect.Value) error { func (d *Decoder) decodePtr(name string, data interface{}, val reflect.Value) error {
// If the input data is nil, then we want to just set the output
// pointer to be nil as well.
isNil := data == nil
if !isNil {
switch v := reflect.Indirect(reflect.ValueOf(data)); v.Kind() {
case reflect.Chan,
reflect.Func,
reflect.Interface,
reflect.Map,
reflect.Ptr,
reflect.Slice:
isNil = v.IsNil()
}
}
if isNil {
if !val.IsNil() && val.CanSet() {
nilValue := reflect.New(val.Type()).Elem()
val.Set(nilValue)
}
return nil
}
// Create an element of the concrete (non pointer) type and decode // Create an element of the concrete (non pointer) type and decode
// into that. Then set the value of the pointer to this type. // into that. Then set the value of the pointer to this type.
valType := val.Type() valType := val.Type()
valElemType := valType.Elem() valElemType := valType.Elem()
if val.CanSet() { if val.CanSet() {
realVal := val realVal := val
if realVal.IsNil() || d.config.ZeroFields { if realVal.IsNil() || d.config.ZeroFields {
@ -752,33 +807,44 @@ func (d *Decoder) decodeSlice(name string, data interface{}, val reflect.Value)
valSlice := val valSlice := val
if valSlice.IsNil() || d.config.ZeroFields { if valSlice.IsNil() || d.config.ZeroFields {
if d.config.WeaklyTypedInput {
switch {
// Slice and array we use the normal logic
case dataValKind == reflect.Slice, dataValKind == reflect.Array:
break
// Empty maps turn into empty slices
case dataValKind == reflect.Map:
if dataVal.Len() == 0 {
val.Set(reflect.MakeSlice(sliceType, 0, 0))
return nil
}
// Create slice of maps of other sizes
return d.decodeSlice(name, []interface{}{data}, val)
case dataValKind == reflect.String && valElemType.Kind() == reflect.Uint8:
return d.decodeSlice(name, []byte(dataVal.String()), val)
// All other types we try to convert to the slice type
// and "lift" it into it. i.e. a string becomes a string slice.
default:
// Just re-try this function with data as a slice.
return d.decodeSlice(name, []interface{}{data}, val)
}
}
// Check input type // Check input type
if dataValKind != reflect.Array && dataValKind != reflect.Slice { if dataValKind != reflect.Array && dataValKind != reflect.Slice {
if d.config.WeaklyTypedInput {
switch {
// Empty maps turn into empty slices
case dataValKind == reflect.Map:
if dataVal.Len() == 0 {
val.Set(reflect.MakeSlice(sliceType, 0, 0))
return nil
}
// Create slice of maps of other sizes
return d.decodeSlice(name, []interface{}{data}, val)
case dataValKind == reflect.String && valElemType.Kind() == reflect.Uint8:
return d.decodeSlice(name, []byte(dataVal.String()), val)
// All other types we try to convert to the slice type
// and "lift" it into it. i.e. a string becomes a string slice.
default:
// Just re-try this function with data as a slice.
return d.decodeSlice(name, []interface{}{data}, val)
}
}
return fmt.Errorf( return fmt.Errorf(
"'%s': source data must be an array or slice, got %s", name, dataValKind) "'%s': source data must be an array or slice, got %s", name, dataValKind)
} }
// If the input value is empty, then don't allocate since non-nil != nil
if dataVal.Len() == 0 {
return nil
}
// Make a new slice to hold our result, same size as the original data. // Make a new slice to hold our result, same size as the original data.
valSlice = reflect.MakeSlice(sliceType, dataVal.Len(), dataVal.Len()) valSlice = reflect.MakeSlice(sliceType, dataVal.Len(), dataVal.Len())
} }
@ -888,10 +954,29 @@ func (d *Decoder) decodeStruct(name string, data interface{}, val reflect.Value)
} }
dataValKind := dataVal.Kind() dataValKind := dataVal.Kind()
if dataValKind != reflect.Map { switch dataValKind {
return fmt.Errorf("'%s' expected a map, got '%s'", name, dataValKind) case reflect.Map:
} return d.decodeStructFromMap(name, dataVal, val)
case reflect.Struct:
// Not the most efficient way to do this but we can optimize later if
// we want to. To convert from struct to struct we go to map first
// as an intermediary.
m := make(map[string]interface{})
mval := reflect.Indirect(reflect.ValueOf(&m))
if err := d.decodeMapFromStruct(name, dataVal, mval, mval); err != nil {
return err
}
result := d.decodeStructFromMap(name, mval, val)
return result
default:
return fmt.Errorf("'%s' expected a map, got '%s'", name, dataVal.Kind())
}
}
func (d *Decoder) decodeStructFromMap(name string, dataVal, val reflect.Value) error {
dataValType := dataVal.Type() dataValType := dataVal.Type()
if kind := dataValType.Key().Kind(); kind != reflect.String && kind != reflect.Interface { if kind := dataValType.Key().Kind(); kind != reflect.String && kind != reflect.Interface {
return fmt.Errorf( return fmt.Errorf(

1
vendor/github.com/spf13/afero/go.mod generated vendored Normal file
View File

@ -0,0 +1 @@
module github.com/spf13/afero

1
vendor/github.com/spf13/jwalterweatherman/go.mod generated vendored Normal file
View File

@ -0,0 +1 @@
module github.com/spf13/jwalterweatherman

View File

@ -925,13 +925,16 @@ func stripUnknownFlagValue(args []string) []string {
} }
first := args[0] first := args[0]
if first[0] == '-' { if len(first) > 0 && first[0] == '-' {
//--unknown --next-flag ... //--unknown --next-flag ...
return args return args
} }
//--unknown arg ... (args will be arg ...) //--unknown arg ... (args will be arg ...)
return args[1:] if len(args) > 1 {
return args[1:]
}
return nil
} }
func (f *FlagSet) parseLongArg(s string, args []string, fn parseFunc) (a []string, err error) { func (f *FlagSet) parseLongArg(s string, args []string, fn parseFunc) (a []string, err error) {

149
vendor/github.com/spf13/pflag/string_to_int.go generated vendored Normal file
View File

@ -0,0 +1,149 @@
package pflag
import (
"bytes"
"fmt"
"strconv"
"strings"
)
// -- stringToInt Value
type stringToIntValue struct {
value *map[string]int
changed bool
}
func newStringToIntValue(val map[string]int, p *map[string]int) *stringToIntValue {
ssv := new(stringToIntValue)
ssv.value = p
*ssv.value = val
return ssv
}
// Format: a=1,b=2
func (s *stringToIntValue) Set(val string) error {
ss := strings.Split(val, ",")
out := make(map[string]int, len(ss))
for _, pair := range ss {
kv := strings.SplitN(pair, "=", 2)
if len(kv) != 2 {
return fmt.Errorf("%s must be formatted as key=value", pair)
}
var err error
out[kv[0]], err = strconv.Atoi(kv[1])
if err != nil {
return err
}
}
if !s.changed {
*s.value = out
} else {
for k, v := range out {
(*s.value)[k] = v
}
}
s.changed = true
return nil
}
func (s *stringToIntValue) Type() string {
return "stringToInt"
}
func (s *stringToIntValue) String() string {
var buf bytes.Buffer
i := 0
for k, v := range *s.value {
if i > 0 {
buf.WriteRune(',')
}
buf.WriteString(k)
buf.WriteRune('=')
buf.WriteString(strconv.Itoa(v))
i++
}
return "[" + buf.String() + "]"
}
func stringToIntConv(val string) (interface{}, error) {
val = strings.Trim(val, "[]")
// An empty string would cause an empty map
if len(val) == 0 {
return map[string]int{}, nil
}
ss := strings.Split(val, ",")
out := make(map[string]int, len(ss))
for _, pair := range ss {
kv := strings.SplitN(pair, "=", 2)
if len(kv) != 2 {
return nil, fmt.Errorf("%s must be formatted as key=value", pair)
}
var err error
out[kv[0]], err = strconv.Atoi(kv[1])
if err != nil {
return nil, err
}
}
return out, nil
}
// GetStringToInt return the map[string]int value of a flag with the given name
func (f *FlagSet) GetStringToInt(name string) (map[string]int, error) {
val, err := f.getFlagType(name, "stringToInt", stringToIntConv)
if err != nil {
return map[string]int{}, err
}
return val.(map[string]int), nil
}
// StringToIntVar defines a string flag with specified name, default value, and usage string.
// The argument p points to a map[string]int variable in which to store the values of the multiple flags.
// The value of each argument will not try to be separated by comma
func (f *FlagSet) StringToIntVar(p *map[string]int, name string, value map[string]int, usage string) {
f.VarP(newStringToIntValue(value, p), name, "", usage)
}
// StringToIntVarP is like StringToIntVar, but accepts a shorthand letter that can be used after a single dash.
func (f *FlagSet) StringToIntVarP(p *map[string]int, name, shorthand string, value map[string]int, usage string) {
f.VarP(newStringToIntValue(value, p), name, shorthand, usage)
}
// StringToIntVar defines a string flag with specified name, default value, and usage string.
// The argument p points to a map[string]int variable in which to store the value of the flag.
// The value of each argument will not try to be separated by comma
func StringToIntVar(p *map[string]int, name string, value map[string]int, usage string) {
CommandLine.VarP(newStringToIntValue(value, p), name, "", usage)
}
// StringToIntVarP is like StringToIntVar, but accepts a shorthand letter that can be used after a single dash.
func StringToIntVarP(p *map[string]int, name, shorthand string, value map[string]int, usage string) {
CommandLine.VarP(newStringToIntValue(value, p), name, shorthand, usage)
}
// StringToInt defines a string flag with specified name, default value, and usage string.
// The return value is the address of a map[string]int variable that stores the value of the flag.
// The value of each argument will not try to be separated by comma
func (f *FlagSet) StringToInt(name string, value map[string]int, usage string) *map[string]int {
p := map[string]int{}
f.StringToIntVarP(&p, name, "", value, usage)
return &p
}
// StringToIntP is like StringToInt, but accepts a shorthand letter that can be used after a single dash.
func (f *FlagSet) StringToIntP(name, shorthand string, value map[string]int, usage string) *map[string]int {
p := map[string]int{}
f.StringToIntVarP(&p, name, shorthand, value, usage)
return &p
}
// StringToInt defines a string flag with specified name, default value, and usage string.
// The return value is the address of a map[string]int variable that stores the value of the flag.
// The value of each argument will not try to be separated by comma
func StringToInt(name string, value map[string]int, usage string) *map[string]int {
return CommandLine.StringToIntP(name, "", value, usage)
}
// StringToIntP is like StringToInt, but accepts a shorthand letter that can be used after a single dash.
func StringToIntP(name, shorthand string, value map[string]int, usage string) *map[string]int {
return CommandLine.StringToIntP(name, shorthand, value, usage)
}

160
vendor/github.com/spf13/pflag/string_to_string.go generated vendored Normal file
View File

@ -0,0 +1,160 @@
package pflag
import (
"bytes"
"encoding/csv"
"fmt"
"strings"
)
// -- stringToString Value
type stringToStringValue struct {
value *map[string]string
changed bool
}
func newStringToStringValue(val map[string]string, p *map[string]string) *stringToStringValue {
ssv := new(stringToStringValue)
ssv.value = p
*ssv.value = val
return ssv
}
// Format: a=1,b=2
func (s *stringToStringValue) Set(val string) error {
var ss []string
n := strings.Count(val, "=")
switch n {
case 0:
return fmt.Errorf("%s must be formatted as key=value", val)
case 1:
ss = append(ss, strings.Trim(val, `"`))
default:
r := csv.NewReader(strings.NewReader(val))
var err error
ss, err = r.Read()
if err != nil {
return err
}
}
out := make(map[string]string, len(ss))
for _, pair := range ss {
kv := strings.SplitN(pair, "=", 2)
if len(kv) != 2 {
return fmt.Errorf("%s must be formatted as key=value", pair)
}
out[kv[0]] = kv[1]
}
if !s.changed {
*s.value = out
} else {
for k, v := range out {
(*s.value)[k] = v
}
}
s.changed = true
return nil
}
func (s *stringToStringValue) Type() string {
return "stringToString"
}
func (s *stringToStringValue) String() string {
records := make([]string, 0, len(*s.value)>>1)
for k, v := range *s.value {
records = append(records, k+"="+v)
}
var buf bytes.Buffer
w := csv.NewWriter(&buf)
if err := w.Write(records); err != nil {
panic(err)
}
w.Flush()
return "[" + strings.TrimSpace(buf.String()) + "]"
}
func stringToStringConv(val string) (interface{}, error) {
val = strings.Trim(val, "[]")
// An empty string would cause an empty map
if len(val) == 0 {
return map[string]string{}, nil
}
r := csv.NewReader(strings.NewReader(val))
ss, err := r.Read()
if err != nil {
return nil, err
}
out := make(map[string]string, len(ss))
for _, pair := range ss {
kv := strings.SplitN(pair, "=", 2)
if len(kv) != 2 {
return nil, fmt.Errorf("%s must be formatted as key=value", pair)
}
out[kv[0]] = kv[1]
}
return out, nil
}
// GetStringToString return the map[string]string value of a flag with the given name
func (f *FlagSet) GetStringToString(name string) (map[string]string, error) {
val, err := f.getFlagType(name, "stringToString", stringToStringConv)
if err != nil {
return map[string]string{}, err
}
return val.(map[string]string), nil
}
// StringToStringVar defines a string flag with specified name, default value, and usage string.
// The argument p points to a map[string]string variable in which to store the values of the multiple flags.
// The value of each argument will not try to be separated by comma
func (f *FlagSet) StringToStringVar(p *map[string]string, name string, value map[string]string, usage string) {
f.VarP(newStringToStringValue(value, p), name, "", usage)
}
// StringToStringVarP is like StringToStringVar, but accepts a shorthand letter that can be used after a single dash.
func (f *FlagSet) StringToStringVarP(p *map[string]string, name, shorthand string, value map[string]string, usage string) {
f.VarP(newStringToStringValue(value, p), name, shorthand, usage)
}
// StringToStringVar defines a string flag with specified name, default value, and usage string.
// The argument p points to a map[string]string variable in which to store the value of the flag.
// The value of each argument will not try to be separated by comma
func StringToStringVar(p *map[string]string, name string, value map[string]string, usage string) {
CommandLine.VarP(newStringToStringValue(value, p), name, "", usage)
}
// StringToStringVarP is like StringToStringVar, but accepts a shorthand letter that can be used after a single dash.
func StringToStringVarP(p *map[string]string, name, shorthand string, value map[string]string, usage string) {
CommandLine.VarP(newStringToStringValue(value, p), name, shorthand, usage)
}
// StringToString defines a string flag with specified name, default value, and usage string.
// The return value is the address of a map[string]string variable that stores the value of the flag.
// The value of each argument will not try to be separated by comma
func (f *FlagSet) StringToString(name string, value map[string]string, usage string) *map[string]string {
p := map[string]string{}
f.StringToStringVarP(&p, name, "", value, usage)
return &p
}
// StringToStringP is like StringToString, but accepts a shorthand letter that can be used after a single dash.
func (f *FlagSet) StringToStringP(name, shorthand string, value map[string]string, usage string) *map[string]string {
p := map[string]string{}
f.StringToStringVarP(&p, name, shorthand, value, usage)
return &p
}
// StringToString defines a string flag with specified name, default value, and usage string.
// The return value is the address of a map[string]string variable that stores the value of the flag.
// The value of each argument will not try to be separated by comma
func StringToString(name string, value map[string]string, usage string) *map[string]string {
return CommandLine.StringToStringP(name, "", value, usage)
}
// StringToStringP is like StringToString, but accepts a shorthand letter that can be used after a single dash.
func StringToStringP(name, shorthand string, value map[string]string, usage string) *map[string]string {
return CommandLine.StringToStringP(name, shorthand, value, usage)
}

View File

@ -2,8 +2,8 @@ go_import_path: github.com/spf13/viper
language: go language: go
go: go:
- 1.9.x
- 1.10.x - 1.10.x
- 1.11.x
- tip - tip
os: os:

View File

@ -373,12 +373,33 @@ how to use Consul.
### Remote Key/Value Store Example - Unencrypted ### Remote Key/Value Store Example - Unencrypted
#### etcd
```go ```go
viper.AddRemoteProvider("etcd", "http://127.0.0.1:4001","/config/hugo.json") viper.AddRemoteProvider("etcd", "http://127.0.0.1:4001","/config/hugo.json")
viper.SetConfigType("json") // because there is no file extension in a stream of bytes, supported extensions are "json", "toml", "yaml", "yml", "properties", "props", "prop" viper.SetConfigType("json") // because there is no file extension in a stream of bytes, supported extensions are "json", "toml", "yaml", "yml", "properties", "props", "prop"
err := viper.ReadRemoteConfig() err := viper.ReadRemoteConfig()
``` ```
#### Consul
You need to set a key to Consul key/value storage with JSON value containing your desired config.
For example, create a Consul key/value store key `MY_CONSUL_KEY` with value:
```json
{
"port": 8080,
"hostname": "myhostname.com"
}
```
```go
viper.AddRemoteProvider("consul", "localhost:8500", "MY_CONSUL_KEY")
viper.SetConfigType("json") // Need to explicitly set this to json
err := viper.ReadRemoteConfig()
fmt.Println(viper.Get("port")) // 8080
fmt.Println(viper.Get("hostname")) // myhostname.com
```
### Remote Key/Value Store Example - Encrypted ### Remote Key/Value Store Example - Encrypted
```go ```go

16
vendor/github.com/spf13/viper/go.mod generated vendored Normal file
View File

@ -0,0 +1,16 @@
module github.com/spf13/viper
require (
github.com/fsnotify/fsnotify v1.4.7
github.com/hashicorp/hcl v1.0.0
github.com/magiconair/properties v1.8.0
github.com/mitchellh/mapstructure v1.0.0
github.com/pelletier/go-toml v1.2.0
github.com/spf13/afero v1.1.2
github.com/spf13/cast v1.2.0
github.com/spf13/jwalterweatherman v1.0.0
github.com/spf13/pflag v1.0.2
golang.org/x/sys v0.0.0-20180906133057-8cf3aee42992 // indirect
golang.org/x/text v0.3.0 // indirect
gopkg.in/yaml.v2 v2.2.1
)

26
vendor/github.com/spf13/viper/go.sum generated vendored Normal file
View File

@ -0,0 +1,26 @@
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/magiconair/properties v1.8.0 h1:LLgXmsheXeRoUOBOjtwPQCWIYqM/LU1ayDtDePerRcY=
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/mitchellh/mapstructure v1.0.0 h1:vVpGvMXJPqSDh2VYHF7gsfQj8Ncx+Xw5Y1KHeTRY+7I=
github.com/mitchellh/mapstructure v1.0.0/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc=
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI=
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
github.com/spf13/cast v1.2.0 h1:HHl1DSRbEQN2i8tJmtS6ViPyHx35+p51amrdsiTCrkg=
github.com/spf13/cast v1.2.0/go.mod h1:r2rcYCSwa1IExKTDiTfzaxqT2FNHs8hODu4LnUfgKEg=
github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk=
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
github.com/spf13/pflag v1.0.2 h1:Fy0orTDgHdbnzHcsOgfCN4LtHf0ec3wwtiwJqwvf3Gc=
github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
golang.org/x/sys v0.0.0-20180906133057-8cf3aee42992 h1:BH3eQWeGbwRU2+wxxuuPOdFBmaiBH81O8BugSjHeTFg=
golang.org/x/sys v0.0.0-20180906133057-8cf3aee42992/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=

View File

@ -306,7 +306,9 @@ func (v *Viper) WatchConfig() {
if err != nil { if err != nil {
log.Println("error:", err) log.Println("error:", err)
} }
v.onConfigChange(event) if v.onConfigChange != nil {
v.onConfigChange(event)
}
} }
} }
case err := <-watcher.Errors: case err := <-watcher.Errors:
@ -648,8 +650,10 @@ func (v *Viper) Get(key string) interface{} {
return cast.ToBool(val) return cast.ToBool(val)
case string: case string:
return cast.ToString(val) return cast.ToString(val)
case int64, int32, int16, int8, int: case int32, int16, int8, int:
return cast.ToInt(val) return cast.ToInt(val)
case int64:
return cast.ToInt64(val)
case float64, float32: case float64, float32:
return cast.ToFloat64(val) return cast.ToFloat64(val)
case time.Time: case time.Time:
@ -1139,7 +1143,7 @@ func (v *Viper) SetDefault(key string, value interface{}) {
deepestMap[lastKey] = value deepestMap[lastKey] = value
} }
// Set sets the value for the key in the override regiser. // Set sets the value for the key in the override register.
// Set is case-insensitive for a key. // Set is case-insensitive for a key.
// Will be used instead of values obtained via // Will be used instead of values obtained via
// flags, config file, ENV, default, or key/value store. // flags, config file, ENV, default, or key/value store.

View File

@ -97,8 +97,16 @@ func isSpecialElement(element *Node) bool {
switch element.Namespace { switch element.Namespace {
case "", "html": case "", "html":
return isSpecialElementMap[element.Data] return isSpecialElementMap[element.Data]
case "math":
switch element.Data {
case "mi", "mo", "mn", "ms", "mtext", "annotation-xml":
return true
}
case "svg": case "svg":
return element.Data == "foreignObject" switch element.Data {
case "foreignObject", "desc", "title":
return true
}
} }
return false return false
} }

View File

@ -470,6 +470,10 @@ func (p *parser) resetInsertionMode() {
case a.Table: case a.Table:
p.im = inTableIM p.im = inTableIM
case a.Template: case a.Template:
// TODO: remove this divergence from the HTML5 spec.
if n.Namespace != "" {
continue
}
p.im = p.templateStack.top() p.im = p.templateStack.top()
case a.Head: case a.Head:
// TODO: remove this divergence from the HTML5 spec. // TODO: remove this divergence from the HTML5 spec.
@ -984,6 +988,14 @@ func inBodyIM(p *parser) bool {
p.acknowledgeSelfClosingTag() p.acknowledgeSelfClosingTag()
p.popUntil(buttonScope, a.P) p.popUntil(buttonScope, a.P)
p.parseImpliedToken(StartTagToken, a.Form, a.Form.String()) p.parseImpliedToken(StartTagToken, a.Form, a.Form.String())
if p.form == nil {
// NOTE: The 'isindex' element has been removed,
// and the 'template' element has not been designed to be
// collaborative with the index element.
//
// Ignore the token.
return true
}
if action != "" { if action != "" {
p.form.Attr = []Attribute{{Key: "action", Val: action}} p.form.Attr = []Attribute{{Key: "action", Val: action}}
} }
@ -1252,12 +1264,6 @@ func (p *parser) inBodyEndTagFormatting(tagAtom a.Atom) {
switch commonAncestor.DataAtom { switch commonAncestor.DataAtom {
case a.Table, a.Tbody, a.Tfoot, a.Thead, a.Tr: case a.Table, a.Tbody, a.Tfoot, a.Thead, a.Tr:
p.fosterParent(lastNode) p.fosterParent(lastNode)
case a.Template:
// TODO: remove namespace checking
if commonAncestor.Namespace == "html" {
commonAncestor = commonAncestor.LastChild
}
fallthrough
default: default:
commonAncestor.AppendChild(lastNode) commonAncestor.AppendChild(lastNode)
} }
@ -2209,6 +2215,15 @@ func (p *parser) parse() error {
} }
// Parse returns the parse tree for the HTML from the given Reader. // Parse returns the parse tree for the HTML from the given Reader.
//
// It implements the HTML5 parsing algorithm
// (https://html.spec.whatwg.org/multipage/syntax.html#tree-construction),
// which is very complicated. The resultant tree can contain implicitly created
// nodes that have no explicit <tag> listed in r's data, and nodes' parents can
// differ from the nesting implied by a naive processing of start and end
// <tag>s. Conversely, explicit <tag>s in r's data can be silently dropped,
// with no corresponding node in the resulting tree.
//
// The input is assumed to be UTF-8 encoded. // The input is assumed to be UTF-8 encoded.
func Parse(r io.Reader) (*Node, error) { func Parse(r io.Reader) (*Node, error) {
p := &parser{ p := &parser{
@ -2230,6 +2245,8 @@ func Parse(r io.Reader) (*Node, error) {
// ParseFragment parses a fragment of HTML and returns the nodes that were // ParseFragment parses a fragment of HTML and returns the nodes that were
// found. If the fragment is the InnerHTML for an existing element, pass that // found. If the fragment is the InnerHTML for an existing element, pass that
// element in context. // element in context.
//
// It has the same intricacies as Parse.
func ParseFragment(r io.Reader, context *Node) ([]*Node, error) { func ParseFragment(r io.Reader, context *Node) ([]*Node, error) {
contextTag := "" contextTag := ""
if context != nil { if context != nil {

View File

@ -6,17 +6,7 @@
// +build ppc // +build ppc
// Functions to access/create device major and minor numbers matching the // Functions to access/create device major and minor numbers matching the
// encoding used by the Linux kernel and glibc. // encoding used by AIX.
//
// The information below is extracted and adapted from bits/sysmacros.h in the
// glibc sources:
//
// dev_t in glibc is 64-bit, with 32-bit major and minor numbers. glibc's
// default encoding is MMMM Mmmm mmmM MMmm, where M is a hex digit of the major
// number and m is a hex digit of the minor number. This is backward compatible
// with legacy systems where dev_t is 16 bits wide, encoded as MMmm. It is also
// backward compatible with the Linux kernel, which for some architectures uses
// 32-bit dev_t, encoded as mmmM MMmm.
package unix package unix

View File

@ -6,17 +6,7 @@
// +build ppc64 // +build ppc64
// Functions to access/create device major and minor numbers matching the // Functions to access/create device major and minor numbers matching the
// encoding used by the Linux kernel and glibc. // encoding used AIX.
//
// The information below is extracted and adapted from bits/sysmacros.h in the
// glibc sources:
//
// dev_t in glibc is 64-bit, with 32-bit major and minor numbers. glibc's
// default encoding is MMMM Mmmm mmmM MMmm, where M is a hex digit of the major
// number and m is a hex digit of the minor number. This is backward compatible
// with legacy systems where dev_t is 16 bits wide, encoded as MMmm. It is also
// backward compatible with the Linux kernel, which for some architectures uses
// 32-bit dev_t, encoded as mmmM MMmm.
package unix package unix

View File

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

View File

@ -46,6 +46,7 @@ includes_AIX='
#include <sys/stropts.h> #include <sys/stropts.h>
#include <sys/mman.h> #include <sys/mman.h>
#include <sys/poll.h> #include <sys/poll.h>
#include <sys/termio.h>
#include <termios.h> #include <termios.h>
#include <fcntl.h> #include <fcntl.h>
@ -86,6 +87,7 @@ includes_DragonFly='
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/sysctl.h> #include <sys/sysctl.h>
#include <sys/mman.h> #include <sys/mman.h>
#include <sys/mount.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <net/bpf.h> #include <net/bpf.h>
@ -191,8 +193,10 @@ struct ltchars {
#include <linux/falloc.h> #include <linux/falloc.h>
#include <linux/filter.h> #include <linux/filter.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/kexec.h>
#include <linux/keyctl.h> #include <linux/keyctl.h>
#include <linux/magic.h> #include <linux/magic.h>
#include <linux/memfd.h>
#include <linux/netfilter/nfnetlink.h> #include <linux/netfilter/nfnetlink.h>
#include <linux/netlink.h> #include <linux/netlink.h>
#include <linux/net_namespace.h> #include <linux/net_namespace.h>
@ -214,6 +218,7 @@ struct ltchars {
#include <linux/watchdog.h> #include <linux/watchdog.h>
#include <linux/hdreg.h> #include <linux/hdreg.h>
#include <linux/rtc.h> #include <linux/rtc.h>
#include <linux/if_xdp.h>
#include <mtd/ubi-user.h> #include <mtd/ubi-user.h>
#include <net/route.h> #include <net/route.h>
#include <asm/termbits.h> #include <asm/termbits.h>
@ -244,6 +249,16 @@ struct ltchars {
#define FS_KEY_DESC_PREFIX "fscrypt:" #define FS_KEY_DESC_PREFIX "fscrypt:"
#define FS_KEY_DESC_PREFIX_SIZE 8 #define FS_KEY_DESC_PREFIX_SIZE 8
#define FS_MAX_KEY_SIZE 64 #define FS_MAX_KEY_SIZE 64
// XDP socket constants do not appear to be picked up otherwise.
// Copied from samples/bpf/xdpsock_user.c.
#ifndef SOL_XDP
#define SOL_XDP 283
#endif
#ifndef AF_XDP
#define AF_XDP 44
#endif
' '
includes_NetBSD=' includes_NetBSD='
@ -252,6 +267,7 @@ includes_NetBSD='
#include <sys/event.h> #include <sys/event.h>
#include <sys/extattr.h> #include <sys/extattr.h>
#include <sys/mman.h> #include <sys/mman.h>
#include <sys/mount.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/sockio.h> #include <sys/sockio.h>
#include <sys/sysctl.h> #include <sys/sysctl.h>
@ -277,6 +293,7 @@ includes_OpenBSD='
#include <sys/param.h> #include <sys/param.h>
#include <sys/event.h> #include <sys/event.h>
#include <sys/mman.h> #include <sys/mman.h>
#include <sys/mount.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/sockio.h> #include <sys/sockio.h>
#include <sys/stat.h> #include <sys/stat.h>
@ -378,6 +395,7 @@ ccflags="$@"
$2 ~ /^EXTATTR_NAMESPACE_NAMES/ || $2 ~ /^EXTATTR_NAMESPACE_NAMES/ ||
$2 ~ /^EXTATTR_NAMESPACE_[A-Z]+_STRING/ {next} $2 ~ /^EXTATTR_NAMESPACE_[A-Z]+_STRING/ {next}
$2 !~ /^ECCAPBITS/ &&
$2 !~ /^ETH_/ && $2 !~ /^ETH_/ &&
$2 !~ /^EPROC_/ && $2 !~ /^EPROC_/ &&
$2 !~ /^EQUIV_/ && $2 !~ /^EQUIV_/ &&
@ -413,7 +431,7 @@ ccflags="$@"
$2 ~ /^TC[IO](ON|OFF)$/ || $2 ~ /^TC[IO](ON|OFF)$/ ||
$2 ~ /^IN_/ || $2 ~ /^IN_/ ||
$2 ~ /^LOCK_(SH|EX|NB|UN)$/ || $2 ~ /^LOCK_(SH|EX|NB|UN)$/ ||
$2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|ICMP6|TCP|EVFILT|NOTE|EV|SHUT|PROT|MAP|T?PACKET|MSG|SCM|MCL|DT|MADV|PR)_/ || $2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|ICMP6|TCP|EVFILT|NOTE|EV|SHUT|PROT|MAP|MFD|T?PACKET|MSG|SCM|MCL|DT|MADV|PR)_/ ||
$2 ~ /^TP_STATUS_/ || $2 ~ /^TP_STATUS_/ ||
$2 ~ /^FALLOC_/ || $2 ~ /^FALLOC_/ ||
$2 == "ICMPV6_FILTER" || $2 == "ICMPV6_FILTER" ||
@ -424,9 +442,11 @@ ccflags="$@"
$2 ~ /^KERN_(HOSTNAME|OS(RELEASE|TYPE)|VERSION)$/ || $2 ~ /^KERN_(HOSTNAME|OS(RELEASE|TYPE)|VERSION)$/ ||
$2 ~ /^HW_MACHINE$/ || $2 ~ /^HW_MACHINE$/ ||
$2 ~ /^SYSCTL_VERS/ || $2 ~ /^SYSCTL_VERS/ ||
$2 !~ "MNT_BITS" &&
$2 ~ /^(MS|MNT|UMOUNT)_/ || $2 ~ /^(MS|MNT|UMOUNT)_/ ||
$2 ~ /^TUN(SET|GET|ATTACH|DETACH)/ || $2 ~ /^TUN(SET|GET|ATTACH|DETACH)/ ||
$2 ~ /^(O|F|E?FD|NAME|S|PTRACE|PT)_/ || $2 ~ /^(O|F|E?FD|NAME|S|PTRACE|PT)_/ ||
$2 ~ /^KEXEC_/ ||
$2 ~ /^LINUX_REBOOT_CMD_/ || $2 ~ /^LINUX_REBOOT_CMD_/ ||
$2 ~ /^LINUX_REBOOT_MAGIC[12]$/ || $2 ~ /^LINUX_REBOOT_MAGIC[12]$/ ||
$2 !~ "NLA_TYPE_MASK" && $2 !~ "NLA_TYPE_MASK" &&
@ -456,6 +476,7 @@ ccflags="$@"
$2 ~ /^PERF_EVENT_IOC_/ || $2 ~ /^PERF_EVENT_IOC_/ ||
$2 ~ /^SECCOMP_MODE_/ || $2 ~ /^SECCOMP_MODE_/ ||
$2 ~ /^SPLICE_/ || $2 ~ /^SPLICE_/ ||
$2 ~ /^SYNC_FILE_RANGE_/ ||
$2 !~ /^AUDIT_RECORD_MAGIC/ && $2 !~ /^AUDIT_RECORD_MAGIC/ &&
$2 !~ /IOC_MAGIC/ && $2 !~ /IOC_MAGIC/ &&
$2 ~ /^[A-Z][A-Z0-9_]+_MAGIC2?$/ || $2 ~ /^[A-Z][A-Z0-9_]+_MAGIC2?$/ ||
@ -473,6 +494,7 @@ ccflags="$@"
$2 ~ /^FSOPT_/ || $2 ~ /^FSOPT_/ ||
$2 ~ /^WDIOC_/ || $2 ~ /^WDIOC_/ ||
$2 ~ /^NFN/ || $2 ~ /^NFN/ ||
$2 ~ /^XDP_/ ||
$2 ~ /^(HDIO|WIN|SMART)_/ || $2 ~ /^(HDIO|WIN|SMART)_/ ||
$2 !~ "WMESGLEN" && $2 !~ "WMESGLEN" &&
$2 ~ /^W[A-Z0-9]+$/ || $2 ~ /^W[A-Z0-9]+$/ ||

View File

@ -32,6 +32,7 @@ my @headers = qw (
sys/sem.h sys/sem.h
sys/shm.h sys/shm.h
sys/vmmeter.h sys/vmmeter.h
uvm/uvmexp.h
uvm/uvm_param.h uvm/uvm_param.h
uvm/uvm_swap_encrypt.h uvm/uvm_swap_encrypt.h
ddb/db_var.h ddb/db_var.h

View File

@ -12,7 +12,7 @@ import "unsafe"
// Round the length of a raw sockaddr up to align it properly. // Round the length of a raw sockaddr up to align it properly.
func cmsgAlignOf(salen int) int { func cmsgAlignOf(salen int) int {
salign := sizeofPtr salign := SizeofPtr
// NOTE: It seems like 64-bit Darwin, DragonFly BSD and // NOTE: It seems like 64-bit Darwin, DragonFly BSD and
// Solaris kernels still require 32-bit aligned access to // Solaris kernels still require 32-bit aligned access to
// network subsystem. // network subsystem.

View File

@ -345,11 +345,11 @@ func IoctlSetInt(fd int, req uint, value int) error {
return ioctl(fd, req, uintptr(value)) return ioctl(fd, req, uintptr(value))
} }
func IoctlSetWinsize(fd int, req uint, value *Winsize) error { func ioctlSetWinsize(fd int, req uint, value *Winsize) error {
return ioctl(fd, req, uintptr(unsafe.Pointer(value))) return ioctl(fd, req, uintptr(unsafe.Pointer(value)))
} }
func IoctlSetTermios(fd int, req uint, value *Termios) error { func ioctlSetTermios(fd int, req uint, value *Termios) error {
return ioctl(fd, req, uintptr(unsafe.Pointer(value))) return ioctl(fd, req, uintptr(unsafe.Pointer(value)))
} }
@ -419,8 +419,10 @@ func Flock(fd int, how int) (err error) {
//sysnb Getsid(pid int) (sid int, err error) //sysnb Getsid(pid int) (sid int, err error)
//sysnb Kill(pid int, sig syscall.Signal) (err error) //sysnb Kill(pid int, sig syscall.Signal) (err error)
//sys Klogctl(typ int, buf []byte) (n int, err error) = syslog //sys Klogctl(typ int, buf []byte) (n int, err error) = syslog
//sys Mkdir(dirfd int, path string, mode uint32) (err error)
//sys Mkdirat(dirfd int, path string, mode uint32) (err error) //sys Mkdirat(dirfd int, path string, mode uint32) (err error)
//sys Mkfifo(path string, mode uint32) (err error) //sys Mkfifo(path string, mode uint32) (err error)
//sys Mknod(path string, mode uint32, dev int) (err error)
//sys Mknodat(dirfd int, path string, mode uint32, dev int) (err error) //sys Mknodat(dirfd int, path string, mode uint32, dev int) (err error)
//sys Nanosleep(time *Timespec, leftover *Timespec) (err error) //sys Nanosleep(time *Timespec, leftover *Timespec) (err error)
//sys Open(path string, mode int, perm uint32) (fd int, err error) = open64 //sys Open(path string, mode int, perm uint32) (fd int, err error) = open64

View File

@ -692,6 +692,24 @@ func (sa *SockaddrVM) sockaddr() (unsafe.Pointer, _Socklen, error) {
return unsafe.Pointer(&sa.raw), SizeofSockaddrVM, nil return unsafe.Pointer(&sa.raw), SizeofSockaddrVM, nil
} }
type SockaddrXDP struct {
Flags uint16
Ifindex uint32
QueueID uint32
SharedUmemFD uint32
raw RawSockaddrXDP
}
func (sa *SockaddrXDP) sockaddr() (unsafe.Pointer, _Socklen, error) {
sa.raw.Family = AF_XDP
sa.raw.Flags = sa.Flags
sa.raw.Ifindex = sa.Ifindex
sa.raw.Queue_id = sa.QueueID
sa.raw.Shared_umem_fd = sa.SharedUmemFD
return unsafe.Pointer(&sa.raw), SizeofSockaddrXDP, nil
}
func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) { func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
switch rsa.Addr.Family { switch rsa.Addr.Family {
case AF_NETLINK: case AF_NETLINK:
@ -793,6 +811,15 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
} }
return sa, nil return sa, nil
} }
case AF_XDP:
pp := (*RawSockaddrXDP)(unsafe.Pointer(rsa))
sa := &SockaddrXDP{
Flags: pp.Flags,
Ifindex: pp.Ifindex,
QueueID: pp.Queue_id,
SharedUmemFD: pp.Shared_umem_fd,
}
return sa, nil
} }
return nil, EAFNOSUPPORT return nil, EAFNOSUPPORT
} }
@ -1095,7 +1122,7 @@ func ptracePeek(req int, pid int, addr uintptr, out []byte) (count int, err erro
// The ptrace syscall differs from glibc's ptrace. // The ptrace syscall differs from glibc's ptrace.
// Peeks returns the word in *data, not as the return value. // Peeks returns the word in *data, not as the return value.
var buf [sizeofPtr]byte var buf [SizeofPtr]byte
// Leading edge. PEEKTEXT/PEEKDATA don't require aligned // Leading edge. PEEKTEXT/PEEKDATA don't require aligned
// access (PEEKUSER warns that it might), but if we don't // access (PEEKUSER warns that it might), but if we don't
@ -1103,12 +1130,12 @@ func ptracePeek(req int, pid int, addr uintptr, out []byte) (count int, err erro
// boundary and not get the bytes leading up to the page // boundary and not get the bytes leading up to the page
// boundary. // boundary.
n := 0 n := 0
if addr%sizeofPtr != 0 { if addr%SizeofPtr != 0 {
err = ptrace(req, pid, addr-addr%sizeofPtr, uintptr(unsafe.Pointer(&buf[0]))) err = ptrace(req, pid, addr-addr%SizeofPtr, uintptr(unsafe.Pointer(&buf[0])))
if err != nil { if err != nil {
return 0, err return 0, err
} }
n += copy(out, buf[addr%sizeofPtr:]) n += copy(out, buf[addr%SizeofPtr:])
out = out[n:] out = out[n:]
} }
@ -1146,15 +1173,15 @@ func ptracePoke(pokeReq int, peekReq int, pid int, addr uintptr, data []byte) (c
// Leading edge. // Leading edge.
n := 0 n := 0
if addr%sizeofPtr != 0 { if addr%SizeofPtr != 0 {
var buf [sizeofPtr]byte var buf [SizeofPtr]byte
err = ptrace(peekReq, pid, addr-addr%sizeofPtr, uintptr(unsafe.Pointer(&buf[0]))) err = ptrace(peekReq, pid, addr-addr%SizeofPtr, uintptr(unsafe.Pointer(&buf[0])))
if err != nil { if err != nil {
return 0, err return 0, err
} }
n += copy(buf[addr%sizeofPtr:], data) n += copy(buf[addr%SizeofPtr:], data)
word := *((*uintptr)(unsafe.Pointer(&buf[0]))) word := *((*uintptr)(unsafe.Pointer(&buf[0])))
err = ptrace(pokeReq, pid, addr-addr%sizeofPtr, word) err = ptrace(pokeReq, pid, addr-addr%SizeofPtr, word)
if err != nil { if err != nil {
return 0, err return 0, err
} }
@ -1162,19 +1189,19 @@ func ptracePoke(pokeReq int, peekReq int, pid int, addr uintptr, data []byte) (c
} }
// Interior. // Interior.
for len(data) > sizeofPtr { for len(data) > SizeofPtr {
word := *((*uintptr)(unsafe.Pointer(&data[0]))) word := *((*uintptr)(unsafe.Pointer(&data[0])))
err = ptrace(pokeReq, pid, addr+uintptr(n), word) err = ptrace(pokeReq, pid, addr+uintptr(n), word)
if err != nil { if err != nil {
return n, err return n, err
} }
n += sizeofPtr n += SizeofPtr
data = data[sizeofPtr:] data = data[SizeofPtr:]
} }
// Trailing edge. // Trailing edge.
if len(data) > 0 { if len(data) > 0 {
var buf [sizeofPtr]byte var buf [SizeofPtr]byte
err = ptrace(peekReq, pid, addr+uintptr(n), uintptr(unsafe.Pointer(&buf[0]))) err = ptrace(peekReq, pid, addr+uintptr(n), uintptr(unsafe.Pointer(&buf[0])))
if err != nil { if err != nil {
return n, err return n, err
@ -1273,6 +1300,7 @@ func Mount(source string, target string, fstype string, flags uintptr, data stri
//sys Adjtimex(buf *Timex) (state int, err error) //sys Adjtimex(buf *Timex) (state int, err error)
//sys Chdir(path string) (err error) //sys Chdir(path string) (err error)
//sys Chroot(path string) (err error) //sys Chroot(path string) (err error)
//sys ClockGetres(clockid int32, res *Timespec) (err error)
//sys ClockGettime(clockid int32, time *Timespec) (err error) //sys ClockGettime(clockid int32, time *Timespec) (err error)
//sys Close(fd int) (err error) //sys Close(fd int) (err error)
//sys CopyFileRange(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error) //sys CopyFileRange(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error)
@ -1320,6 +1348,7 @@ func Getpgrp() (pid int) {
//sys Llistxattr(path string, dest []byte) (sz int, err error) //sys Llistxattr(path string, dest []byte) (sz int, err error)
//sys Lremovexattr(path string, attr string) (err error) //sys Lremovexattr(path string, attr string) (err error)
//sys Lsetxattr(path string, attr string, data []byte, flags int) (err error) //sys Lsetxattr(path string, attr string, data []byte, flags int) (err error)
//sys MemfdCreate(name string, flags int) (fd int, err error)
//sys Mkdirat(dirfd int, path string, mode uint32) (err error) //sys Mkdirat(dirfd int, path string, mode uint32) (err error)
//sys Mknodat(dirfd int, path string, mode uint32, dev int) (err error) //sys Mknodat(dirfd int, path string, mode uint32, dev int) (err error)
//sys Nanosleep(time *Timespec, leftover *Timespec) (err error) //sys Nanosleep(time *Timespec, leftover *Timespec) (err error)
@ -1495,7 +1524,6 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) {
// Brk // Brk
// Capget // Capget
// Capset // Capset
// ClockGetres
// ClockNanosleep // ClockNanosleep
// ClockSettime // ClockSettime
// Clone // Clone

View File

@ -160,3 +160,16 @@ func Poll(fds []PollFd, timeout int) (n int, err error) {
} }
return poll(&fds[0], len(fds), timeout) return poll(&fds[0], len(fds), timeout)
} }
//sys kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error)
func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error {
cmdlineLen := len(cmdline)
if cmdlineLen > 0 {
// Account for the additional NULL byte added by
// BytePtrFromString in kexecFileLoad. The kexec_file_load
// syscall expects a NULL-terminated string.
cmdlineLen++
}
return kexecFileLoad(kernelFd, initrdFd, cmdlineLen, cmdline, flags)
}

View File

@ -44,7 +44,6 @@ package unix
//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) //sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
//sys Stat(path string, stat *Stat_t) (err error) //sys Stat(path string, stat *Stat_t) (err error)
//sys Statfs(path string, buf *Statfs_t) (err error) //sys Statfs(path string, buf *Statfs_t) (err error)
//sys SyncFileRange(fd int, off int64, n int64, flags int) (err error) = SYS_SYNC_FILE_RANGE2
//sys Truncate(path string, length int64) (err error) //sys Truncate(path string, length int64) (err error)
//sys Ustat(dev int, ubuf *Ustat_t) (err error) //sys Ustat(dev int, ubuf *Ustat_t) (err error)
//sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) //sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error)
@ -129,3 +128,24 @@ func Poll(fds []PollFd, timeout int) (n int, err error) {
} }
return poll(&fds[0], len(fds), timeout) return poll(&fds[0], len(fds), timeout)
} }
//sys syncFileRange2(fd int, flags int, off int64, n int64) (err error) = SYS_SYNC_FILE_RANGE2
func SyncFileRange(fd int, off int64, n int64, flags int) error {
// The sync_file_range and sync_file_range2 syscalls differ only in the
// order of their arguments.
return syncFileRange2(fd, flags, off, n)
}
//sys kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error)
func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error {
cmdlineLen := len(cmdline)
if cmdlineLen > 0 {
// Account for the additional NULL byte added by
// BytePtrFromString in kexecFileLoad. The kexec_file_load
// syscall expects a NULL-terminated string.
cmdlineLen++
}
return kexecFileLoad(kernelFd, initrdFd, cmdlineLen, cmdline, flags)
}

212
vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go generated vendored Normal file
View File

@ -0,0 +1,212 @@
// Copyright 2018 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build riscv64,linux
package unix
import "unsafe"
func EpollCreate(size int) (fd int, err error) {
if size <= 0 {
return -1, EINVAL
}
return EpollCreate1(0)
}
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) = SYS_EPOLL_PWAIT
//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64
//sys Fchown(fd int, uid int, gid int) (err error)
//sys Fstat(fd int, stat *Stat_t) (err error)
//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error)
//sys Fstatfs(fd int, buf *Statfs_t) (err error)
//sys Ftruncate(fd int, length int64) (err error)
//sysnb Getegid() (egid int)
//sysnb Geteuid() (euid int)
//sysnb Getgid() (gid int)
//sysnb Getrlimit(resource int, rlim *Rlimit) (err error)
//sysnb Getuid() (uid int)
//sys Listen(s int, n int) (err error)
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
//sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) {
var ts *Timespec
if timeout != nil {
ts = &Timespec{Sec: timeout.Sec, Nsec: timeout.Usec * 1000}
}
return Pselect(nfd, r, w, e, ts, nil)
}
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
//sys Setfsgid(gid int) (err error)
//sys Setfsuid(uid int) (err error)
//sysnb Setregid(rgid int, egid int) (err error)
//sysnb Setresgid(rgid int, egid int, sgid int) (err error)
//sysnb Setresuid(ruid int, euid int, suid int) (err error)
//sysnb Setrlimit(resource int, rlim *Rlimit) (err error)
//sysnb Setreuid(ruid int, euid int) (err error)
//sys Shutdown(fd int, how int) (err error)
//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
func Stat(path string, stat *Stat_t) (err error) {
return Fstatat(AT_FDCWD, path, stat, 0)
}
func Lchown(path string, uid int, gid int) (err error) {
return Fchownat(AT_FDCWD, path, uid, gid, AT_SYMLINK_NOFOLLOW)
}
func Lstat(path string, stat *Stat_t) (err error) {
return Fstatat(AT_FDCWD, path, stat, AT_SYMLINK_NOFOLLOW)
}
//sys Statfs(path string, buf *Statfs_t) (err error)
//sys SyncFileRange(fd int, off int64, n int64, flags int) (err error)
//sys Truncate(path string, length int64) (err error)
func Ustat(dev int, ubuf *Ustat_t) (err error) {
return ENOSYS
}
//sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error)
//sys accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error)
//sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
//sys connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
//sysnb getgroups(n int, list *_Gid_t) (nn int, err error)
//sysnb setgroups(n int, list *_Gid_t) (err error)
//sys getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error)
//sys setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error)
//sysnb socket(domain int, typ int, proto int) (fd int, err error)
//sysnb socketpair(domain int, typ int, proto int, fd *[2]int32) (err error)
//sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
//sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error)
//sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error)
//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error)
//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error)
//sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error)
//sysnb Gettimeofday(tv *Timeval) (err error)
func setTimespec(sec, nsec int64) Timespec {
return Timespec{Sec: sec, Nsec: nsec}
}
func setTimeval(sec, usec int64) Timeval {
return Timeval{Sec: sec, Usec: usec}
}
func futimesat(dirfd int, path string, tv *[2]Timeval) (err error) {
if tv == nil {
return utimensat(dirfd, path, nil, 0)
}
ts := []Timespec{
NsecToTimespec(TimevalToNsec(tv[0])),
NsecToTimespec(TimevalToNsec(tv[1])),
}
return utimensat(dirfd, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0)
}
func Time(t *Time_t) (Time_t, error) {
var tv Timeval
err := Gettimeofday(&tv)
if err != nil {
return 0, err
}
if t != nil {
*t = Time_t(tv.Sec)
}
return Time_t(tv.Sec), nil
}
func Utime(path string, buf *Utimbuf) error {
tv := []Timeval{
{Sec: buf.Actime},
{Sec: buf.Modtime},
}
return Utimes(path, tv)
}
func utimes(path string, tv *[2]Timeval) (err error) {
if tv == nil {
return utimensat(AT_FDCWD, path, nil, 0)
}
ts := []Timespec{
NsecToTimespec(TimevalToNsec(tv[0])),
NsecToTimespec(TimevalToNsec(tv[1])),
}
return utimensat(AT_FDCWD, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0)
}
func Pipe(p []int) (err error) {
if len(p) != 2 {
return EINVAL
}
var pp [2]_C_int
err = pipe2(&pp, 0)
p[0] = int(pp[0])
p[1] = int(pp[1])
return
}
//sysnb pipe2(p *[2]_C_int, flags int) (err error)
func Pipe2(p []int, flags int) (err error) {
if len(p) != 2 {
return EINVAL
}
var pp [2]_C_int
err = pipe2(&pp, flags)
p[0] = int(pp[0])
p[1] = int(pp[1])
return
}
func (r *PtraceRegs) PC() uint64 { return r.Pc }
func (r *PtraceRegs) SetPC(pc uint64) { r.Pc = pc }
func (iov *Iovec) SetLen(length int) {
iov.Len = uint64(length)
}
func (msghdr *Msghdr) SetControllen(length int) {
msghdr.Controllen = uint64(length)
}
func (cmsg *Cmsghdr) SetLen(length int) {
cmsg.Len = uint64(length)
}
func InotifyInit() (fd int, err error) {
return InotifyInit1(0)
}
func Dup2(oldfd int, newfd int) (err error) {
return Dup3(oldfd, newfd, 0)
}
func Pause() (err error) {
_, _, e1 := Syscall6(SYS_PPOLL, 0, 0, 0, 0, 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
func Poll(fds []PollFd, timeout int) (n int, err error) {
var ts *Timespec
if timeout >= 0 {
ts = new(Timespec)
*ts = NsecToTimespec(int64(timeout) * 1e6)
}
if len(fds) == 0 {
return ppoll(nil, 0, ts, nil)
}
return ppoll(&fds[0], len(fds), ts, nil)
}

View File

@ -322,3 +322,16 @@ func Poll(fds []PollFd, timeout int) (n int, err error) {
} }
return poll(&fds[0], len(fds), timeout) return poll(&fds[0], len(fds), timeout)
} }
//sys kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error)
func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error {
cmdlineLen := len(cmdline)
if cmdlineLen > 0 {
// Account for the additional NULL byte added by
// BytePtrFromString in kexecFileLoad. The kexec_file_load
// syscall expects a NULL-terminated string.
cmdlineLen++
}
return kexecFileLoad(kernelFd, initrdFd, cmdlineLen, cmdline, flags)
}

View File

@ -93,6 +93,23 @@ func nametomib(name string) (mib []_C_int, err error) {
return mib, nil return mib, nil
} }
func SysctlClockinfo(name string) (*Clockinfo, error) {
mib, err := sysctlmib(name)
if err != nil {
return nil, err
}
n := uintptr(SizeofClockinfo)
var ci Clockinfo
if err := sysctl(mib, (*byte)(unsafe.Pointer(&ci)), &n, nil, 0); err != nil {
return nil, err
}
if n != SizeofClockinfo {
return nil, EIO
}
return &ci, nil
}
//sysnb pipe() (fd1 int, fd2 int, err error) //sysnb pipe() (fd1 int, fd2 int, err error)
func Pipe(p []int) (err error) { func Pipe(p []int) (err error) {
if len(p) != 2 { if len(p) != 2 {

View File

@ -43,6 +43,23 @@ func nametomib(name string) (mib []_C_int, err error) {
return nil, EINVAL return nil, EINVAL
} }
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
}
if n != SizeofUvmexp {
return nil, EIO
}
return &u, nil
}
//sysnb pipe(p *[2]_C_int) (err error) //sysnb pipe(p *[2]_C_int) (err error)
func Pipe(p []int) (err error) { func Pipe(p []int) (err error) {
if len(p) != 2 { if len(p) != 2 {

View File

@ -22,10 +22,10 @@ var (
) )
const ( const (
darwin64Bit = runtime.GOOS == "darwin" && sizeofPtr == 8 darwin64Bit = runtime.GOOS == "darwin" && SizeofPtr == 8
dragonfly64Bit = runtime.GOOS == "dragonfly" && sizeofPtr == 8 dragonfly64Bit = runtime.GOOS == "dragonfly" && SizeofPtr == 8
netbsd32Bit = runtime.GOOS == "netbsd" && sizeofPtr == 4 netbsd32Bit = runtime.GOOS == "netbsd" && SizeofPtr == 4
solaris64Bit = runtime.GOOS == "solaris" && sizeofPtr == 8 solaris64Bit = runtime.GOOS == "solaris" && SizeofPtr == 8
) )
// Do the interface allocations only once for common // Do the interface allocations only once for common

View File

@ -22,6 +22,11 @@ package unix
#include <utime.h> #include <utime.h>
#include <sys/utsname.h> #include <sys/utsname.h>
#include <sys/poll.h> #include <sys/poll.h>
#include <sys/resource.h>
#include <sys/stat.h>
#include <sys/statfs.h>
#include <sys/termio.h>
#include <sys/ioctl.h>
#include <termios.h> #include <termios.h>
@ -33,7 +38,6 @@ package unix
#include <dirent.h> #include <dirent.h>
#include <fcntl.h> #include <fcntl.h>
#include <gcrypt.h>
enum { enum {
sizeofPtr = sizeof(void*), sizeofPtr = sizeof(void*),
@ -55,14 +59,14 @@ struct sockaddr_any {
*/ */
import "C" import "C"
// Machine characteristics; for internal use. // Machine characteristics
const ( const (
sizeofPtr = C.sizeofPtr SizeofPtr = C.sizeofPtr
sizeofShort = C.sizeof_short SizeofShort = C.sizeof_short
sizeofInt = C.sizeof_int SizeofInt = C.sizeof_int
sizeofLong = C.sizeof_long SizeofLong = C.sizeof_long
sizeofLongLong = C.sizeof_longlong SizeofLongLong = C.sizeof_longlong
PathMax = C.PATH_MAX PathMax = C.PATH_MAX
) )
@ -224,6 +228,9 @@ type Flock_t C.struct_flock64
// Statfs // Statfs
type Fsid_t C.struct_fsid_t
type Fsid64_t C.struct_fsid64_t
type Statfs_t C.struct_statfs type Statfs_t C.struct_statfs
const RNDGETENTCNT = 0x80045200 const RNDGETENTCNT = 0x80045200

View File

@ -70,14 +70,14 @@ struct sockaddr_any {
*/ */
import "C" import "C"
// Machine characteristics; for internal use. // Machine characteristics
const ( const (
sizeofPtr = C.sizeofPtr SizeofPtr = C.sizeofPtr
sizeofShort = C.sizeof_short SizeofShort = C.sizeof_short
sizeofInt = C.sizeof_int SizeofInt = C.sizeof_int
sizeofLong = C.sizeof_long SizeofLong = C.sizeof_long
sizeofLongLong = C.sizeof_longlong SizeofLongLong = C.sizeof_longlong
) )
// Basic types // Basic types

View File

@ -65,14 +65,14 @@ struct sockaddr_any {
*/ */
import "C" import "C"
// Machine characteristics; for internal use. // Machine characteristics
const ( const (
sizeofPtr = C.sizeofPtr SizeofPtr = C.sizeofPtr
sizeofShort = C.sizeof_short SizeofShort = C.sizeof_short
sizeofInt = C.sizeof_int SizeofInt = C.sizeof_int
sizeofLong = C.sizeof_long SizeofLong = C.sizeof_long
sizeofLongLong = C.sizeof_longlong SizeofLongLong = C.sizeof_longlong
) )
// Basic types // Basic types

View File

@ -154,14 +154,14 @@ struct if_msghdr8 {
*/ */
import "C" import "C"
// Machine characteristics; for internal use. // Machine characteristics
const ( const (
sizeofPtr = C.sizeofPtr SizeofPtr = C.sizeofPtr
sizeofShort = C.sizeof_short SizeofShort = C.sizeof_short
sizeofInt = C.sizeof_int SizeofInt = C.sizeof_int
sizeofLong = C.sizeof_long SizeofLong = C.sizeof_long
sizeofLongLong = C.sizeof_longlong SizeofLongLong = C.sizeof_longlong
) )
// Basic types // Basic types

View File

@ -67,14 +67,14 @@ struct sockaddr_any {
*/ */
import "C" import "C"
// Machine characteristics; for internal use. // Machine characteristics
const ( const (
sizeofPtr = C.sizeofPtr SizeofPtr = C.sizeofPtr
sizeofShort = C.sizeof_short SizeofShort = C.sizeof_short
sizeofInt = C.sizeof_int SizeofInt = C.sizeof_int
sizeofLong = C.sizeof_long SizeofLong = C.sizeof_long
sizeofLongLong = C.sizeof_longlong SizeofLongLong = C.sizeof_longlong
) )
// Basic types // Basic types
@ -279,3 +279,9 @@ type Sysctlnode C.struct_sysctlnode
// Uname // Uname
type Utsname C.struct_utsname type Utsname C.struct_utsname
// Clockinfo
const SizeofClockinfo = C.sizeof_struct_clockinfo
type Clockinfo C.struct_clockinfo

View File

@ -38,6 +38,7 @@ package unix
#include <sys/un.h> #include <sys/un.h>
#include <sys/utsname.h> #include <sys/utsname.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <uvm/uvmexp.h>
#include <net/bpf.h> #include <net/bpf.h>
#include <net/if.h> #include <net/if.h>
#include <net/if_dl.h> #include <net/if_dl.h>
@ -66,14 +67,14 @@ struct sockaddr_any {
*/ */
import "C" import "C"
// Machine characteristics; for internal use. // Machine characteristics
const ( const (
sizeofPtr = C.sizeofPtr SizeofPtr = C.sizeofPtr
sizeofShort = C.sizeof_short SizeofShort = C.sizeof_short
sizeofInt = C.sizeof_int SizeofInt = C.sizeof_int
sizeofLong = C.sizeof_long SizeofLong = C.sizeof_long
sizeofLongLong = C.sizeof_longlong SizeofLongLong = C.sizeof_longlong
) )
// Basic types // Basic types
@ -263,3 +264,9 @@ const (
// Uname // Uname
type Utsname C.struct_utsname type Utsname C.struct_utsname
// Uvmexp
const SizeofUvmexp = C.sizeof_struct_uvmexp
type Uvmexp C.struct_uvmexp

View File

@ -75,14 +75,14 @@ struct sockaddr_any {
*/ */
import "C" import "C"
// Machine characteristics; for internal use. // Machine characteristics
const ( const (
sizeofPtr = C.sizeofPtr SizeofPtr = C.sizeofPtr
sizeofShort = C.sizeof_short SizeofShort = C.sizeof_short
sizeofInt = C.sizeof_int SizeofInt = C.sizeof_int
sizeofLong = C.sizeof_long SizeofLong = C.sizeof_long
sizeofLongLong = C.sizeof_longlong SizeofLongLong = C.sizeof_longlong
PathMax = C.PATH_MAX PathMax = C.PATH_MAX
MaxHostNameLen = C.MAXHOSTNAMELEN MaxHostNameLen = C.MAXHOSTNAMELEN
) )

View File

@ -867,6 +867,9 @@ const (
TAB2 = 0x800 TAB2 = 0x800
TAB3 = 0xc00 TAB3 = 0xc00
TABDLY = 0xc00 TABDLY = 0xc00
TCFLSH = 0x540c
TCGETA = 0x5405
TCGETS = 0x5401
TCIFLUSH = 0x0 TCIFLUSH = 0x0
TCIOFF = 0x2 TCIOFF = 0x2
TCIOFLUSH = 0x2 TCIOFLUSH = 0x2
@ -915,6 +918,15 @@ const (
TCP_TIMESTAMP_OPTLEN = 0xc TCP_TIMESTAMP_OPTLEN = 0xc
TCP_UNSETPRIV = 0x28 TCP_UNSETPRIV = 0x28
TCSAFLUSH = 0x2 TCSAFLUSH = 0x2
TCSBRK = 0x5409
TCSETA = 0x5406
TCSETAF = 0x5408
TCSETAW = 0x5407
TCSETS = 0x5402
TCSETSF = 0x5404
TCSETSW = 0x5403
TCXONC = 0x540b
TIOC = 0x5400
TIOCCBRK = 0x2000747a TIOCCBRK = 0x2000747a
TIOCCDTR = 0x20007478 TIOCCDTR = 0x20007478
TIOCCONS = 0x80047462 TIOCCONS = 0x80047462

View File

@ -867,6 +867,9 @@ const (
TAB2 = 0x800 TAB2 = 0x800
TAB3 = 0xc00 TAB3 = 0xc00
TABDLY = 0xc00 TABDLY = 0xc00
TCFLSH = 0x540c
TCGETA = 0x5405
TCGETS = 0x5401
TCIFLUSH = 0x0 TCIFLUSH = 0x0
TCIOFF = 0x2 TCIOFF = 0x2
TCIOFLUSH = 0x2 TCIOFLUSH = 0x2
@ -915,6 +918,15 @@ const (
TCP_TIMESTAMP_OPTLEN = 0xc TCP_TIMESTAMP_OPTLEN = 0xc
TCP_UNSETPRIV = 0x28 TCP_UNSETPRIV = 0x28
TCSAFLUSH = 0x2 TCSAFLUSH = 0x2
TCSBRK = 0x5409
TCSETA = 0x5406
TCSETAF = 0x5408
TCSETAW = 0x5407
TCSETS = 0x5402
TCSETSF = 0x5404
TCSETSW = 0x5403
TCXONC = 0x540b
TIOC = 0x5400
TIOCCBRK = 0x2000747a TIOCCBRK = 0x2000747a
TIOCCDTR = 0x20007478 TIOCCDTR = 0x20007478
TIOCCONS = 0xffffffff80047462 TIOCCONS = 0xffffffff80047462

View File

@ -880,6 +880,40 @@ const (
MAP_VPAGETABLE = 0x2000 MAP_VPAGETABLE = 0x2000
MCL_CURRENT = 0x1 MCL_CURRENT = 0x1
MCL_FUTURE = 0x2 MCL_FUTURE = 0x2
MNT_ASYNC = 0x40
MNT_AUTOMOUNTED = 0x20
MNT_CMDFLAGS = 0xf0000
MNT_DEFEXPORTED = 0x200
MNT_DELEXPORT = 0x20000
MNT_EXKERB = 0x800
MNT_EXPORTANON = 0x400
MNT_EXPORTED = 0x100
MNT_EXPUBLIC = 0x20000000
MNT_EXRDONLY = 0x80
MNT_FORCE = 0x80000
MNT_IGNORE = 0x800000
MNT_LAZY = 0x4
MNT_LOCAL = 0x1000
MNT_NOATIME = 0x10000000
MNT_NOCLUSTERR = 0x40000000
MNT_NOCLUSTERW = 0x80000000
MNT_NODEV = 0x10
MNT_NOEXEC = 0x4
MNT_NOSUID = 0x8
MNT_NOSYMFOLLOW = 0x400000
MNT_NOWAIT = 0x2
MNT_QUOTA = 0x2000
MNT_RDONLY = 0x1
MNT_RELOAD = 0x40000
MNT_ROOTFS = 0x4000
MNT_SOFTDEP = 0x200000
MNT_SUIDDIR = 0x100000
MNT_SYNCHRONOUS = 0x2
MNT_TRIM = 0x1000000
MNT_UPDATE = 0x10000
MNT_USER = 0x8000
MNT_VISFLAGMASK = 0xf1f0ffff
MNT_WAIT = 0x1
MSG_CMSG_CLOEXEC = 0x1000 MSG_CMSG_CLOEXEC = 0x1000
MSG_CTRUNC = 0x20 MSG_CTRUNC = 0x20
MSG_DONTROUTE = 0x4 MSG_DONTROUTE = 0x4

View File

@ -64,6 +64,7 @@ const (
AF_VSOCK = 0x28 AF_VSOCK = 0x28
AF_WANPIPE = 0x19 AF_WANPIPE = 0x19
AF_X25 = 0x9 AF_X25 = 0x9
AF_XDP = 0x2c
ALG_OP_DECRYPT = 0x0 ALG_OP_DECRYPT = 0x0
ALG_OP_ENCRYPT = 0x1 ALG_OP_ENCRYPT = 0x1
ALG_SET_AEAD_ASSOCLEN = 0x4 ALG_SET_AEAD_ASSOCLEN = 0x4
@ -878,6 +879,26 @@ const (
IXOFF = 0x1000 IXOFF = 0x1000
IXON = 0x400 IXON = 0x400
JFFS2_SUPER_MAGIC = 0x72b6 JFFS2_SUPER_MAGIC = 0x72b6
KEXEC_ARCH_386 = 0x30000
KEXEC_ARCH_68K = 0x40000
KEXEC_ARCH_AARCH64 = 0xb70000
KEXEC_ARCH_ARM = 0x280000
KEXEC_ARCH_DEFAULT = 0x0
KEXEC_ARCH_IA_64 = 0x320000
KEXEC_ARCH_MASK = 0xffff0000
KEXEC_ARCH_MIPS = 0x80000
KEXEC_ARCH_MIPS_LE = 0xa0000
KEXEC_ARCH_PPC = 0x140000
KEXEC_ARCH_PPC64 = 0x150000
KEXEC_ARCH_S390 = 0x160000
KEXEC_ARCH_SH = 0x2a0000
KEXEC_ARCH_X86_64 = 0x3e0000
KEXEC_FILE_NO_INITRAMFS = 0x4
KEXEC_FILE_ON_CRASH = 0x2
KEXEC_FILE_UNLOAD = 0x1
KEXEC_ON_CRASH = 0x1
KEXEC_PRESERVE_CONTEXT = 0x2
KEXEC_SEGMENT_MAX = 0x10
KEYCTL_ASSUME_AUTHORITY = 0x10 KEYCTL_ASSUME_AUTHORITY = 0x10
KEYCTL_CHOWN = 0x4 KEYCTL_CHOWN = 0x4
KEYCTL_CLEAR = 0x7 KEYCTL_CLEAR = 0x7
@ -977,6 +998,21 @@ const (
MCL_CURRENT = 0x1 MCL_CURRENT = 0x1
MCL_FUTURE = 0x2 MCL_FUTURE = 0x2
MCL_ONFAULT = 0x4 MCL_ONFAULT = 0x4
MFD_ALLOW_SEALING = 0x2
MFD_CLOEXEC = 0x1
MFD_HUGETLB = 0x4
MFD_HUGE_16GB = -0x78000000
MFD_HUGE_16MB = 0x60000000
MFD_HUGE_1GB = 0x78000000
MFD_HUGE_1MB = 0x50000000
MFD_HUGE_256MB = 0x70000000
MFD_HUGE_2GB = 0x7c000000
MFD_HUGE_2MB = 0x54000000
MFD_HUGE_512KB = 0x4c000000
MFD_HUGE_64KB = 0x40000000
MFD_HUGE_8MB = 0x5c000000
MFD_HUGE_MASK = 0x3f
MFD_HUGE_SHIFT = 0x1a
MINIX2_SUPER_MAGIC = 0x2468 MINIX2_SUPER_MAGIC = 0x2468
MINIX2_SUPER_MAGIC2 = 0x2478 MINIX2_SUPER_MAGIC2 = 0x2478
MINIX3_SUPER_MAGIC = 0x4d5a MINIX3_SUPER_MAGIC = 0x4d5a
@ -1796,6 +1832,7 @@ const (
SOL_TIPC = 0x10f SOL_TIPC = 0x10f
SOL_TLS = 0x11a SOL_TLS = 0x11a
SOL_X25 = 0x106 SOL_X25 = 0x106
SOL_XDP = 0x11b
SOMAXCONN = 0x80 SOMAXCONN = 0x80
SO_ACCEPTCONN = 0x1e SO_ACCEPTCONN = 0x1e
SO_ATTACH_BPF = 0x32 SO_ATTACH_BPF = 0x32
@ -1891,6 +1928,9 @@ const (
STATX_TYPE = 0x1 STATX_TYPE = 0x1
STATX_UID = 0x8 STATX_UID = 0x8
STATX__RESERVED = 0x80000000 STATX__RESERVED = 0x80000000
SYNC_FILE_RANGE_WAIT_AFTER = 0x4
SYNC_FILE_RANGE_WAIT_BEFORE = 0x1
SYNC_FILE_RANGE_WRITE = 0x2
SYSFS_MAGIC = 0x62656572 SYSFS_MAGIC = 0x62656572
S_BLKSIZE = 0x200 S_BLKSIZE = 0x200
S_IEXEC = 0x40 S_IEXEC = 0x40
@ -2275,6 +2315,26 @@ const (
XATTR_CREATE = 0x1 XATTR_CREATE = 0x1
XATTR_REPLACE = 0x2 XATTR_REPLACE = 0x2
XCASE = 0x4 XCASE = 0x4
XDP_COPY = 0x2
XDP_FLAGS_DRV_MODE = 0x4
XDP_FLAGS_HW_MODE = 0x8
XDP_FLAGS_MASK = 0xf
XDP_FLAGS_MODES = 0xe
XDP_FLAGS_SKB_MODE = 0x2
XDP_FLAGS_UPDATE_IF_NOEXIST = 0x1
XDP_MMAP_OFFSETS = 0x1
XDP_PGOFF_RX_RING = 0x0
XDP_PGOFF_TX_RING = 0x80000000
XDP_RX_RING = 0x2
XDP_SHARED_UMEM = 0x1
XDP_STATISTICS = 0x7
XDP_TX_RING = 0x3
XDP_UMEM_COMPLETION_RING = 0x6
XDP_UMEM_FILL_RING = 0x5
XDP_UMEM_PGOFF_COMPLETION_RING = 0x180000000
XDP_UMEM_PGOFF_FILL_RING = 0x100000000
XDP_UMEM_REG = 0x4
XDP_ZEROCOPY = 0x4
XENFS_SUPER_MAGIC = 0xabba1974 XENFS_SUPER_MAGIC = 0xabba1974
XTABS = 0x1800 XTABS = 0x1800
ZSMALLOC_MAGIC = 0x58295829 ZSMALLOC_MAGIC = 0x58295829

View File

@ -64,6 +64,7 @@ const (
AF_VSOCK = 0x28 AF_VSOCK = 0x28
AF_WANPIPE = 0x19 AF_WANPIPE = 0x19
AF_X25 = 0x9 AF_X25 = 0x9
AF_XDP = 0x2c
ALG_OP_DECRYPT = 0x0 ALG_OP_DECRYPT = 0x0
ALG_OP_ENCRYPT = 0x1 ALG_OP_ENCRYPT = 0x1
ALG_SET_AEAD_ASSOCLEN = 0x4 ALG_SET_AEAD_ASSOCLEN = 0x4
@ -878,6 +879,26 @@ const (
IXOFF = 0x1000 IXOFF = 0x1000
IXON = 0x400 IXON = 0x400
JFFS2_SUPER_MAGIC = 0x72b6 JFFS2_SUPER_MAGIC = 0x72b6
KEXEC_ARCH_386 = 0x30000
KEXEC_ARCH_68K = 0x40000
KEXEC_ARCH_AARCH64 = 0xb70000
KEXEC_ARCH_ARM = 0x280000
KEXEC_ARCH_DEFAULT = 0x0
KEXEC_ARCH_IA_64 = 0x320000
KEXEC_ARCH_MASK = 0xffff0000
KEXEC_ARCH_MIPS = 0x80000
KEXEC_ARCH_MIPS_LE = 0xa0000
KEXEC_ARCH_PPC = 0x140000
KEXEC_ARCH_PPC64 = 0x150000
KEXEC_ARCH_S390 = 0x160000
KEXEC_ARCH_SH = 0x2a0000
KEXEC_ARCH_X86_64 = 0x3e0000
KEXEC_FILE_NO_INITRAMFS = 0x4
KEXEC_FILE_ON_CRASH = 0x2
KEXEC_FILE_UNLOAD = 0x1
KEXEC_ON_CRASH = 0x1
KEXEC_PRESERVE_CONTEXT = 0x2
KEXEC_SEGMENT_MAX = 0x10
KEYCTL_ASSUME_AUTHORITY = 0x10 KEYCTL_ASSUME_AUTHORITY = 0x10
KEYCTL_CHOWN = 0x4 KEYCTL_CHOWN = 0x4
KEYCTL_CLEAR = 0x7 KEYCTL_CLEAR = 0x7
@ -977,6 +998,21 @@ const (
MCL_CURRENT = 0x1 MCL_CURRENT = 0x1
MCL_FUTURE = 0x2 MCL_FUTURE = 0x2
MCL_ONFAULT = 0x4 MCL_ONFAULT = 0x4
MFD_ALLOW_SEALING = 0x2
MFD_CLOEXEC = 0x1
MFD_HUGETLB = 0x4
MFD_HUGE_16GB = -0x78000000
MFD_HUGE_16MB = 0x60000000
MFD_HUGE_1GB = 0x78000000
MFD_HUGE_1MB = 0x50000000
MFD_HUGE_256MB = 0x70000000
MFD_HUGE_2GB = 0x7c000000
MFD_HUGE_2MB = 0x54000000
MFD_HUGE_512KB = 0x4c000000
MFD_HUGE_64KB = 0x40000000
MFD_HUGE_8MB = 0x5c000000
MFD_HUGE_MASK = 0x3f
MFD_HUGE_SHIFT = 0x1a
MINIX2_SUPER_MAGIC = 0x2468 MINIX2_SUPER_MAGIC = 0x2468
MINIX2_SUPER_MAGIC2 = 0x2478 MINIX2_SUPER_MAGIC2 = 0x2478
MINIX3_SUPER_MAGIC = 0x4d5a MINIX3_SUPER_MAGIC = 0x4d5a
@ -1797,6 +1833,7 @@ const (
SOL_TIPC = 0x10f SOL_TIPC = 0x10f
SOL_TLS = 0x11a SOL_TLS = 0x11a
SOL_X25 = 0x106 SOL_X25 = 0x106
SOL_XDP = 0x11b
SOMAXCONN = 0x80 SOMAXCONN = 0x80
SO_ACCEPTCONN = 0x1e SO_ACCEPTCONN = 0x1e
SO_ATTACH_BPF = 0x32 SO_ATTACH_BPF = 0x32
@ -1892,6 +1929,9 @@ const (
STATX_TYPE = 0x1 STATX_TYPE = 0x1
STATX_UID = 0x8 STATX_UID = 0x8
STATX__RESERVED = 0x80000000 STATX__RESERVED = 0x80000000
SYNC_FILE_RANGE_WAIT_AFTER = 0x4
SYNC_FILE_RANGE_WAIT_BEFORE = 0x1
SYNC_FILE_RANGE_WRITE = 0x2
SYSFS_MAGIC = 0x62656572 SYSFS_MAGIC = 0x62656572
S_BLKSIZE = 0x200 S_BLKSIZE = 0x200
S_IEXEC = 0x40 S_IEXEC = 0x40
@ -2275,6 +2315,26 @@ const (
XATTR_CREATE = 0x1 XATTR_CREATE = 0x1
XATTR_REPLACE = 0x2 XATTR_REPLACE = 0x2
XCASE = 0x4 XCASE = 0x4
XDP_COPY = 0x2
XDP_FLAGS_DRV_MODE = 0x4
XDP_FLAGS_HW_MODE = 0x8
XDP_FLAGS_MASK = 0xf
XDP_FLAGS_MODES = 0xe
XDP_FLAGS_SKB_MODE = 0x2
XDP_FLAGS_UPDATE_IF_NOEXIST = 0x1
XDP_MMAP_OFFSETS = 0x1
XDP_PGOFF_RX_RING = 0x0
XDP_PGOFF_TX_RING = 0x80000000
XDP_RX_RING = 0x2
XDP_SHARED_UMEM = 0x1
XDP_STATISTICS = 0x7
XDP_TX_RING = 0x3
XDP_UMEM_COMPLETION_RING = 0x6
XDP_UMEM_FILL_RING = 0x5
XDP_UMEM_PGOFF_COMPLETION_RING = 0x180000000
XDP_UMEM_PGOFF_FILL_RING = 0x100000000
XDP_UMEM_REG = 0x4
XDP_ZEROCOPY = 0x4
XENFS_SUPER_MAGIC = 0xabba1974 XENFS_SUPER_MAGIC = 0xabba1974
XTABS = 0x1800 XTABS = 0x1800
ZSMALLOC_MAGIC = 0x58295829 ZSMALLOC_MAGIC = 0x58295829

View File

@ -64,6 +64,7 @@ const (
AF_VSOCK = 0x28 AF_VSOCK = 0x28
AF_WANPIPE = 0x19 AF_WANPIPE = 0x19
AF_X25 = 0x9 AF_X25 = 0x9
AF_XDP = 0x2c
ALG_OP_DECRYPT = 0x0 ALG_OP_DECRYPT = 0x0
ALG_OP_ENCRYPT = 0x1 ALG_OP_ENCRYPT = 0x1
ALG_SET_AEAD_ASSOCLEN = 0x4 ALG_SET_AEAD_ASSOCLEN = 0x4
@ -877,6 +878,26 @@ const (
IXOFF = 0x1000 IXOFF = 0x1000
IXON = 0x400 IXON = 0x400
JFFS2_SUPER_MAGIC = 0x72b6 JFFS2_SUPER_MAGIC = 0x72b6
KEXEC_ARCH_386 = 0x30000
KEXEC_ARCH_68K = 0x40000
KEXEC_ARCH_AARCH64 = 0xb70000
KEXEC_ARCH_ARM = 0x280000
KEXEC_ARCH_DEFAULT = 0x0
KEXEC_ARCH_IA_64 = 0x320000
KEXEC_ARCH_MASK = 0xffff0000
KEXEC_ARCH_MIPS = 0x80000
KEXEC_ARCH_MIPS_LE = 0xa0000
KEXEC_ARCH_PPC = 0x140000
KEXEC_ARCH_PPC64 = 0x150000
KEXEC_ARCH_S390 = 0x160000
KEXEC_ARCH_SH = 0x2a0000
KEXEC_ARCH_X86_64 = 0x3e0000
KEXEC_FILE_NO_INITRAMFS = 0x4
KEXEC_FILE_ON_CRASH = 0x2
KEXEC_FILE_UNLOAD = 0x1
KEXEC_ON_CRASH = 0x1
KEXEC_PRESERVE_CONTEXT = 0x2
KEXEC_SEGMENT_MAX = 0x10
KEYCTL_ASSUME_AUTHORITY = 0x10 KEYCTL_ASSUME_AUTHORITY = 0x10
KEYCTL_CHOWN = 0x4 KEYCTL_CHOWN = 0x4
KEYCTL_CLEAR = 0x7 KEYCTL_CLEAR = 0x7
@ -975,6 +996,21 @@ const (
MCL_CURRENT = 0x1 MCL_CURRENT = 0x1
MCL_FUTURE = 0x2 MCL_FUTURE = 0x2
MCL_ONFAULT = 0x4 MCL_ONFAULT = 0x4
MFD_ALLOW_SEALING = 0x2
MFD_CLOEXEC = 0x1
MFD_HUGETLB = 0x4
MFD_HUGE_16GB = -0x78000000
MFD_HUGE_16MB = 0x60000000
MFD_HUGE_1GB = 0x78000000
MFD_HUGE_1MB = 0x50000000
MFD_HUGE_256MB = 0x70000000
MFD_HUGE_2GB = 0x7c000000
MFD_HUGE_2MB = 0x54000000
MFD_HUGE_512KB = 0x4c000000
MFD_HUGE_64KB = 0x40000000
MFD_HUGE_8MB = 0x5c000000
MFD_HUGE_MASK = 0x3f
MFD_HUGE_SHIFT = 0x1a
MINIX2_SUPER_MAGIC = 0x2468 MINIX2_SUPER_MAGIC = 0x2468
MINIX2_SUPER_MAGIC2 = 0x2478 MINIX2_SUPER_MAGIC2 = 0x2478
MINIX3_SUPER_MAGIC = 0x4d5a MINIX3_SUPER_MAGIC = 0x4d5a
@ -1803,6 +1839,7 @@ const (
SOL_TIPC = 0x10f SOL_TIPC = 0x10f
SOL_TLS = 0x11a SOL_TLS = 0x11a
SOL_X25 = 0x106 SOL_X25 = 0x106
SOL_XDP = 0x11b
SOMAXCONN = 0x80 SOMAXCONN = 0x80
SO_ACCEPTCONN = 0x1e SO_ACCEPTCONN = 0x1e
SO_ATTACH_BPF = 0x32 SO_ATTACH_BPF = 0x32
@ -1898,6 +1935,9 @@ const (
STATX_TYPE = 0x1 STATX_TYPE = 0x1
STATX_UID = 0x8 STATX_UID = 0x8
STATX__RESERVED = 0x80000000 STATX__RESERVED = 0x80000000
SYNC_FILE_RANGE_WAIT_AFTER = 0x4
SYNC_FILE_RANGE_WAIT_BEFORE = 0x1
SYNC_FILE_RANGE_WRITE = 0x2
SYSFS_MAGIC = 0x62656572 SYSFS_MAGIC = 0x62656572
S_BLKSIZE = 0x200 S_BLKSIZE = 0x200
S_IEXEC = 0x40 S_IEXEC = 0x40
@ -2281,6 +2321,26 @@ const (
XATTR_CREATE = 0x1 XATTR_CREATE = 0x1
XATTR_REPLACE = 0x2 XATTR_REPLACE = 0x2
XCASE = 0x4 XCASE = 0x4
XDP_COPY = 0x2
XDP_FLAGS_DRV_MODE = 0x4
XDP_FLAGS_HW_MODE = 0x8
XDP_FLAGS_MASK = 0xf
XDP_FLAGS_MODES = 0xe
XDP_FLAGS_SKB_MODE = 0x2
XDP_FLAGS_UPDATE_IF_NOEXIST = 0x1
XDP_MMAP_OFFSETS = 0x1
XDP_PGOFF_RX_RING = 0x0
XDP_PGOFF_TX_RING = 0x80000000
XDP_RX_RING = 0x2
XDP_SHARED_UMEM = 0x1
XDP_STATISTICS = 0x7
XDP_TX_RING = 0x3
XDP_UMEM_COMPLETION_RING = 0x6
XDP_UMEM_FILL_RING = 0x5
XDP_UMEM_PGOFF_COMPLETION_RING = 0x180000000
XDP_UMEM_PGOFF_FILL_RING = 0x100000000
XDP_UMEM_REG = 0x4
XDP_ZEROCOPY = 0x4
XENFS_SUPER_MAGIC = 0xabba1974 XENFS_SUPER_MAGIC = 0xabba1974
XTABS = 0x1800 XTABS = 0x1800
ZSMALLOC_MAGIC = 0x58295829 ZSMALLOC_MAGIC = 0x58295829

View File

@ -64,6 +64,7 @@ const (
AF_VSOCK = 0x28 AF_VSOCK = 0x28
AF_WANPIPE = 0x19 AF_WANPIPE = 0x19
AF_X25 = 0x9 AF_X25 = 0x9
AF_XDP = 0x2c
ALG_OP_DECRYPT = 0x0 ALG_OP_DECRYPT = 0x0
ALG_OP_ENCRYPT = 0x1 ALG_OP_ENCRYPT = 0x1
ALG_SET_AEAD_ASSOCLEN = 0x4 ALG_SET_AEAD_ASSOCLEN = 0x4
@ -880,6 +881,26 @@ const (
IXOFF = 0x1000 IXOFF = 0x1000
IXON = 0x400 IXON = 0x400
JFFS2_SUPER_MAGIC = 0x72b6 JFFS2_SUPER_MAGIC = 0x72b6
KEXEC_ARCH_386 = 0x30000
KEXEC_ARCH_68K = 0x40000
KEXEC_ARCH_AARCH64 = 0xb70000
KEXEC_ARCH_ARM = 0x280000
KEXEC_ARCH_DEFAULT = 0x0
KEXEC_ARCH_IA_64 = 0x320000
KEXEC_ARCH_MASK = 0xffff0000
KEXEC_ARCH_MIPS = 0x80000
KEXEC_ARCH_MIPS_LE = 0xa0000
KEXEC_ARCH_PPC = 0x140000
KEXEC_ARCH_PPC64 = 0x150000
KEXEC_ARCH_S390 = 0x160000
KEXEC_ARCH_SH = 0x2a0000
KEXEC_ARCH_X86_64 = 0x3e0000
KEXEC_FILE_NO_INITRAMFS = 0x4
KEXEC_FILE_ON_CRASH = 0x2
KEXEC_FILE_UNLOAD = 0x1
KEXEC_ON_CRASH = 0x1
KEXEC_PRESERVE_CONTEXT = 0x2
KEXEC_SEGMENT_MAX = 0x10
KEYCTL_ASSUME_AUTHORITY = 0x10 KEYCTL_ASSUME_AUTHORITY = 0x10
KEYCTL_CHOWN = 0x4 KEYCTL_CHOWN = 0x4
KEYCTL_CLEAR = 0x7 KEYCTL_CLEAR = 0x7
@ -978,6 +999,21 @@ const (
MCL_CURRENT = 0x1 MCL_CURRENT = 0x1
MCL_FUTURE = 0x2 MCL_FUTURE = 0x2
MCL_ONFAULT = 0x4 MCL_ONFAULT = 0x4
MFD_ALLOW_SEALING = 0x2
MFD_CLOEXEC = 0x1
MFD_HUGETLB = 0x4
MFD_HUGE_16GB = -0x78000000
MFD_HUGE_16MB = 0x60000000
MFD_HUGE_1GB = 0x78000000
MFD_HUGE_1MB = 0x50000000
MFD_HUGE_256MB = 0x70000000
MFD_HUGE_2GB = 0x7c000000
MFD_HUGE_2MB = 0x54000000
MFD_HUGE_512KB = 0x4c000000
MFD_HUGE_64KB = 0x40000000
MFD_HUGE_8MB = 0x5c000000
MFD_HUGE_MASK = 0x3f
MFD_HUGE_SHIFT = 0x1a
MINIX2_SUPER_MAGIC = 0x2468 MINIX2_SUPER_MAGIC = 0x2468
MINIX2_SUPER_MAGIC2 = 0x2478 MINIX2_SUPER_MAGIC2 = 0x2478
MINIX3_SUPER_MAGIC = 0x4d5a MINIX3_SUPER_MAGIC = 0x4d5a
@ -1787,6 +1823,7 @@ const (
SOL_TIPC = 0x10f SOL_TIPC = 0x10f
SOL_TLS = 0x11a SOL_TLS = 0x11a
SOL_X25 = 0x106 SOL_X25 = 0x106
SOL_XDP = 0x11b
SOMAXCONN = 0x80 SOMAXCONN = 0x80
SO_ACCEPTCONN = 0x1e SO_ACCEPTCONN = 0x1e
SO_ATTACH_BPF = 0x32 SO_ATTACH_BPF = 0x32
@ -1883,6 +1920,9 @@ const (
STATX_UID = 0x8 STATX_UID = 0x8
STATX__RESERVED = 0x80000000 STATX__RESERVED = 0x80000000
SVE_MAGIC = 0x53564501 SVE_MAGIC = 0x53564501
SYNC_FILE_RANGE_WAIT_AFTER = 0x4
SYNC_FILE_RANGE_WAIT_BEFORE = 0x1
SYNC_FILE_RANGE_WRITE = 0x2
SYSFS_MAGIC = 0x62656572 SYSFS_MAGIC = 0x62656572
S_BLKSIZE = 0x200 S_BLKSIZE = 0x200
S_IEXEC = 0x40 S_IEXEC = 0x40
@ -2266,6 +2306,26 @@ const (
XATTR_CREATE = 0x1 XATTR_CREATE = 0x1
XATTR_REPLACE = 0x2 XATTR_REPLACE = 0x2
XCASE = 0x4 XCASE = 0x4
XDP_COPY = 0x2
XDP_FLAGS_DRV_MODE = 0x4
XDP_FLAGS_HW_MODE = 0x8
XDP_FLAGS_MASK = 0xf
XDP_FLAGS_MODES = 0xe
XDP_FLAGS_SKB_MODE = 0x2
XDP_FLAGS_UPDATE_IF_NOEXIST = 0x1
XDP_MMAP_OFFSETS = 0x1
XDP_PGOFF_RX_RING = 0x0
XDP_PGOFF_TX_RING = 0x80000000
XDP_RX_RING = 0x2
XDP_SHARED_UMEM = 0x1
XDP_STATISTICS = 0x7
XDP_TX_RING = 0x3
XDP_UMEM_COMPLETION_RING = 0x6
XDP_UMEM_FILL_RING = 0x5
XDP_UMEM_PGOFF_COMPLETION_RING = 0x180000000
XDP_UMEM_PGOFF_FILL_RING = 0x100000000
XDP_UMEM_REG = 0x4
XDP_ZEROCOPY = 0x4
XENFS_SUPER_MAGIC = 0xabba1974 XENFS_SUPER_MAGIC = 0xabba1974
XTABS = 0x1800 XTABS = 0x1800
ZSMALLOC_MAGIC = 0x58295829 ZSMALLOC_MAGIC = 0x58295829

View File

@ -64,6 +64,7 @@ const (
AF_VSOCK = 0x28 AF_VSOCK = 0x28
AF_WANPIPE = 0x19 AF_WANPIPE = 0x19
AF_X25 = 0x9 AF_X25 = 0x9
AF_XDP = 0x2c
ALG_OP_DECRYPT = 0x0 ALG_OP_DECRYPT = 0x0
ALG_OP_ENCRYPT = 0x1 ALG_OP_ENCRYPT = 0x1
ALG_SET_AEAD_ASSOCLEN = 0x4 ALG_SET_AEAD_ASSOCLEN = 0x4
@ -877,6 +878,26 @@ const (
IXOFF = 0x1000 IXOFF = 0x1000
IXON = 0x400 IXON = 0x400
JFFS2_SUPER_MAGIC = 0x72b6 JFFS2_SUPER_MAGIC = 0x72b6
KEXEC_ARCH_386 = 0x30000
KEXEC_ARCH_68K = 0x40000
KEXEC_ARCH_AARCH64 = 0xb70000
KEXEC_ARCH_ARM = 0x280000
KEXEC_ARCH_DEFAULT = 0x0
KEXEC_ARCH_IA_64 = 0x320000
KEXEC_ARCH_MASK = 0xffff0000
KEXEC_ARCH_MIPS = 0x80000
KEXEC_ARCH_MIPS_LE = 0xa0000
KEXEC_ARCH_PPC = 0x140000
KEXEC_ARCH_PPC64 = 0x150000
KEXEC_ARCH_S390 = 0x160000
KEXEC_ARCH_SH = 0x2a0000
KEXEC_ARCH_X86_64 = 0x3e0000
KEXEC_FILE_NO_INITRAMFS = 0x4
KEXEC_FILE_ON_CRASH = 0x2
KEXEC_FILE_UNLOAD = 0x1
KEXEC_ON_CRASH = 0x1
KEXEC_PRESERVE_CONTEXT = 0x2
KEXEC_SEGMENT_MAX = 0x10
KEYCTL_ASSUME_AUTHORITY = 0x10 KEYCTL_ASSUME_AUTHORITY = 0x10
KEYCTL_CHOWN = 0x4 KEYCTL_CHOWN = 0x4
KEYCTL_CLEAR = 0x7 KEYCTL_CLEAR = 0x7
@ -975,6 +996,21 @@ const (
MCL_CURRENT = 0x1 MCL_CURRENT = 0x1
MCL_FUTURE = 0x2 MCL_FUTURE = 0x2
MCL_ONFAULT = 0x4 MCL_ONFAULT = 0x4
MFD_ALLOW_SEALING = 0x2
MFD_CLOEXEC = 0x1
MFD_HUGETLB = 0x4
MFD_HUGE_16GB = -0x78000000
MFD_HUGE_16MB = 0x60000000
MFD_HUGE_1GB = 0x78000000
MFD_HUGE_1MB = 0x50000000
MFD_HUGE_256MB = 0x70000000
MFD_HUGE_2GB = 0x7c000000
MFD_HUGE_2MB = 0x54000000
MFD_HUGE_512KB = 0x4c000000
MFD_HUGE_64KB = 0x40000000
MFD_HUGE_8MB = 0x5c000000
MFD_HUGE_MASK = 0x3f
MFD_HUGE_SHIFT = 0x1a
MINIX2_SUPER_MAGIC = 0x2468 MINIX2_SUPER_MAGIC = 0x2468
MINIX2_SUPER_MAGIC2 = 0x2478 MINIX2_SUPER_MAGIC2 = 0x2478
MINIX3_SUPER_MAGIC = 0x4d5a MINIX3_SUPER_MAGIC = 0x4d5a
@ -1796,6 +1832,7 @@ const (
SOL_TIPC = 0x10f SOL_TIPC = 0x10f
SOL_TLS = 0x11a SOL_TLS = 0x11a
SOL_X25 = 0x106 SOL_X25 = 0x106
SOL_XDP = 0x11b
SOMAXCONN = 0x80 SOMAXCONN = 0x80
SO_ACCEPTCONN = 0x1009 SO_ACCEPTCONN = 0x1009
SO_ATTACH_BPF = 0x32 SO_ATTACH_BPF = 0x32
@ -1892,6 +1929,9 @@ const (
STATX_TYPE = 0x1 STATX_TYPE = 0x1
STATX_UID = 0x8 STATX_UID = 0x8
STATX__RESERVED = 0x80000000 STATX__RESERVED = 0x80000000
SYNC_FILE_RANGE_WAIT_AFTER = 0x4
SYNC_FILE_RANGE_WAIT_BEFORE = 0x1
SYNC_FILE_RANGE_WRITE = 0x2
SYSFS_MAGIC = 0x62656572 SYSFS_MAGIC = 0x62656572
S_BLKSIZE = 0x200 S_BLKSIZE = 0x200
S_IEXEC = 0x40 S_IEXEC = 0x40
@ -2277,6 +2317,26 @@ const (
XATTR_CREATE = 0x1 XATTR_CREATE = 0x1
XATTR_REPLACE = 0x2 XATTR_REPLACE = 0x2
XCASE = 0x4 XCASE = 0x4
XDP_COPY = 0x2
XDP_FLAGS_DRV_MODE = 0x4
XDP_FLAGS_HW_MODE = 0x8
XDP_FLAGS_MASK = 0xf
XDP_FLAGS_MODES = 0xe
XDP_FLAGS_SKB_MODE = 0x2
XDP_FLAGS_UPDATE_IF_NOEXIST = 0x1
XDP_MMAP_OFFSETS = 0x1
XDP_PGOFF_RX_RING = 0x0
XDP_PGOFF_TX_RING = 0x80000000
XDP_RX_RING = 0x2
XDP_SHARED_UMEM = 0x1
XDP_STATISTICS = 0x7
XDP_TX_RING = 0x3
XDP_UMEM_COMPLETION_RING = 0x6
XDP_UMEM_FILL_RING = 0x5
XDP_UMEM_PGOFF_COMPLETION_RING = 0x180000000
XDP_UMEM_PGOFF_FILL_RING = 0x100000000
XDP_UMEM_REG = 0x4
XDP_ZEROCOPY = 0x4
XENFS_SUPER_MAGIC = 0xabba1974 XENFS_SUPER_MAGIC = 0xabba1974
XTABS = 0x1800 XTABS = 0x1800
ZSMALLOC_MAGIC = 0x58295829 ZSMALLOC_MAGIC = 0x58295829

View File

@ -64,6 +64,7 @@ const (
AF_VSOCK = 0x28 AF_VSOCK = 0x28
AF_WANPIPE = 0x19 AF_WANPIPE = 0x19
AF_X25 = 0x9 AF_X25 = 0x9
AF_XDP = 0x2c
ALG_OP_DECRYPT = 0x0 ALG_OP_DECRYPT = 0x0
ALG_OP_ENCRYPT = 0x1 ALG_OP_ENCRYPT = 0x1
ALG_SET_AEAD_ASSOCLEN = 0x4 ALG_SET_AEAD_ASSOCLEN = 0x4
@ -877,6 +878,26 @@ const (
IXOFF = 0x1000 IXOFF = 0x1000
IXON = 0x400 IXON = 0x400
JFFS2_SUPER_MAGIC = 0x72b6 JFFS2_SUPER_MAGIC = 0x72b6
KEXEC_ARCH_386 = 0x30000
KEXEC_ARCH_68K = 0x40000
KEXEC_ARCH_AARCH64 = 0xb70000
KEXEC_ARCH_ARM = 0x280000
KEXEC_ARCH_DEFAULT = 0x0
KEXEC_ARCH_IA_64 = 0x320000
KEXEC_ARCH_MASK = 0xffff0000
KEXEC_ARCH_MIPS = 0x80000
KEXEC_ARCH_MIPS_LE = 0xa0000
KEXEC_ARCH_PPC = 0x140000
KEXEC_ARCH_PPC64 = 0x150000
KEXEC_ARCH_S390 = 0x160000
KEXEC_ARCH_SH = 0x2a0000
KEXEC_ARCH_X86_64 = 0x3e0000
KEXEC_FILE_NO_INITRAMFS = 0x4
KEXEC_FILE_ON_CRASH = 0x2
KEXEC_FILE_UNLOAD = 0x1
KEXEC_ON_CRASH = 0x1
KEXEC_PRESERVE_CONTEXT = 0x2
KEXEC_SEGMENT_MAX = 0x10
KEYCTL_ASSUME_AUTHORITY = 0x10 KEYCTL_ASSUME_AUTHORITY = 0x10
KEYCTL_CHOWN = 0x4 KEYCTL_CHOWN = 0x4
KEYCTL_CLEAR = 0x7 KEYCTL_CLEAR = 0x7
@ -975,6 +996,21 @@ const (
MCL_CURRENT = 0x1 MCL_CURRENT = 0x1
MCL_FUTURE = 0x2 MCL_FUTURE = 0x2
MCL_ONFAULT = 0x4 MCL_ONFAULT = 0x4
MFD_ALLOW_SEALING = 0x2
MFD_CLOEXEC = 0x1
MFD_HUGETLB = 0x4
MFD_HUGE_16GB = -0x78000000
MFD_HUGE_16MB = 0x60000000
MFD_HUGE_1GB = 0x78000000
MFD_HUGE_1MB = 0x50000000
MFD_HUGE_256MB = 0x70000000
MFD_HUGE_2GB = 0x7c000000
MFD_HUGE_2MB = 0x54000000
MFD_HUGE_512KB = 0x4c000000
MFD_HUGE_64KB = 0x40000000
MFD_HUGE_8MB = 0x5c000000
MFD_HUGE_MASK = 0x3f
MFD_HUGE_SHIFT = 0x1a
MINIX2_SUPER_MAGIC = 0x2468 MINIX2_SUPER_MAGIC = 0x2468
MINIX2_SUPER_MAGIC2 = 0x2478 MINIX2_SUPER_MAGIC2 = 0x2478
MINIX3_SUPER_MAGIC = 0x4d5a MINIX3_SUPER_MAGIC = 0x4d5a
@ -1796,6 +1832,7 @@ const (
SOL_TIPC = 0x10f SOL_TIPC = 0x10f
SOL_TLS = 0x11a SOL_TLS = 0x11a
SOL_X25 = 0x106 SOL_X25 = 0x106
SOL_XDP = 0x11b
SOMAXCONN = 0x80 SOMAXCONN = 0x80
SO_ACCEPTCONN = 0x1009 SO_ACCEPTCONN = 0x1009
SO_ATTACH_BPF = 0x32 SO_ATTACH_BPF = 0x32
@ -1892,6 +1929,9 @@ const (
STATX_TYPE = 0x1 STATX_TYPE = 0x1
STATX_UID = 0x8 STATX_UID = 0x8
STATX__RESERVED = 0x80000000 STATX__RESERVED = 0x80000000
SYNC_FILE_RANGE_WAIT_AFTER = 0x4
SYNC_FILE_RANGE_WAIT_BEFORE = 0x1
SYNC_FILE_RANGE_WRITE = 0x2
SYSFS_MAGIC = 0x62656572 SYSFS_MAGIC = 0x62656572
S_BLKSIZE = 0x200 S_BLKSIZE = 0x200
S_IEXEC = 0x40 S_IEXEC = 0x40
@ -2277,6 +2317,26 @@ const (
XATTR_CREATE = 0x1 XATTR_CREATE = 0x1
XATTR_REPLACE = 0x2 XATTR_REPLACE = 0x2
XCASE = 0x4 XCASE = 0x4
XDP_COPY = 0x2
XDP_FLAGS_DRV_MODE = 0x4
XDP_FLAGS_HW_MODE = 0x8
XDP_FLAGS_MASK = 0xf
XDP_FLAGS_MODES = 0xe
XDP_FLAGS_SKB_MODE = 0x2
XDP_FLAGS_UPDATE_IF_NOEXIST = 0x1
XDP_MMAP_OFFSETS = 0x1
XDP_PGOFF_RX_RING = 0x0
XDP_PGOFF_TX_RING = 0x80000000
XDP_RX_RING = 0x2
XDP_SHARED_UMEM = 0x1
XDP_STATISTICS = 0x7
XDP_TX_RING = 0x3
XDP_UMEM_COMPLETION_RING = 0x6
XDP_UMEM_FILL_RING = 0x5
XDP_UMEM_PGOFF_COMPLETION_RING = 0x180000000
XDP_UMEM_PGOFF_FILL_RING = 0x100000000
XDP_UMEM_REG = 0x4
XDP_ZEROCOPY = 0x4
XENFS_SUPER_MAGIC = 0xabba1974 XENFS_SUPER_MAGIC = 0xabba1974
XTABS = 0x1800 XTABS = 0x1800
ZSMALLOC_MAGIC = 0x58295829 ZSMALLOC_MAGIC = 0x58295829

View File

@ -64,6 +64,7 @@ const (
AF_VSOCK = 0x28 AF_VSOCK = 0x28
AF_WANPIPE = 0x19 AF_WANPIPE = 0x19
AF_X25 = 0x9 AF_X25 = 0x9
AF_XDP = 0x2c
ALG_OP_DECRYPT = 0x0 ALG_OP_DECRYPT = 0x0
ALG_OP_ENCRYPT = 0x1 ALG_OP_ENCRYPT = 0x1
ALG_SET_AEAD_ASSOCLEN = 0x4 ALG_SET_AEAD_ASSOCLEN = 0x4
@ -877,6 +878,26 @@ const (
IXOFF = 0x1000 IXOFF = 0x1000
IXON = 0x400 IXON = 0x400
JFFS2_SUPER_MAGIC = 0x72b6 JFFS2_SUPER_MAGIC = 0x72b6
KEXEC_ARCH_386 = 0x30000
KEXEC_ARCH_68K = 0x40000
KEXEC_ARCH_AARCH64 = 0xb70000
KEXEC_ARCH_ARM = 0x280000
KEXEC_ARCH_DEFAULT = 0x0
KEXEC_ARCH_IA_64 = 0x320000
KEXEC_ARCH_MASK = 0xffff0000
KEXEC_ARCH_MIPS = 0x80000
KEXEC_ARCH_MIPS_LE = 0xa0000
KEXEC_ARCH_PPC = 0x140000
KEXEC_ARCH_PPC64 = 0x150000
KEXEC_ARCH_S390 = 0x160000
KEXEC_ARCH_SH = 0x2a0000
KEXEC_ARCH_X86_64 = 0x3e0000
KEXEC_FILE_NO_INITRAMFS = 0x4
KEXEC_FILE_ON_CRASH = 0x2
KEXEC_FILE_UNLOAD = 0x1
KEXEC_ON_CRASH = 0x1
KEXEC_PRESERVE_CONTEXT = 0x2
KEXEC_SEGMENT_MAX = 0x10
KEYCTL_ASSUME_AUTHORITY = 0x10 KEYCTL_ASSUME_AUTHORITY = 0x10
KEYCTL_CHOWN = 0x4 KEYCTL_CHOWN = 0x4
KEYCTL_CLEAR = 0x7 KEYCTL_CLEAR = 0x7
@ -975,6 +996,21 @@ const (
MCL_CURRENT = 0x1 MCL_CURRENT = 0x1
MCL_FUTURE = 0x2 MCL_FUTURE = 0x2
MCL_ONFAULT = 0x4 MCL_ONFAULT = 0x4
MFD_ALLOW_SEALING = 0x2
MFD_CLOEXEC = 0x1
MFD_HUGETLB = 0x4
MFD_HUGE_16GB = -0x78000000
MFD_HUGE_16MB = 0x60000000
MFD_HUGE_1GB = 0x78000000
MFD_HUGE_1MB = 0x50000000
MFD_HUGE_256MB = 0x70000000
MFD_HUGE_2GB = 0x7c000000
MFD_HUGE_2MB = 0x54000000
MFD_HUGE_512KB = 0x4c000000
MFD_HUGE_64KB = 0x40000000
MFD_HUGE_8MB = 0x5c000000
MFD_HUGE_MASK = 0x3f
MFD_HUGE_SHIFT = 0x1a
MINIX2_SUPER_MAGIC = 0x2468 MINIX2_SUPER_MAGIC = 0x2468
MINIX2_SUPER_MAGIC2 = 0x2478 MINIX2_SUPER_MAGIC2 = 0x2478
MINIX3_SUPER_MAGIC = 0x4d5a MINIX3_SUPER_MAGIC = 0x4d5a
@ -1796,6 +1832,7 @@ const (
SOL_TIPC = 0x10f SOL_TIPC = 0x10f
SOL_TLS = 0x11a SOL_TLS = 0x11a
SOL_X25 = 0x106 SOL_X25 = 0x106
SOL_XDP = 0x11b
SOMAXCONN = 0x80 SOMAXCONN = 0x80
SO_ACCEPTCONN = 0x1009 SO_ACCEPTCONN = 0x1009
SO_ATTACH_BPF = 0x32 SO_ATTACH_BPF = 0x32
@ -1892,6 +1929,9 @@ const (
STATX_TYPE = 0x1 STATX_TYPE = 0x1
STATX_UID = 0x8 STATX_UID = 0x8
STATX__RESERVED = 0x80000000 STATX__RESERVED = 0x80000000
SYNC_FILE_RANGE_WAIT_AFTER = 0x4
SYNC_FILE_RANGE_WAIT_BEFORE = 0x1
SYNC_FILE_RANGE_WRITE = 0x2
SYSFS_MAGIC = 0x62656572 SYSFS_MAGIC = 0x62656572
S_BLKSIZE = 0x200 S_BLKSIZE = 0x200
S_IEXEC = 0x40 S_IEXEC = 0x40
@ -2277,6 +2317,26 @@ const (
XATTR_CREATE = 0x1 XATTR_CREATE = 0x1
XATTR_REPLACE = 0x2 XATTR_REPLACE = 0x2
XCASE = 0x4 XCASE = 0x4
XDP_COPY = 0x2
XDP_FLAGS_DRV_MODE = 0x4
XDP_FLAGS_HW_MODE = 0x8
XDP_FLAGS_MASK = 0xf
XDP_FLAGS_MODES = 0xe
XDP_FLAGS_SKB_MODE = 0x2
XDP_FLAGS_UPDATE_IF_NOEXIST = 0x1
XDP_MMAP_OFFSETS = 0x1
XDP_PGOFF_RX_RING = 0x0
XDP_PGOFF_TX_RING = 0x80000000
XDP_RX_RING = 0x2
XDP_SHARED_UMEM = 0x1
XDP_STATISTICS = 0x7
XDP_TX_RING = 0x3
XDP_UMEM_COMPLETION_RING = 0x6
XDP_UMEM_FILL_RING = 0x5
XDP_UMEM_PGOFF_COMPLETION_RING = 0x180000000
XDP_UMEM_PGOFF_FILL_RING = 0x100000000
XDP_UMEM_REG = 0x4
XDP_ZEROCOPY = 0x4
XENFS_SUPER_MAGIC = 0xabba1974 XENFS_SUPER_MAGIC = 0xabba1974
XTABS = 0x1800 XTABS = 0x1800
ZSMALLOC_MAGIC = 0x58295829 ZSMALLOC_MAGIC = 0x58295829

View File

@ -64,6 +64,7 @@ const (
AF_VSOCK = 0x28 AF_VSOCK = 0x28
AF_WANPIPE = 0x19 AF_WANPIPE = 0x19
AF_X25 = 0x9 AF_X25 = 0x9
AF_XDP = 0x2c
ALG_OP_DECRYPT = 0x0 ALG_OP_DECRYPT = 0x0
ALG_OP_ENCRYPT = 0x1 ALG_OP_ENCRYPT = 0x1
ALG_SET_AEAD_ASSOCLEN = 0x4 ALG_SET_AEAD_ASSOCLEN = 0x4
@ -877,6 +878,26 @@ const (
IXOFF = 0x1000 IXOFF = 0x1000
IXON = 0x400 IXON = 0x400
JFFS2_SUPER_MAGIC = 0x72b6 JFFS2_SUPER_MAGIC = 0x72b6
KEXEC_ARCH_386 = 0x30000
KEXEC_ARCH_68K = 0x40000
KEXEC_ARCH_AARCH64 = 0xb70000
KEXEC_ARCH_ARM = 0x280000
KEXEC_ARCH_DEFAULT = 0x0
KEXEC_ARCH_IA_64 = 0x320000
KEXEC_ARCH_MASK = 0xffff0000
KEXEC_ARCH_MIPS = 0x80000
KEXEC_ARCH_MIPS_LE = 0xa0000
KEXEC_ARCH_PPC = 0x140000
KEXEC_ARCH_PPC64 = 0x150000
KEXEC_ARCH_S390 = 0x160000
KEXEC_ARCH_SH = 0x2a0000
KEXEC_ARCH_X86_64 = 0x3e0000
KEXEC_FILE_NO_INITRAMFS = 0x4
KEXEC_FILE_ON_CRASH = 0x2
KEXEC_FILE_UNLOAD = 0x1
KEXEC_ON_CRASH = 0x1
KEXEC_PRESERVE_CONTEXT = 0x2
KEXEC_SEGMENT_MAX = 0x10
KEYCTL_ASSUME_AUTHORITY = 0x10 KEYCTL_ASSUME_AUTHORITY = 0x10
KEYCTL_CHOWN = 0x4 KEYCTL_CHOWN = 0x4
KEYCTL_CLEAR = 0x7 KEYCTL_CLEAR = 0x7
@ -975,6 +996,21 @@ const (
MCL_CURRENT = 0x1 MCL_CURRENT = 0x1
MCL_FUTURE = 0x2 MCL_FUTURE = 0x2
MCL_ONFAULT = 0x4 MCL_ONFAULT = 0x4
MFD_ALLOW_SEALING = 0x2
MFD_CLOEXEC = 0x1
MFD_HUGETLB = 0x4
MFD_HUGE_16GB = -0x78000000
MFD_HUGE_16MB = 0x60000000
MFD_HUGE_1GB = 0x78000000
MFD_HUGE_1MB = 0x50000000
MFD_HUGE_256MB = 0x70000000
MFD_HUGE_2GB = 0x7c000000
MFD_HUGE_2MB = 0x54000000
MFD_HUGE_512KB = 0x4c000000
MFD_HUGE_64KB = 0x40000000
MFD_HUGE_8MB = 0x5c000000
MFD_HUGE_MASK = 0x3f
MFD_HUGE_SHIFT = 0x1a
MINIX2_SUPER_MAGIC = 0x2468 MINIX2_SUPER_MAGIC = 0x2468
MINIX2_SUPER_MAGIC2 = 0x2478 MINIX2_SUPER_MAGIC2 = 0x2478
MINIX3_SUPER_MAGIC = 0x4d5a MINIX3_SUPER_MAGIC = 0x4d5a
@ -1796,6 +1832,7 @@ const (
SOL_TIPC = 0x10f SOL_TIPC = 0x10f
SOL_TLS = 0x11a SOL_TLS = 0x11a
SOL_X25 = 0x106 SOL_X25 = 0x106
SOL_XDP = 0x11b
SOMAXCONN = 0x80 SOMAXCONN = 0x80
SO_ACCEPTCONN = 0x1009 SO_ACCEPTCONN = 0x1009
SO_ATTACH_BPF = 0x32 SO_ATTACH_BPF = 0x32
@ -1892,6 +1929,9 @@ const (
STATX_TYPE = 0x1 STATX_TYPE = 0x1
STATX_UID = 0x8 STATX_UID = 0x8
STATX__RESERVED = 0x80000000 STATX__RESERVED = 0x80000000
SYNC_FILE_RANGE_WAIT_AFTER = 0x4
SYNC_FILE_RANGE_WAIT_BEFORE = 0x1
SYNC_FILE_RANGE_WRITE = 0x2
SYSFS_MAGIC = 0x62656572 SYSFS_MAGIC = 0x62656572
S_BLKSIZE = 0x200 S_BLKSIZE = 0x200
S_IEXEC = 0x40 S_IEXEC = 0x40
@ -2277,6 +2317,26 @@ const (
XATTR_CREATE = 0x1 XATTR_CREATE = 0x1
XATTR_REPLACE = 0x2 XATTR_REPLACE = 0x2
XCASE = 0x4 XCASE = 0x4
XDP_COPY = 0x2
XDP_FLAGS_DRV_MODE = 0x4
XDP_FLAGS_HW_MODE = 0x8
XDP_FLAGS_MASK = 0xf
XDP_FLAGS_MODES = 0xe
XDP_FLAGS_SKB_MODE = 0x2
XDP_FLAGS_UPDATE_IF_NOEXIST = 0x1
XDP_MMAP_OFFSETS = 0x1
XDP_PGOFF_RX_RING = 0x0
XDP_PGOFF_TX_RING = 0x80000000
XDP_RX_RING = 0x2
XDP_SHARED_UMEM = 0x1
XDP_STATISTICS = 0x7
XDP_TX_RING = 0x3
XDP_UMEM_COMPLETION_RING = 0x6
XDP_UMEM_FILL_RING = 0x5
XDP_UMEM_PGOFF_COMPLETION_RING = 0x180000000
XDP_UMEM_PGOFF_FILL_RING = 0x100000000
XDP_UMEM_REG = 0x4
XDP_ZEROCOPY = 0x4
XENFS_SUPER_MAGIC = 0xabba1974 XENFS_SUPER_MAGIC = 0xabba1974
XTABS = 0x1800 XTABS = 0x1800
ZSMALLOC_MAGIC = 0x58295829 ZSMALLOC_MAGIC = 0x58295829

View File

@ -64,6 +64,7 @@ const (
AF_VSOCK = 0x28 AF_VSOCK = 0x28
AF_WANPIPE = 0x19 AF_WANPIPE = 0x19
AF_X25 = 0x9 AF_X25 = 0x9
AF_XDP = 0x2c
ALG_OP_DECRYPT = 0x0 ALG_OP_DECRYPT = 0x0
ALG_OP_ENCRYPT = 0x1 ALG_OP_ENCRYPT = 0x1
ALG_SET_AEAD_ASSOCLEN = 0x4 ALG_SET_AEAD_ASSOCLEN = 0x4
@ -877,6 +878,26 @@ const (
IXOFF = 0x400 IXOFF = 0x400
IXON = 0x200 IXON = 0x200
JFFS2_SUPER_MAGIC = 0x72b6 JFFS2_SUPER_MAGIC = 0x72b6
KEXEC_ARCH_386 = 0x30000
KEXEC_ARCH_68K = 0x40000
KEXEC_ARCH_AARCH64 = 0xb70000
KEXEC_ARCH_ARM = 0x280000
KEXEC_ARCH_DEFAULT = 0x0
KEXEC_ARCH_IA_64 = 0x320000
KEXEC_ARCH_MASK = 0xffff0000
KEXEC_ARCH_MIPS = 0x80000
KEXEC_ARCH_MIPS_LE = 0xa0000
KEXEC_ARCH_PPC = 0x140000
KEXEC_ARCH_PPC64 = 0x150000
KEXEC_ARCH_S390 = 0x160000
KEXEC_ARCH_SH = 0x2a0000
KEXEC_ARCH_X86_64 = 0x3e0000
KEXEC_FILE_NO_INITRAMFS = 0x4
KEXEC_FILE_ON_CRASH = 0x2
KEXEC_FILE_UNLOAD = 0x1
KEXEC_ON_CRASH = 0x1
KEXEC_PRESERVE_CONTEXT = 0x2
KEXEC_SEGMENT_MAX = 0x10
KEYCTL_ASSUME_AUTHORITY = 0x10 KEYCTL_ASSUME_AUTHORITY = 0x10
KEYCTL_CHOWN = 0x4 KEYCTL_CHOWN = 0x4
KEYCTL_CLEAR = 0x7 KEYCTL_CLEAR = 0x7
@ -974,6 +995,21 @@ const (
MCL_CURRENT = 0x2000 MCL_CURRENT = 0x2000
MCL_FUTURE = 0x4000 MCL_FUTURE = 0x4000
MCL_ONFAULT = 0x8000 MCL_ONFAULT = 0x8000
MFD_ALLOW_SEALING = 0x2
MFD_CLOEXEC = 0x1
MFD_HUGETLB = 0x4
MFD_HUGE_16GB = -0x78000000
MFD_HUGE_16MB = 0x60000000
MFD_HUGE_1GB = 0x78000000
MFD_HUGE_1MB = 0x50000000
MFD_HUGE_256MB = 0x70000000
MFD_HUGE_2GB = 0x7c000000
MFD_HUGE_2MB = 0x54000000
MFD_HUGE_512KB = 0x4c000000
MFD_HUGE_64KB = 0x40000000
MFD_HUGE_8MB = 0x5c000000
MFD_HUGE_MASK = 0x3f
MFD_HUGE_SHIFT = 0x1a
MINIX2_SUPER_MAGIC = 0x2468 MINIX2_SUPER_MAGIC = 0x2468
MINIX2_SUPER_MAGIC2 = 0x2478 MINIX2_SUPER_MAGIC2 = 0x2478
MINIX3_SUPER_MAGIC = 0x4d5a MINIX3_SUPER_MAGIC = 0x4d5a
@ -1852,6 +1888,7 @@ const (
SOL_TIPC = 0x10f SOL_TIPC = 0x10f
SOL_TLS = 0x11a SOL_TLS = 0x11a
SOL_X25 = 0x106 SOL_X25 = 0x106
SOL_XDP = 0x11b
SOMAXCONN = 0x80 SOMAXCONN = 0x80
SO_ACCEPTCONN = 0x1e SO_ACCEPTCONN = 0x1e
SO_ATTACH_BPF = 0x32 SO_ATTACH_BPF = 0x32
@ -1947,6 +1984,9 @@ const (
STATX_TYPE = 0x1 STATX_TYPE = 0x1
STATX_UID = 0x8 STATX_UID = 0x8
STATX__RESERVED = 0x80000000 STATX__RESERVED = 0x80000000
SYNC_FILE_RANGE_WAIT_AFTER = 0x4
SYNC_FILE_RANGE_WAIT_BEFORE = 0x1
SYNC_FILE_RANGE_WRITE = 0x2
SYSFS_MAGIC = 0x62656572 SYSFS_MAGIC = 0x62656572
S_BLKSIZE = 0x200 S_BLKSIZE = 0x200
S_IEXEC = 0x40 S_IEXEC = 0x40
@ -2334,6 +2374,26 @@ const (
XATTR_CREATE = 0x1 XATTR_CREATE = 0x1
XATTR_REPLACE = 0x2 XATTR_REPLACE = 0x2
XCASE = 0x4000 XCASE = 0x4000
XDP_COPY = 0x2
XDP_FLAGS_DRV_MODE = 0x4
XDP_FLAGS_HW_MODE = 0x8
XDP_FLAGS_MASK = 0xf
XDP_FLAGS_MODES = 0xe
XDP_FLAGS_SKB_MODE = 0x2
XDP_FLAGS_UPDATE_IF_NOEXIST = 0x1
XDP_MMAP_OFFSETS = 0x1
XDP_PGOFF_RX_RING = 0x0
XDP_PGOFF_TX_RING = 0x80000000
XDP_RX_RING = 0x2
XDP_SHARED_UMEM = 0x1
XDP_STATISTICS = 0x7
XDP_TX_RING = 0x3
XDP_UMEM_COMPLETION_RING = 0x6
XDP_UMEM_FILL_RING = 0x5
XDP_UMEM_PGOFF_COMPLETION_RING = 0x180000000
XDP_UMEM_PGOFF_FILL_RING = 0x100000000
XDP_UMEM_REG = 0x4
XDP_ZEROCOPY = 0x4
XENFS_SUPER_MAGIC = 0xabba1974 XENFS_SUPER_MAGIC = 0xabba1974
XTABS = 0xc00 XTABS = 0xc00
ZSMALLOC_MAGIC = 0x58295829 ZSMALLOC_MAGIC = 0x58295829

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